String.prototype.trim1 = function() {
	return this.replace(/^s+|s+$/g,"");
}


//TODO
//This is copied for news, remove unneccessary js functions

//feedmod function
function hidePop(){return false;}
function showPop(e,obj,str){return false;}
function doFMClick(oLink,image,headline){return false;}

// Top Videos
var AOLVS = null;
var theHTML =null;
var query = null;
var tab =0;
var tabtopic = null;
var numbertab = null;
var currentSlide = 0;
var vidArray = new Array();
var maxChar = null;

function handlePageLoad() {
    numbertab = document.getElementById("videotab").getElementsByTagName('li');
    AOLVS = new AOLVideoSearch('sskxzi7esi3tjgqvl');

    AOLVS.results = arguments[1];
	query = arguments[0];
	maxChar = arguments[2];
    AOLVS.attachEvent('onload', 'handleVSLoad(query, 0);');
    AOLVS.attachEvent('onupdate', 'handleUpdate();');
    AOLVS.initialize();
}

function loadVideo(){
    handleVSLoad(arguments[0],arguments[1]);
    initvideo = null;
    currentSlide=0;
    return initvideo;
}
 
function handleVSLoad() {
    displayMessage();
    tabtopic = arguments[1];
    param = arguments[0];	
    AOLVS.getVideos(arguments[0]);  
    activeTab(arguments[1]);
    return tabtopic;
}
 
function activeTab(){
    for(var v=0; v<numbertab.length; v++){
        if (arguments[0] != v) {
            document.getElementById("tb."+v).className = '';
        }
    }
    document.getElementById("tb."+arguments[0]).className = 'selected';
}
  
function displayMessage() {
    theHTML = '<div style="text-align:center;clear:both;height:85px;width:308px;background-color:#f3f3f3;border-top:45px solid #f3f3f3;"><img src="http://o.aolcdn.com/art/dynanews/progress-animation"> Loading...</div>';
    document.getElementById('video_results').innerHTML = theHTML;
}

function vidSlide(direct) {
    if (direct == 1){
        if (currentSlide + 1  == AOLVS.results){
            currentSlide = 0;
        } else if (currentSlide +1 < AOLVS.results){
            currentSlide += 1;
        }
    } else {
        if (currentSlide == 0) {
            currentSlide = AOLVS.results-1;
        } else if (currentSlide -1 >= 0) {
           currentSlide -=1;
        }
    }
    document.getElementById('tally').innerHTML = '      '+(currentSlide + 1)+ '  of  ' + '  '+AOLVS.results+'      ';
    document.getElementById('video').innerHTML = vidArray[currentSlide];
}

function intializeSeq() {
    initVidHTML = vidArray[0];  
    document.getElementById('video').innerHTML = initVidHTML;
}

function handleUpdate() {
    theHTML = '';
    initHTML ='';
    viewAllHTML = '';

    switch(tabtopic){	
		case 0:
            viewAllHTML += '<a href="http://video.aol.com/video-search/query/category%3A%22News%22%20channel%3A%22AOL%20News%22%20sort%3AmostRecent%20distributor%3A%22AP%22/familyFilter/0" target="_blank">See all AP Videos</a>';
            break;
        case 1:
            viewAllHTML += '<a href="http://video.aol.com/video-search/query/category%3A%22News%22%20channel%3A%22AOL%20News%22%20sort%3AmostRecent%20distributor%3A%22CNN%22/familyFilter/0" target="_blank">See all CNN Videos</a>';
            break;
        case 2:
            viewAllHTML += '<a href="http://video.aol.com/video-search/query/category%3A%22News%22%20channel%3A%22AOL%20News%22%20sort%3AmostRecent%20distributor%3A%22CBS%22/familyFilter/0" target="_blank">See all CBS Videos</a>';
            break;
        case 3:
            viewAllHTML += '<a href="http://video.aol.com/video-search/query/category%3A%22News%22%20channel%3A%22AOL%20News%22%20sort%3AmostRecent%20distributor%3A%22Reuters%22/familyFilter/0" target="_blank">See all Reuters Videos</a>';
            break;
    }

    theHTML +='<div id="video">';

    if ( AOLVS.VideoSet.totalResultsReturned < AOLVS.results ) { 	
        AOLVS.results = AOLVS.VideoSet.totalResultsReturned;
	}

    if ( AOLVS.VideoSet.totalResultsReturned > 0 ) {
        for (var i=0; i < AOLVS.VideoSet.totalResultsReturned; i++) {   
            var caption = AOLVS.VideoSet.Video[i].description;
            var charCount = new description(caption, maxChar);
































            vidArray[i] ='<div id="vid.'+i+'" class="tab"><div class="video_content"><p class="news_title">'+ AOLVS.VideoSet.Video[i].title+'</p><div class="news_image"><a href="'+AOLVS.VideoSet.Video[i].videoUrl +'" target="_blank" class="img"><img src="'+ AOLVS.VideoSet.Video[i].thumbnailUrl +'" width="116" height="82" alt="'+ AOLVS.VideoSet.Video[i].title+'" title="'+ AOLVS.VideoSet.Video[i].title+'"></a></div><p class="news_content">'+ charCount.characherCount() +'<span class="details">'+ viewAllHTML+'</span></p><div class="clear"></div></div></div>';         
        }
        theHTML += '</div>';
        theHTML += '<div class="top_ftr">';
        theHTML += '<span class="prev"><a href="javascript:void(0);" onClick="vidSlide();return false;">< Previous</a></span>';
        theHTML += '<span id="tally" class="count">'+'      1 of '+ '     '+AOLVS.results+'   </span>'; 
        theHTML += '<span class="nxt"><a href="javascript:void(0);" onClick="vidSlide(1);return false;">Next ></a></span>';
        theHTML += '</div>';
    
        document.getElementById('video_results').innerHTML = theHTML;
        intializeSeq();
    }
}

function countChar(){
    if (this.desclength > this.descmax){
        this.desc = this.desc.substring(0, this.descmax)+'...';
    }else{
        this.desc = this.desc;
    }
    return this.desc;
}
 
function description(caption, descriptionmax){
    this.desc = caption;
    this.desclength = caption.length;
    this.descmax = descriptionmax;
    this.characherCount = countChar;
}
// End: Top Videos

//Election navigation
 var openList;
var openEle;	
function opennav( el ) {
	for ( var i = 0; i < el.childNodes.length; i++ ) {
	    if ( el.childNodes[i] && el.childNodes[i].className == 'optLst' )
	    {
	    	el.childNodes[i].style.display = 'block';
	    	openList = el; openEle = el.childNodes[i];
	    }
	}
}

function closenav( el ) {
	for ( var i = 0; i < el.childNodes.length; i++ ) {
	    if ( el.childNodes[i] && el.childNodes[i].className == 'optLst' )
	    {
	    	el.childNodes[i].style.display = 'none';
	    	if(openList || openEle){
	    		openList = null; openEle= null;
	    	}
	    }
	}
}
var tglStat = false;
	function toggleMenu(){
	if (!tglStat){
	opennav(arguments[0]);
	return tglStat = true;
	}else{
	closenav(arguments[0]);
	return tglStat =false;
	}
	}

var s_account="aolnews,aolsvc";


function rsiAdInit(segmax) {

    var segQS="";
    var segs_beg=document.cookie.indexOf('rsi_segs=');
    if(segs_beg>=0){
        segs_beg=document.cookie.indexOf('=',segs_beg)+1;
        if(segs_beg>0){
            var segs_end=document.cookie.indexOf(';',segs_beg);
            if(segs_end==-1)segs_end=document.cookie.length;
            rsi_segs=document.cookie.substring(segs_beg,segs_end).split('|');
            for (var i=0;i<Math.min(segmax,rsi_segs.length);i++){
                segQS+=rsi_segs[i].replace(/.*_(.*)/,"rsi=$1;");
            }
            adSetOthDclk(segQS);
       }
    }
}

/****
Project: light xmlhttp library
Author : Amit Rai
Version : 1
****/


function xL(url,requestType,isAsync,requestData){

    var _url="";
    var _requestType="";
    var _isAsync=true;
    var _initialized=false;
    var _xmlHttpObject=false;
    var _valueStr="";
    var _requestData=new Object();
    var _debugMode=false;
    var _responseHandler=function(obj){};
    var _errMsg = "";
        
    var debugMsg = function(msg)
    {
        if(_debugMode)
        {
            alert(msg);
        }
    }
    
    var trim = function(str)
    {
           return str.replace(/^s*|s*$/g,"");
    }
    
    var createRequestValueString = function ()
    {
        var str=new String();
        var aObject = _requestData;
        
        for(var key in aObject)
        str=str+"&"+key+"="+aObject[key];
        
        if(_requestType=="GET")
        str="?"+str;

        return encodeURI(str);
    }
            
    var createXmlHttpObject = function ()
    {
        
        if(window.XMLHttpRequest && !(window.ActiveXObject)) 
        {// FF , mozilla and safari 
            try 

            {

                req = new XMLHttpRequest();
            
            } 
            catch(e) 
            {
                req = false;
            }
        } 
        else if(window.ActiveXObject) 
        {// IE Windows ActiveX version
               try 
            {
                req = new ActiveXObject("Msxml2.XMLHTTP");
              } 
            catch(e) 
            {
                try 
                {
                      req = new ActiveXObject("Microsoft.XMLHTTP");
                } 
                catch(e) 
                {
                      req = false;
                }
            }
        }
        return req;
    }
    
    var init = function(url,requestType,isAsync,requestData)
    {
        
        if(url.length>11 && requestType.length>2)
        {
            _url=encodeURI(url);
            _requestType=requestType.toUpperCase();
            _initialized=true;
            _isAsync=isAsync;
            _xmlHttpObject = createXmlHttpObject();
            _requestData = requestData;
            _valueStr = createRequestValueString();
        } 
        else
        {
            debugMsg("Initialization data is not correct!");
        }
        
    }
    
    init(url,requestType,isAsync,requestData);
    
    var sendGetRequest = function()
    {
            if(_xmlHttpObject)
        {    
            _xmlHttpObject.onreadystatechange = function(){_responseHandler(_xmlHttpObject)};
            try
            {
                _xmlHttpObject.open(_requestType, _url+_valueStr, _isAsync);
                _xmlHttpObject.send(null);
            }
            catch(e)
            {
                _errMsg = e;
            }
        }
        return _errMsg;
    }
    
    var sendPostRequest = function()
    {
        if(_xmlHttpObject)
        {    
            _xmlHttpObject.onreadystatechange = function(){_responseHandler(_xmlHttpObject)};
            try
            {
                _xmlHttpObject.open(_requestType, _url, _isAsync);
                _xmlHttpObject.send(_valueStr);
            }
            catch(e)
            {
                _errMsg = e;
            }
        }
        return _errMsg;
    }
    
    var sendHeadRequest = function()
    {
        if(_xmlHttpObject)
        {
            _xmlHttpObject.onreadystatechange = function(){_responseHandler(_xmlHttpObject)};
        try
        {    
            _xmlHttpObject.open(_requestType, _url, _isAsync);
            _xmlHttpObject.send(null);
        }
        catch(e)
        {
            _errMsg = e;
        }
        }
        return _errMsg;
    }

    var alertAll = function()
    {
        if(_debugMode)
        {
            alert("_url = "+ _url + "n _requestType= " + _requestType + "n _isAsync= " + _isAsync);
            alert("_initialized " + _initialized + "n _xmlHttpObject " +_xmlHttpObject + "n _valueStr " +_valueStr);
        }
    }
    
    alertAll();
    
    return {
        
        abortRequest : function()
        {
            if(_xmlHttpObject.readyState!=4)
            {
                _xmlHttpObject.onreadystatechange = function (){};
                _xmlHttpObject.abort();
            }
        },
        
        getXmlHttpObject : function() {
            return createXmlHttpObject();
        },
        
        init : function(url,requestType,isAsync,requestData) {
            init(url,requestType,isAsync,requestData);
        },
        
        sendRequest : function() 
        {
            switch (_requestType)
            {
                case "GET":
                    sendGetRequest();
                    break;
                case "POST":
                    sendPostRequest();
                    break;
                case "HEAD":
                    sendHeadRequest();
                    break;
                default:
                    debugMsg(_requestType + " : request type not found");
            }
                        
            return _errMsg;
        },
        
        setResponseHandler : function(functionObj)
        {
            if((typeof functionObj)=="function"){
                _responseHandler = functionObj;
            }
        },
        
        setDebugMode : function(debug)
        {
            if(typeof(debug)=="boolean"){
                _debugMode=debug;    
            }
        }
            
    };//end return
} //end Xlib

/*Start:  JS code for the News Photogallery*/
//global news photogallery object loaded with default values,
//needs to be overridden on per module instance basis
var debugMode = false;    
var pgGlbObject = function() {
    this.pgTotalImages = 0;
    this.pgGalleryId = 0;
    this.glbPgTimer = 0;
    this.glbCurrentImg = 1;
    this.navAction = '';
    this.omnitureURL = 'omni_track';
    this.xmlUrl = 'common/photogallery/response.xml?&id=3&index=2&feedtype=news&navAction=next';
    this.feedType = 'news';
    this.gallerySize = '';
    this.adSpot = '';
    this.imgResize = 'No';
}

function appInit(modId){
    mI = window[modId];
    var queryParam = new Object();
    var requestParameters = new String();
    var today = new Date();
    
    updateTallyNumber(modId);
    queryParam['id'] = mI.pgGalleryId;
    queryParam['index'] = mI.glbCurrentImg;
    queryParam['feedtype'] = mI.feedType;
    queryParam['navAction'] = mI.navAction;
    queryParam['ts'] = today.getSeconds();
    queryParam['gallerySize'] = mI.gallerySize;
    queryParam['imgResize'] = mI.imgResize;
    url = mI.xmlUrl;

    reqType='GET';

    if(debugMode) {
        alert('id = '+mI.pgGalleryId + ' index= ' + mI.glbCurrentImg + ' feedtype= '+mI.feedType+' navAction= '+mI.navAction+' gallerySize= '+mI.gallerySize+' imgResize= '+mI.imgResize);
    }
    var objLap = new xL(url,reqType,true,queryParam);
                
    var serverErrorHandler = function(statusCode,statusMsg)
    {
        if(debugMode) {
            alert("Error Code : " + statusCode + " Message : " + statusMsg);
        }
    }
    
    var responseHandler = function(req) 
    {
        if(mI.glbPgTimer==0)
        {
            var timeOutErr = function() 
            {
                clearTimeout(mI.glbPgTimer);
                objLap.abortRequest();
            }
            mI.glbPgTimer = setTimeout(timeOutErr,5000);
        }
        // only if req shows "loaded"
        if (req.readyState == 4)
        {
            if (req.status == 200) 
            {
                resXML = req.responseXML;
                resTxt = req.responseText;
                uaStr = navigator.userAgent.toLowerCase();
               // Firefox has issue reading the xml returned from server
               if(uaStr.indexOf('firefox') != -1) {
                   if (document.implementation.createDocument && typeof(window.DOMParser) != "undefined") {
                       var parser = new DOMParser();
                       resXML = parser.parseFromString(resTxt, "text/xml");
                   }
               } 
                updateGallery(resXML,modId);
            } else {
                if(debugMode) {
                    alert("Error : "+req.getAllResponseHeaders());
                }
            }
        }
        //end main if else
    }       
    
    objLap.setResponseHandler(responseHandler);
    
    err=objLap.sendRequest();
    
    if(err.length>0 && debugMode==true)
    {
        alert(err);
    }
}

function updateGallery(resXML,modId) {
    var i = 0;
    var mod = "_" + modId;
    var mI = window[modId];

    //only if the proper data is returned 
    if(resXML.getElementsByTagName("img")[0]) {
	    //set the required values from xml fragment
            var pgCredit = getNodeValue(resXML.getElementsByTagName("pgcredits")[0]);
            var photoCaption = getNodeValue(resXML.getElementsByTagName("photocaption")[0]);
            var imgSrc = resXML.getElementsByTagName("img")[0].getAttribute('src');
            var imgAlt = resXML.getElementsByTagName("img")[0].getAttribute('alt');
			var imgWidth = resXML.getElementsByTagName("img")[0].getAttribute('photoWidth');
			var imgHeight = resXML.getElementsByTagName("img")[0].getAttribute('photoHeight');

            if(debugMode) {

                alert('pgCredit='+pgCredit+'photoCaption='+photoCaption+'imgSrc='+imgSrc);
            }
		
            //update the dom information
            var currImg = document.getElementById('photoImg'+ mod);
            var newImg = document.createElement('img');
            newImg.src = imgSrc;
            newImg.width = imgWidth;
            newImg.height = imgHeight;
            newImg.alt = imgAlt;
            currImg.parentNode.replaceChild(newImg,currImg);
            newImg.id = 'photoImg'+ mod;
            document.getElementById('photoCredit' + mod).innerHTML = pgCredit;
            document.getElementById('photoCap' + mod).innerHTML = photoCaption;
            document.getElementById('photoTally' + mod).innerHTML = mI.glbCurrentImg + " of " + mI.pgTotalImages;
            sendOmnitureData(resXML,modId);
            
            //ad refresh on image change
            galleryAdRefresh(mI.adSpot);
    }// end main if


}// end updateGallery

// Ad Refresh on Image Change
function galleryAdRefresh(adSpot) {
    try {
        if (adSpot != null && adSpot != 'undefined' && adSpot != '') {
            var spots = new Array();
			spots = adSpot.split(",");
			spots = spots.sort();
			for(var i = 0; i < spots.length; i++) {
				var spot = spots[i];
				adsReloadAd(spot);
			}
        }
    } catch(e) {}
    return true;
}

function updateTallyNumber(modId) {
    var mI = window[modId];
    if(mI.navAction == 'next') {
    
        if(mI.glbCurrentImg < mI.pgTotalImages) {
            ++mI.glbCurrentImg;
            mI.navAction = 'next';
        } else {
            mI.glbCurrentImg=1;
            mI.navAction = 'next';
        }
    
    } 

    if(mI.navAction == 'prev') {

        if(mI.glbCurrentImg > 1) {
             --mI.glbCurrentImg;
            mI.navAction = 'prev';
        }
        else 
        {
            mI.glbCurrentImg=mI.pgTotalImages;
            mI.navAction = 'prev';
        }

    }
} // end updateTallyNumber

function getNodeValue(node) {
    var val = "";

    if (node != undefined || node != null){ 
        if(node.nodeValue == null || node.nodeValue == undefined){
            try {
                val = node.firstChild.nodeValue;
        } catch (e){}
      }
  }

    return val;
}

 function sendOmnitureData(resXML,modId) {
	var today = new Date();
    var mI = window[modId];
    var omniUrl = mI.omnitureURL;
    var reqType= "GET";
    var qp = new Object();
    str = "?";
    qp['id'] = mI.pgGalleryId;
    qp['index'] = mI.glbCurrentImg;
    qp['feedtype'] = mI.feedType;
    qp['navAction'] = mI.navAction;
    qp['debug'] = 0;
	qp['ts'] = today.getSeconds();
	// To capture the mmx variable for omniture tracking for both h and g code
 if(typeof(s_channel) != 'undefined') {
     qp['mmx'] = s_channel;
    } else if(typeof(s_265.channel) != 'undefined'){
       qp['mmx'] = s_265.channel;
 } 
    if(document.getElementById('pgOmniIframe'+modId)) {
        ifr = document.getElementById('pgOmniIframe'+modId);
    } else {
        ifr = document.createElement('iframe');
        ifr.setAttribute('id','pgOmniIframe'+modId);
        ifr.width=0;
        ifr.height = 0;
        ifr.border = 0;
        ifr.style.visibility = 'hidden';
        document.body.appendChild(ifr);
    } 
  
    for(var key in qp)
        str=str+"&"+key+"="+qp[key];
    
    omniUrl = omniUrl + str;
    ifr.src = omniUrl;
}

function nextImg(modId) {
    mI = window[modId];
    mI.navAction = 'next';
    appInit(modId);
    return false;
}

function prevImg(modId) {
    mI = window[modId];
    mI.navAction = 'prev';
    appInit(modId);
    return false;
}
/*End:  JS code for the News Photogallery*/

// Start:  SHARE THIS WIDGET JS

var sharePopFlag = "";                             //variable for onclick popup
var cnt = 0;
var hover = "";

function showShareThisPop(liObj,objName)        //function to call the popup onclick
{
    hover = "false";
 var chk = document.getElementById(objName+'_div');
 var obj=document.getElementById(objName);
 document.getElementById('shrBlg').className='shrBlg';

 document.getElementById('shrBlg_div').className='displayNone';
 document.getElementById('shrBkMrk').className='shrBkMrk';
 document.getElementById('shrBkMrk_div').className='displayNone';
 document.getElementById('shrPrnt').className='shrPrnt';
 document.getElementById('shrEmail').className='shrEmail';
 document.getElementById('shrIm').className='shrIm';
 
 if(sharePopFlag != objName){
  sharePopFlag = objName;
  hover = objName;
  cnt = 0;
  if(objName=='shrPrnt' || objName=='shrEmail' || objName=='shrIm'){
     obj.className=objName;
  }else{
      obj.className=objName+"_active";
  }
  if( document.getElementById(objName+'_div')){
                if(chk.className == 'displayNone'){
           chk.className='displayBlock';
           }
     }
 }
 else{
  cnt = cnt+1;
  if(cnt == 2 ){
   if( document.getElementById(objName+'_div')){
       chk.className='displayBlock';
	   if(objName=='shrPrnt' || objName=='shrEmail' || objName=='shrIm'){
			obj.className=objName;
		}else{
			obj.className=objName+"_active";
		}
       cnt =0;
       }
     }
 }   
 
}

function classChng(obj,classChng){
	var objId = obj.id; 
	if(hover != objId){ 
		obj.className = classChng;
	}
}


function shareOperation(iOperation, strUrl, strTitle)
{
    var staf_obj = new staf_SE();
    staf_obj.setLang("en-US");
    if (strUrl != "")
    {
        staf_obj.setURL(strUrl);
    }
    if (strTitle != "")
    {
        staf_obj.setTitle(strTitle);        
    }
    if (iOperation == 1) // IM This
    {
        staf_obj.sendIM();
    }
    else
    {
        staf_obj.sendEmail();
    }
}

function mouseoverup()
{
    document.getElementById("thumbsup").className="thumbsup_on";
}
function mouseoutup()
{
    document.getElementById("thumbsup").className="thumbsup";
} 
function mouseoverdown()
{
    document.getElementById("thumbsdown").className="thumbsdown_on";
}
function mouseoutdown()
{
    document.getElementById("thumbsdown").className="thumbsdown";
}

// End: SHARE THIS WIDGET JS

//Cross Promo
var d=document; var w=window;var docHg;
var range=400;
var cod_arr=new Array();
var arrLen = 0;
var modSpan = 6;
var currId = 0;
var opt = {
	ae:function(o,et,fn){if(o.addEventListener)o.addEventListener(et,fn,false);else if(o.attachEvent)o.attachEvent("on"+et,fn);},
	gt:function(t,o){o=o?o:document;return o.getElementsByTagName(t)},
	gc:function(c,t,s,o){var r=new Array();var os=opt.gt(t,o);for(var i=0,j=0,l=os.length;i<l;i++){var sc = s + os[i].className + s;if(sc.indexOf(s+c+s)!=-1){r[j] = os[i];j++;}}return r;},
        nview:function(obj,i) {
                if (obj.loaded==null) {
                    obj.loaded=0;
                }
                if (obj.loaded==0) {

                    if(document.all) {
                        var relTop=obj.offsetParent.offsetTop-(w.scrollY||d.documentElement.scrollTop);
                    } else {
                        var relTop=obj.offsetTop-(w.scrollY||d.documentElement.scrollTop);
                    }

                    if((relTop-docHg-20)<range) {
                      var codUrl=opt.gt('a',obj)[0].href;
                      opt.xhr(codUrl,obj,i);
                    }
                }
        },
        doCod:function(){
                var l=cod_arr.length;
                for (var i=0;i<l;i++) {
                        opt.nview(cod_arr[i],i);
                }
        },
        xhr:function(u,obj,i){
                obj.loaded=1;
                var f,r,m='GET';
                f=function(){if(r.readyState>3)opt.update(obj,r,i);}
                r= window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");
                r.onreadystatechange=f;
                r.open(m,u,1);
                r.setRequestHeader('content-type','text/xml');
                r.send('');
        },
        update:function(obj,r,i) {
                if(r.status==200){
                        obj.innerHTML=r.responseText;
                } else {obj.loaded=0;}
        },
        init:function() {
                        cod_arr=opt.gc('cod','div','',document);
                        docHg=w.innerHeight||d.documentElement.offsetHeight;
                        opt.doCod();
                        opt.ae(window,'scroll',opt.doCod);
        },
        res:function(){
                docHg=w.innerHeight||d.documentElement.offsetHeight;
                opt.doCod();
        }

}
opt.ae(window,'resize',opt.res);
opt.ae(window,'load',opt.init);

function countCartridges() {
   var cartCount = 0;
   end = false;
   do {
      if(document.getElementById('cart'+cartCount)) {
         cartCount++;
      } else {
         end = true;
      }
   } while (end == false)
   arrLen = cartCount;
}

function showCartridges( startId ) {
  if(arrLen == 0) {
    countCartridges(); 
  }
  var i,j;
  for (i=0,j=startId; i < modSpan; i++,j++) {
     var strCart = j%arrLen;
     document.getElementById('cartridge'+i).innerHTML = document.getElementById('cart'+strCart).innerHTML;
  }
}

function isModFetched (modId) {
  if(document.getElementById('cart'+modId).innerHTML.length>0) {
      return true;
  } else {
      return false;
  }
}

function nextCartridge () {
  if(arrLen == 0) {
     countCartridges(); 
  }
  currId = currId + 1;
  if ( !isModFetched( (currId+modSpan)%arrLen ) ) {
      fetchModule((currId+modSpan)%arrLen);
  }
  showCartridges(currId);
}

function prevCartridge () {
  if(arrLen == 0) {
    countCartridges(); 
  }  
  if(currId!=0) {
      currId = currId - 1
  } else {
      currId=arrLen-1;
  }

  if ( !isModFetched( (currId+modSpan)%arrLen ) ) {
      fetchModule((currId+modSpan)%arrLen);
  }
  showCartridges(currId);
}
// Crosspromo end



function staf_SE() {

/*
 * 	 Author : STaF Team
 *
 */
	var omniture_tracking;

	// Email This variables
	var width, height;        // Width and Height of Email Popup
	var im_width, im_height;  // Width and Height of Email Popup
	var lang = "";            // Language parameter

	// IM Variables
	var message = "";        // IM Message
	var linkURL = "";        // Default URL is the current page.
	var pageTitle = "";      // Page Title
	var confirm = false;     // Confirmation pop-up window for non-AOL browsers

	// Launch IM
	var sendIM = function () {
		winl = (screen.width - im_width) / 2;
		wint = (screen.height - im_height) / 2;

		if (winl < 0) winl = 0;
		if (wint < 0) wint = 0;

		window.open("http://sendtoafriend.aol.com/im.adp?url=" + linkURL + "&title=" + pageTitle + "&lang=" + lang, "IM_Window", "height=" + im_height + ",width=" + im_width + ",top=" + wint + ",left=" + winl + ",statusbar=0,toolbar=0,menubar=0,location=0,resizable=0");
	}

	// Launch Email
	var sendEmail = function () {
		winl = (screen.width - width) / 2;
		wint = (screen.height - height) / 2;

		if (winl < 0) winl = 0;
		if (wint < 0) wint = 0;

		window.open("http://sendtoafriend.aol.com/?url=" + linkURL + "&title=" + pageTitle + "&lang=" + lang, "Email_Window", "height=" + height + ",width=" + width + ",top=" + wint + ",left=" + winl + ",statusbar=0,toolbar=0,menubar=0,location=0,resizable=0");
	}

	// Default Values
	var setDefault = function () {
		message = "Your friend wants you to check this out:";
		linkURL = escape(document.location);
		pageTitle = escape(document.title);
		confirm = false;
		width = 292;
		height = 500;
		im_width = 292;
		im_height = 150;
		lang = "en-US";
	}

	// Set default values.
	setDefault();

	return {

		sendIM: function () {

			if (omniture_tracking) {
				setOmniStaf("IM");
			}

			sendIM();
		},

		sendEmail: function () {

			if (omniture_tracking) {
				setOmniStaf("Email");
			}

			sendEmail();
		},

		setMessage: function (custom_message) {
			if (typeof(custom_message) == "string") {
				message = custom_message;
			}
		},

		setWidth: function (custom_width) {
			if (typeof(custom_width) == "number") {
				width = custom_width;
			}
		},

		setHeight: function (custom_height) {
			if (typeof(custom_height) == "number") {
				height = custom_height;
			}
		},

		setIMWidth: function (custom_width) {
			if (typeof(custom_width) == "number") {
				im_width = custom_width;
			}
		},

		setIMHeight: function (custom_height) {
			if (typeof(custom_height) == "number") {

				im_height = custom_height;
			}
		},

		setLang: function (custom_lang) {
			if (typeof(custom_lang) == "string") {
				lang = custom_lang;
			}
		},

		setTitle: function (custom_title) {
			if (typeof(custom_title) =="string") {
				pageTitle = escape(custom_title);
			}
		},

		setURL: function (custom_url) {
			if (typeof(custom_url) =="string") {
				linkURL = escape(custom_url);
			}
		}

	};

}
<!--
// Create and instantiate the class only if not already created:
try {
if(top.channels_refresher == null) {

	// channels_refresher constructor:
	 top.channels_refresher = function() {
	 	this.add_impression.domains = new Object();
		this.ads_list = new Array();
		var body = top.document.body;
		var inner_elem = body;
		while((inner_elem = inner_elem.lastChild).tagName.toLowerCase() != "script");
		var container_elem = inner_elem.parentNode;
		while(container_elem.tagName.toLowerCase() != "div" 
							&& container_elem.tagName.toLowerCase() != "body") {
			container_elem = inner_elem.parentNode;
		}
		this.container = container_elem;
	}
	
	top.channels_refresher.prototype = {
		/** 
		 * add_ad
		 * @param index - ZERO-BASED number indicating the declared order of the ad.
		 * @param id    - Magic Number of the ad
		 * @param w     - width of the ad in pixels
		 * @param h     - height of the ad in pixels
		 * @param s     - spot of the ad in string (e.g. 300x250_2)
		 *		  Special values: 0 (Default) - always refresh, -1 - do not refresh
		 */
		add_ad:function(id, w, h, index, s) {
			if(s == null) {
				s = 0;
			}
			if(index == null) {
				this.ads_list.push({id:id, width:w, height:h, spot:s});
			} else {
				this.ads_list[index] = {id:id, width:w, height:h, spot:s};
			}
		},
		
		// add_impression
		add_impression:function(url) {
			var domains = this.add_impression.domains;
			var make_sequential_name = function(name) {
				if(domains[name] == null) {
					domains[name] = true;
					return name;
				} else {
					var seq = 0;
					var _name = name + "_" + (++seq);
					while(domains[_name] != null) {
						_name = name + "_" + (++seq);
					}
					domains[_name] = true;
					return _name;
				}
			}
			if(url != null && url.length) {
				var frame_name = make_sequential_name("frame_" + new Date().getTime());
				var i_frame = top.document.createElement("iframe");
				i_frame.id = frame_name;
				i_frame.width = 1;
				i_frame.height = 1;
				i_frame.style.position = "absolute";
				i_frame.style.top = "-10px";
				i_frame.style.left = "-10px";
				i_frame.style.visibility = "hidden";
				i_frame.src = url;
				this.container.appendChild(i_frame);
				return frame_name;
			}
		},
		
		// add_url
		add_url:function(f_name, url) {
			//	If the target_frames object is null, create it:
			if(!this.target_frames) this.target_frames = new Object();
			//	If this frame name has not been used before, then...
			if(!this.target_frames[f_name]) {
				//	Create a new frame repository:
				this.target_frames[f_name] = new Object();
				//	Create a new list for frame urls:
				this.target_frames[f_name].urls = new Array();
				//	Create a default index of zero for this frame:
				this.target_frames[f_name].current_index = 0;
			}
			//	Add the url to the frame's url list:
			if(url && url.length) this.target_frames[f_name].urls.push(url);
		},
		
		// refresh_ads
		refresh_ads:function() {	
			var adsD = new Date();
			var adsScr1 = adsD.getTime() % 0x3fffffff;
			top.adsTile;
			for(var i = 0; i < this.ads_list.length; i++) {
				if(this.ads_list[i] != null) {
					try {
						top["adsF" + i].location.href = top.adsHt + "/html/" 
								+ this.ads_list[i].id + "/" + adsScr1 + "/" 
								+ top.adsExt + "?" + top.adsNMSG + "&width=" 
								+ this.ads_list[i].width + "&height=" 
								+ this.ads_list[i].height + "&target=" + top.adsTar 
								+ top.adsTz + top.adsScS + top.adsSr + top.adsSN 
								+ top.adsWM + top.adsOt + "&tile=" + top.adsTile + top.adsESN + top.adsRSIVal +"&CT=I";
					} catch(e) {}
				}
			}
		},
		
		// refresh_ad
		refresh_ad:function(index) {
			if(this.ads_list[index] != null) {

				var adsD = new Date();
				var adsScr1 = adsD.getTime() % 0x3fffffff;
				try {
					top["adsF" + index].location.href = top.adsHt + "/html/" 
							+ this.ads_list[index].id + "/" + adsScr1 + "/" 
							+ top.adsExt + "?" + top.adsNMSG + "&width=" 
							+ this.ads_list[index].width + "&height=" 
							+ this.ads_list[index].height + "&target=" + top.adsTar 
							+ top.adsTz + top.adsScS + top.adsSr + top.adsSN 
							+ top.adsWM + top.adsOt + "&tile=" + top.adsTile + top.adsESN + top.adsRSIVal +"&CT=I";
				} catch(e) {}
			}
		},
		
		// refresh_ads_string
		refresh_ads_string:function(str) {
			var ads = str.split(",");
			for(var i = 0; i < ads.length; i++) {
				var index = parseInt(ads[i]);
				if(!isNaN(index) && index >= 0 && index < this.ads_list.length) {
					this.refresh_ad(index);
				}
			}
		},
		
		// refresh_ads_by_spot
		refresh_ads_by_spot:function(str) {
			if (str == '-1') return;
			var spots = new Array();
			if (str == null || str == 'undefined' || str == '0') {
				for(var i = 0; i < this.ads_list.length; i++) {
					spots.push(this.ads_list[i].spot);
				}
			} else {
				spots = str.split(",");
			}
			spots = spots.sort();
			var oldVar = '';
			for(var i = 0; i < spots.length; i++) {
				var spot = spots[i];
				if (oldVar == spot) break;
				oldVar = spot;
				for(var j = 0; j < this.ads_list.length; j++) {
					if (spot == this.ads_list[j].spot) {
						this.refresh_ad(j);
						break;
					}
				}
			}
		},

		// refresh_all
		refresh_all:function() {
			//	Loop through the ads and refresh them:
			this.refresh_ads();
			//	If there are target_frames:
			this.refresh_frames();
		},
		
		// refresh_all
		refresh_frames:function() {
			if(this.target_frames) {
				for(var f in this.target_frames) {
					var frame = this.target_frames[f];
					var i_frame = top.document.getElementById(f);
					if(frame.urls.length) {
						var url = frame.urls[frame.current_index++];
						if(frame.current_index >= frame.urls.length) frame.current_index = 0;
						this.refresh_frame(f, url);	
					}
				}
			}
		},
		
		// refresh_frame
		refresh_frame:function(f_name, url) {
			if(url != null && url.length) {
				var elem = (top.frames[f_name] 
						|| top.document.getElementById(f_name).contentWindow 
						|| top.document.getElementById(f_name));
				try {
					if(elem.location) {
						if((url == elem.location.href) && elem.location.reload) {
							elem.location.reload(true);
						} else {
							elem.location.href = url;
						}
					} else {
						elem.src = url;
					}
					
				} catch(e) {}
			}
		}
	
	}
	
	// Instantiate the default refresher
	window.ch_refresher = new channels_refresher();
}
} catch(e) {}
//-->


var MP_JS_VERSION="$RCSfile: mp.js,v $ $Revision: 1.25 $ $Name: web_fe_mpp_cf0432-3 $";
function _mp(){
this.host="us.video.aol.com";
var _1=this.host;
var _2=document.location.href;
var _3=_2.indexOf("?");
if(_3>0){
_2=_2.substring(0,_3);
}
var _4=false;
var _5="";
var _6=new Array();
_6["video-browse-full"]={t:"video",w:748,h:541,page:"video.index.adp",embed:false,size:"browse-full",ar:"us_en_video_748x541_full"};
_6["video-browse-light"]={t:"video",w:748,h:541,page:"video.index.adp",embed:false,size:"browse-light",ar:"us_en_video_748x541_full"};
_6["video-browse"]={t:"video",w:748,h:541,page:"video.index.adp",embed:false,size:"browse",ar:"us_en_video_748x541_full"};
_6["video-full"]={t:"video",w:748,h:541,page:"video.full.adp",embed:false,size:"full",ar:"us_en_video_748x541_full"};
_6["audio-full"]={t:"audio",w:748,h:541,page:"audio.full.adp",embed:false,size:"full",ar:"us_en_audio_748x541_full"};
_6["video-mini"]={t:"video",w:325,h:348,page:"video.mini.adp",embed:false,size:"mini",ar:"us_en_video_176x163"};
_6["audio-mini"]={t:"audio",w:320,h:73,page:"audio.mini.adp",embed:false,size:"mini",ar:"us_en_audio_320x73"};
_6["video-oldmedium"]={t:"video",w:320,h:313,page:"widget.adp",embed:true,size:"1",ar:"us_en_video_320x313"};
_6["video-large"]={t:"video",w:320,h:313,page:"widget.adp",embed:true,size:"large",ar:"us_en_video_320x313"};
_6["video-small"]={t:"video",w:176,h:165,page:"widget.adp",embed:true,size:"small",ar:"us_en_video_176x163"};
_6["video-widescreen"]={t:"video",w:320,h:313,page:"widget.adp",embed:true,size:"widescreen",ar:"us_en_video_320x313"};
_6["video-superlarge"]={t:"video",w:748,h:541,page:"widget.adp",embed:true,size:"superlarge",ar:"us_en_video_176x163"};
_6["audio-large"]={t:"audio",w:320,h:73,page:"widget.adp",embed:true,size:"large",ar:"us_en_audio_320x73"};
_6["audio-small"]={t:"audio",w:176,h:33,page:"widget.adp",embed:true,size:"small",ar:"us_en_audio_176x33"};
_6["us_en_video_988x725_full_utility"]={t:"video",w:988,h:725,page:"player/launcher?ar=us_en_video_988x725_full_utility",embed:false,size:"na",ar:"us_en_video_988x725_full_utility"};
var _7=false;
var _8=null;
var _9="player/launcher?ar=";
var _a=new Object;
var _b=new Object;
var _c="";
var _d=null;
this.launcher=function(ar,_f,_10){
ar=ar.toLowerCase();
var idx=_f.indexOf(":");
var _12,_13;
if(idx>0){
_12=_f.substring(0,idx);
_13=_f.substring(idx+1);
var _14=_12+"="+escape(_13).replace(/%3A/g,":");
_14+=_getParams(_10,this.host);
var obj=_newWidget(ar);
if(obj!=null){
if(obj.fname!=null){
ar=obj.fname;
}
_6[ar]=obj;
_play(ar,_14);
}
}
};
this.play=function(_16,_17,_18,_19){
var idx=_17.indexOf(":");
var _1b,_1c;
if(idx>0){
_1b=_17.substring(0,idx);
_1c=_17.substring(idx+1);
var _1d=_1b+"="+escape(_1c);
_1d+=_getParams(_19,this.host);
_1d+="&lg=1";
if(_18&&_18.length){
var _1e=new Array("scroll1","scroll2","scroll3");
for(var i=0;i<_18.length;i++){
_1d+="&"+_1e[i]+"="+escape(_18[i]);
}
}
_play(_16,_1d);
}
};
this.playlist=function(_20,pls,_22,_23,_24){
if(_22==null||_22.length==0){
_22="wmv";
}
var idx=pls.indexOf(":");
if(idx>0){
pls=pls.substring(idx+1);
}
var url="pls="+pls+"&type="+_22;
if(_23){
url+="&start="+_23;
}
if(_24){
url+="&startid="+_24;
}
url+="&lg=2";
_play(_20,url);
};
this.register=function(_27){
_a[_27]=true;
var _28=_b[_27];
if(_28!=null){
for(var i=0;i<_28.length;i++){
try{
frames[_27].VGlobal.processEvent(_28[i]);
}
catch(E){
if(_4){
alert("mp.js:register - Exception calling VGlobal.processEvent for fname '"+_27+"', data element "+i+".nne:"+e);
}
}
}
_b[_27]=null;
}
};
this.broadcast=function(_2a,_2b){
if(_2a==null){
return;
}
if(_2b==null||_2b.length==0){
for(var n in _a){
if((_2a.eventSrc!=null)&&(_6[_2a.eventSrc]!=null)&&(_6[n]!=null)&&(_6[_2a.eventSrc].group==_6[n].group)){
_pubData(_2a,n);
}
}
}else{
_pubData(_2a,_2b);
}
};
this.forwardClickEvent=function(ar,_2e){
if(ar==null||ar.length==0||_2e==null){
return false;
}
try{
if(_6[ar].evtCallback){
_6[ar].evtCallback(ar,_2e);
}
}
catch(e){
if(_4){
alert("mp.js:forwardClickEvent - Exception calling evtCallback for ar '"+ar+"'.nne:"+e);
}
return false;
}
return true;
};
this.publishClick=function(ar,_30,_31){
if(ar==null||ar.length==0||_30==null||_30.length==0){
return false;
}
try{
frames[ar].TPM_Player.publishClickEvent(_30,_31);
}
catch(e){
if(_4){
alert("mp.js:publishClick - Exception calling TPM_Player.publishClickEvent for ar '"+ar+"'.nne:"+e);
}
return false;
}
return true;
};
function _newWidget(_32){
var _33=_32.split("_");
if(_33.length<4){
return;
}
var _34=_33[3].toLowerCase();
var _35=_34.indexOf("x");
if(_35<1){
return;
}
var w;
var h;
try{
w=_34.substring(0,_35);
h=_34.substring(_35+1);
if(parseInt(w)!=w-0){
return;
}
if(parseInt(h)!=h-0){
return;
}
}
catch(e){
if(_4){
alert("mp.js:_newWidget - Exception converting width and height to integers for widget '"+ar+"'.nne:"+e);
}
return;
}
var obj={};
obj.w=w;
obj.h=h;
obj.embed=_7;
obj.embedDivId=_8;
obj.page=_9+_32;
obj.ar=_32;
obj.evtCallback=_evtCallback;
obj.group=_d;
if(_d!=null&&_d.length>0){
obj.fname=_32+"-"+_d;
}else{
obj.fname=_32;
}
return obj;
}
function _getParams(_39,_3a){
_7=false;
_8=null;
_evtCallback=null;
_1=_3a;
_d=null;
var _3b="";
if(_39&&_39.length){
var idx,_3d,_3e;
var _3f=false;
for(var i=0;i<_39.length;i++){
idx=_39[i].indexOf(":");
if(idx<0){
continue;
}
_3d=_39[i].substring(0,idx);
_3e=_39[i].substring(idx+1);
if(_3d=="embed"){
_3f=true;
if(_3e=="true"){
_7=true;
}else{
_7=false;
}
}else{
if(_3d.toLowerCase()=="embeddivid"&&_3e.length!=0){

_3f=true;

_8=_3e;

}else{
if(_3d=="domain"&&_3e.length!=0){
_3f=true;
_1=_3e;
}else{
if(_3d=="autoplay"&&_3e.length==0){
_3f=true;
}else{
if(_3d.toLowerCase()=="evtcallback"&&_3e.length!=0){
_3f=true;
try{
_evtCallback=eval(_3e);
}
catch(e){
if(_4){
alert("mp.js:_getParams - Exception from eval("+_3e+") while processing 'evtCallback' param.nne:"+e);
}
}
}else{
if(_3d=="debug"&&_3e==1){
_4=true;
}else{
if(_3d=="pdomain"&&_3e.length!=0){
_3f=true;
_c=_3e;
}else{
if(_3d=="group"&&_3e.length!=0){
_d=_3e;
}
}
}
}
}
}
}
}
if(!_3f){
if(_3d.toLowerCase()=="srefid"){
_3b+="&"+_3d+"="+escape(_3e).replace(/%3A/g,":");
}else{
_3b+="&"+_3d+"="+escape(_3e);
}
}
_3f=false;
}
}
if(location.href.indexOf("mpdebug=1")>-1){
_3b+="&debug=1";
_4=true;
}else{
if(location.href.indexOf("mpdebug=2")>-1){
_3b+="&debug=2";
_4=true;
}
}
return _3b;
}
function _play(_41,_42){
_41=_41.toLowerCase();
_a[_41]=false;
var ua=navigator.userAgent.toLowerCase();
var w=null;
try{
w=_6[_41];
if(w==null){
return;
}
}
catch(e){
w=_6["video-full"];
}
if(_1=="us.video.aol.com"){
w.page=_9+w.ar;
}
var _45="?";
if(w.page.indexOf("?")>=0){
_45="&";
}
var url="http://"+_1+"/"+w.page+_45;
url+=_42;
var _47="width="+w.w+", height="+w.h+",status=yes,resizable=no";
if(_4){
_47+=",location=yes,scrollbars=yes";
}
if(w.embed){
if(w.t){
url+="&mediatype="+w.t;
}
if(w.size){
url+="&size="+w.size;
}
if(_42.indexOf("autoplay=")==-1){
url+="&autoplay=3";
}
if(_c.length==0){
url+="&pdomain="+document.domain;
}else{
url+="&pdomain="+_c;
}
url+="&referer="+escape(_2);
var af=null;
try{
af=window.frames[_41];
}
catch(e){
}
if(af){
af.location.href=url;
}else{
_embedPlayer(_41,url);
}
}else{
if(ua.indexOf("aol")!=-1){
try{
if(_5!=""){
_5.close();
}
}
catch(e){
}
}
url+="&referer="+escape(_2);
_5=window.open(url,"_aolvideo_",_47);
}
}
function _embedPlayer(_49,url){
_49=_49.toLowerCase();
if(url==null){
url="";
}
var w=null;
try{
w=_6[_49];
}
catch(e){
w=_6["video-large"];
}
var _4c=(_4)?"":" scrolling=no ";
var _4d=(_4)?"":"overflow:hidden;";
var _4e="<iframe id='"+_49+"' name='"+_49+"' width="+w.w+" height="+w.h+" marginwidth=0 marginheight=0 frameborder=0 "+_4c+" border=0 style='"+_4d+" position:relative; top:0px; left:0px;' src='"+url+"'></iframe>";
if(w.embedDivId&&w.embedDivId!=null&&w.embedDivId.length>0){
var _4f=document.getElementById(w.embedDivId);
if(_4f!=null){
_4f.innerHTML=_4e;
}
}else{
document.writeln(_4e);
}
}
function _pubData(_50,_51){
if(_50==null){
return;
}
var _52=_50.eventSrc;
if(_51!=_52){
if(_a[_51]){
try{
if(frames[_51]&&typeof (frames[_51].VGlobal)!="undefined"&&typeof (frames[_51].VGlobal.processEvent)!="undefined"){
frames[_51].VGlobal.processEvent(_50);
}
}
catch(E){
if(_4){
alert("mp.js:_pubData - Exception calling VGlobal.processEvent for fname '"+_51+"'.nne:"+e);
}
}
}else{
_50.bufferSrc=_51;
if(_b[_51]==null){
var _53=new Array();
_53[0]=_50;
_b[_51]=_53;
}else{
var _53=_b[_51];
if(_53.length==10){
_53=new Array();
}
_53[_53.length]=_50;
_b[_51]=_53;
}
}
}
}
}
var mp=new _mp();

function createCookie(name, value, days)
{
	if (days){
	  var date = new Date();
	  date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
	  var expires = "; expires=" + date.toGMTString();
	}
	else{
		var expires = "";
		}

	document.cookie = name + "=" + value + expires + "; path=/";
}

function readCookie(name)

{
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++){
		var c = ca[i];
		while (c.charAt(0) == ' ')
		c = c.substring(1, c.length);
		if (c.indexOf(nameEQ) == 0)
			return c.substring(nameEQ.length, c.length);
		}
		return null;
}

// Font Resize 
var mediumText="mediumText";
var largeText="largeText";
var smallText="smallText";
function switchFont(type, obj)
{
   if (type == 1) {
      document.getElementById("spanSm").innerHTML = "A";
      document.getElementById("spanMd").innerHTML = '<a href="javascript:void(0);" onclick="switchFont(2,mediumText);" rel="mediumText" id="textMedium" class="fontswitch" title="medium font">A</a>';
      document.getElementById("spanLg").innerHTML = '<a href="javascript:void(0);" onclick="switchFont(3,largeText);" rel="largeText" id="textLarge" class="fontswitch" title="large font">A</a>';
   } else if (type == 2) {
      document.getElementById("spanSm").innerHTML = '<a href="javascript:void(0);" onclick="switchFont(1,smallText);" rel="smallText" id="textSmall" class="fontswitch" title="small font">A</a>';
      document.getElementById("spanMd").innerHTML = "A";
      document.getElementById("spanLg").innerHTML = '<a href="javascript:void(0);" onclick="switchFont(3,largeText);" rel="largeText" id="textLarge" class="fontswitch" title="large font">A</a>';
   } else if (type == 3) {
      document.getElementById("spanSm").innerHTML = '<a href="javascript:void(0);" onclick="switchFont(1,smallText);" rel="smallText" id="textSmall" class="fontswitch" title="small font">A</a>';
      document.getElementById("spanMd").innerHTML = '<a href="javascript:void(0);" onclick="switchFont(2,mediumText);" rel="mediumText" id="textMedium" class="fontswitch" title="medium font">A</a>';
      document.getElementById("spanLg").innerHTML = "A";
   }
   // var object = obj.getAttribute("rel");
   var i = 0;
   var articleStr; 
	document.getElementById("articleHdln").className = obj;
	var flag = true;
	while (flag) {
	   try {
	       articleStr = "articleTxt" + i;
	       i++;
	       document.getElementById(articleStr).className = "articleTxt " +obj;
	   } catch (e) {
			flag = false;	   
	   }
	}
    return false;
}

//Light Box Gallery begins
// THIS DOES THE AJAX REQUEST 
function AJAXmakeReq(url, callbackFN, outputHere) {
   var ajax_req;

   if (window.XMLHttpRequest) { // Mozilla, Safari,...
     ajax_req = new XMLHttpRequest();
     if (ajax_req.overrideMimeType) {
       ajax_req.overrideMimeType('text/xml');
     }
   } else if (window.ActiveXObject) { // IE
     try {
       ajax_req = new ActiveXObject("Msxml2.XMLHTTP");
     } catch (e) {
       try {
       ajax_req = new ActiveXObject("Microsoft.XMLHTTP");
       } catch (e) {}
     }
   }
   if (typeof(ajax_req) == "undefined" ) {
     alert('Giving up. Cannot create an XMLHTTP instance');
     return false;
   }
   ajax_req.onreadystatechange = outputReq;
   ajax_req.open('GET', url, true);
   ajax_req.send(null);

   function outputReq() {
     try {
       if (ajax_req.readyState == 4) {
         if (ajax_req.status == 200) {
           var response = ajax_req;
  if (typeof(outputHere) != "undefined" && outputHere != "" )
           callbackFN(response,outputHere);     else
  callbackFN(response); 
         } else {
           alert('There was a problem with the request.');
         }
       }
     }
     catch( e ) {
       alert('Caught Exception: ' + e.description);
     }
   }
}

var LB_callback = function(response, outputHere){
 var responsetxt = response.responseText;
      var outputDiv = document.getElementById(outputHere);
      outputDiv.innerHTML = responsetxt;
      lbg.getObjHeight('lbgActive_'+lbgModID);
}
// time stamp to prevent caching
var date = new Date();
var ts = date.getTime();
// light box gallery 
var lbgMn = "";
var lbgModID = "";
var lbgGalID ="";
var lbgGalType ="";
var lbgGalSlot ="";
var lbgGalTemplate ="";
var lbgobjO = "";
var lbgOrder = "";
var lbgPara = "";
var lbgArticleId = "";
var articleNum = "";
var paragraphNum = "";
var orderNum = "";
var objBody = document.getElementsByTagName("BODY").item(0);
var is_IE = navigator.userAgent.indexOf('MSIE') != -1;

var lbg = {

	open: function(articleNum,paragraphNum,orderNum,modID,mn,galID,galType,template,slot) {
		var d = document;
		articleNum = articleNum;
		paragraphNum = paragraphNum;
		orderNum = orderNum;
		lbgMn = mn;
		lbgModID = modID;
		lbgGalID = galID;
		lbgGalType = galType;
		lbgGalTemplate = template;
		lbgGalSlot = slot;
		lbgPara=window['mod_'+lbgModID+'paragraph'];
		lbgOrder=window['mod_'+lbgModID+'order'];
		lbgArticleId = window['mod_'+lbgModID+'articleId'];
		
		var objBody = d.getElementsByTagName("BODY").item(0);
		if (d.getElementById('lbgOverlay_'+modID)) { // page overlay layer		
			var objOverlay = d.getElementById('lbgOverlay_'+modID);
			objOverlay.onclick = function() { lbg.close(); }
	    }
	    
		var objLBGChild = d.getElementById("lbgChild_"+modID);
		
		objBody.className = "lbgOn";

		hideSelectBoxes();
		hideFlash();

		// stretch overlay to fill page and fade in
		var arrayPageSize = getPageSize();
		var arrayPageScroll = getPageScroll();
		// calculate top and left offset for the lbgChild 
		var lbgChildTop = arrayPageScroll[1] + (arrayPageSize[3] / 10);
		
		if ((arrayPageSize[2] - 988) > 0 ) {
			var lbgChildLeft = ((arrayPageSize[2] - 988) / 2);
		} else {
			var lbgChildLeft = 0;
		}
		
		var offsetLeft = d.body.offsetLeft;

		// browsers treat margin on BODY differently 
		// this code is based on a 980 wide body
		
		objOverlay.style.width= arrayPageSize[0]+"px";
		objOverlay.style.height= arrayPageSize[1]+"px";
		objLBGChild.style.left= "0px";
		
		if ((offsetLeft == 0) && (arrayPageSize[0] > 980)) {  // FF 
			var negativPos = ((arrayPageSize[2] - 980)/ 2);
			objOverlay.style.left= "-"+negativPos+"px";
			
		} else {  // Safari and IE
			if (arrayPageSize[2] > 980) {
				var negativPos = ((arrayPageSize[2] - 980)/ 2);                        
			} else {
				var negativPos = 0;
            }
			objOverlay.style.width= arrayPageSize[2]+"px";
			objOverlay.style.left= "-"+negativPos+"px";
		}

		function detectMacXFF() {
		    var userAgent = navigator.userAgent.toLowerCase();
		    if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
			  return true;
		    }
		}

		objLBGChild.style.top= lbgChildTop+"px";
		
		// ajax call 
		var modReqURL = "/article/lbg-pop.jsp?articleNum="+articleNum+"&paragraph="+paragraphNum+"&order="+orderNum+"&galID="+galID+"&galType="+lbgGalType+"&galTemplate="+lbgGalTemplate+"&galSlot="+lbgGalSlot+"&lbgIndex=1&articleId="+lbgArticleId+"&para="+lbgPara+"&order="+lbgOrder;
        AJAXmakeReq(modReqURL,LB_callback,"lbgL_"+modID);
		
		var d = detectMacXFF();
		if (d) {
			//osx ff css opacity + flash wmode transparent doesn't work
			objOverlay.style.backgroundImage= "url(http://www.aolcdn.com/aol/lbg-overlay.png)";
			objOverlay.style.backgroundRepeat="repeat";
			objOverlay.style.display = 'block';
			lbg.fadeInit('lbgOverlay_'+modID,1);
		} else {
			objOverlay.style.backgroundColor='#fff';
			objOverlay.style.display = 'block';
        	lbg.fadeInit('lbgOverlay_'+modID,0.40);
		}
		
		// Clearing ads on parent page
		if (adsDivs.length > -1) {
			for (i = 0; i < adsDivs.length; i++) {
				adsClrAd(adsDivs[i]);
			}
		}

		lbg.omniture(1,'next',galType);
	},
	
	navigate: function(articleNum, paragraphNum, orderNum, currentPhotoNum,nav,navA,galID,galType,template,slot) {
		lbgGalID = galID;
		lbgGalType = galType;
		lbgGalTemplate = template;
		lbgGalSlot = slot;
		date = new Date();
		ts = date.getTime();
		
		var modReqURL = "/article/lbg-pop.jsp?articleNum="+articleNum+"&paragraph="+paragraphNum+"&order="+orderNum+"&currentPhotoNum="+currentPhotoNum+"&galID="+lbgGalID+"&galType="+lbgGalType+"&galTemplate="+lbgGalTemplate+"&galSlot="+lbgGalSlot+"&lbgIndex="+nav+"&articleId="+lbgArticleId+"&para="+lbgPara+"&order="+lbgOrder;
		AJAXmakeReq(modReqURL,LB_callback,"lbgL_"+lbgModID);
        lbg.adCall();
		lbg.omniture(nav,navA,galType);
	},

	omniture: function(ind,nav,galType) {

	    var d = document;
		var l = d.location.toString();
		var g='', c='';
		
		g = 'id='+lbgGalID;
		ind++;
		var index = '&index='+ind;
		var navA = "&navAction="+nav;

		if ((window['mod_'+lbgModID+'s_channel']) != '') {
			var c = (window['mod_'+lbgModID+'s_channel']);
			c = '&mmx='+c;
		}

		l = l.replace('http://','');
		l = l.substr(0, l.indexOf('/'));
		l = 'http://' + l + '/ajax/photogallery/omniture.jsp?&';
		l = l + g + index;
		l = l + '&feedtype='+galType;
		l = l + navA;
		l = l + '&debug=0';
		l = l + c;
		l = l + '&ts='+ts;

		var ifr = "";
		if(d.getElementById('lbgOmniIframe'+lbgModID)) {
			 ifr = d.getElementById('lbgOmniIframe'+lbgModID);
		} else {
			 ifr = d.createElement('iframe');
			 ifr.setAttribute('id','lbgOmniIframe'+lbgModID);
			 ifr.width=0;
			 ifr.height = 0;

			 ifr.border = 0;

			 ifr.style.visibility = 'hidden';
			 var objLBGChild = d.getElementById("lbgChild_"+lbgModID);
			objLBGChild.appendChild(ifr);
		} 
		ifr.src = l;
	},

	close: function() {
		var d = document;
		var objBody= d.getElementsByTagName("BODY").item(0);
		var objOverlay = d.getElementById('lbgOverlay_'+lbgModID);
		var objLBGChild = d.getElementById('lbgChild_'+lbgModID);
		var lbgIframeAd = d.getElementById("lbgIframe_"+lbgModID);
		objOverlay.style.display = 'none';
		objLBGChild.style.visibility = 'hidden';
		objLBGChild.style.left= "-2000px";
		objBody.className = "lbgOff";
		
		showSelectBoxes();
		showFlash();
		// make new ad calls to the ads on the parent page
		adsReloadAll();
		
		lbgIframeAd.src = "";
		lbgModID = "";
		lbgGalID = "";

	},

	getObjHeight: function(obj) {
		var boxHeight = document.getElementById(obj).offsetHeight;
		lbg.setShadowHeight(boxHeight);
	},

	setShadowHeight: function(objHeight) {
		var lbgDSLt = document.getElementById("lbgDSLtL_"+lbgModID);
		var lbgDSRt = document.getElementById("lbgDSRt_"+lbgModID);

		lbgDSLt.style.height= objHeight+"px";
		lbgDSRt.style.height= objHeight+"px";
	},
	
	fadeInit: function(obj,opLvl) {
		lbgobjO = document.getElementById(obj);
		lbgobjO.xOpacity = 0;
		lbg.setOpacity(lbgobjO);
		lbgobjO.style.display = "block";
		setTimeout(function(){lbg.fade(lbgobjO,opLvl)},1);
	},

	fade: function(objO,opLvl) {
		var d = document;
		cOpacity = objO.xOpacity;
		nOpacity = objO.xOpacity;
		nOpacity+=.25; //how much increase per cycle
		objO.xOpacity = nOpacity;
	
		lbg.setOpacity(objO);
	
		if((objO.id == "lbgChild_"+lbgModID) && (cOpacity>=opLvl)) {
			lbg.adCall();
		} else if(cOpacity<=opLvl) { 
			setTimeout(function(){lbg.fade(objO,opLvl)},1);
		} else if ((objO.id != "lbgChild_"+lbgModID) && !is_IE) {
			var objLBGChild = d.getElementById("lbgChild_"+lbgModID);
			objLBGChild.style.visibility = 'visible';
			lbg.fadeInit("lbgChild_"+lbgModID,1);
		} else if ((objO.id != "lbgChild_"+lbgModID) && is_IE) {
			var objLBGChild = d.getElementById("lbgChild_"+lbgModID);
			objLBGChild.style.visibility = 'visible';
			objLBGChild.style.display = 'block';
			lbg.adCall();
		} 
	},
	
	setOpacity: function(objO) {	  
		objO.style.opacity = objO.xOpacity;
		objO.style.MozOpacity = objO.xOpacity;
		objO.style.filter = "alpha(opacity=" + (objO.xOpacity*100) + ")";
	},
	
	adCall: function() {
		var lbgIframeAd = d.getElementById("lbgIframe_"+lbgModID);
		var adURL = "/common/photogallery/ad_page.html?debug=0&magicnumber="+lbgMn+"&ts="+ts;
		lbgIframeAd.src = adURL;
	}
}
function showSelectBoxes(){
	var selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "visible";
	}
}
function hideSelectBoxes(){
	var selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "hidden";
	}
}
function showFlash(){
	var flashObjects = document.getElementsByTagName("object");
	for (i = 0; i < flashObjects.length; i++) {
		flashObjects[i].style.visibility = "visible";
	}
	var flashEmbeds = document.getElementsByTagName("embed");
	for (i = 0; i < flashEmbeds.length; i++) {
		flashEmbeds[i].style.visibility = "visible";
	}
}
function hideFlash(){
	var flashObjects = document.getElementsByTagName("object");
	for (i = 0; i < flashObjects.length; i++) {
		flashObjects[i].style.visibility = "hidden";
	}
	var flashEmbeds = document.getElementsByTagName("embed");
	for (i = 0; i < flashEmbeds.length; i++) {
		flashEmbeds[i].style.visibility = "hidden";
	}
}

// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.com
function getPageScroll(){
	var d = document;
	var xScroll, yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (d.documentElement && d.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = d.documentElement.scrollTop;
		xScroll = d.documentElement.scrollLeft;
	} else if (d.body) {// all other Explorers
		yScroll = d.body.scrollTop;

		xScroll = d.body.scrollLeft;	
	}

	arrayPageScroll = new Array(xScroll,yScroll) 
	return arrayPageScroll;
}

function getPageSize(){
	var d = document;
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (d.body.scrollHeight > d.body.offsetHeight){ // all but Explorer Mac
		xScroll = d.body.scrollWidth;
		yScroll = d.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = d.body.offsetWidth;
		yScroll = d.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;

	if (self.innerHeight) {	// all except Explorer
		if(d.documentElement.clientWidth){
			windowWidth = d.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (d.documentElement && d.documentElement.clientHeight) { 
		windowWidth = d.documentElement.clientWidth;
		windowHeight = d.documentElement.clientHeight;
	} else if (d.body) { // other Explorers
		windowWidth = d.body.clientWidth;
		windowHeight = d.body.clientHeight;
	}	
	
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
// End Light Box Gallery


function staf_SE() {

/*
 * 	 Author : STaF Team
 *
 */


	var omniture_tracking;

	// Email This variables
	var width, height;        // Width and Height of Email Popup
	var im_width, im_height;  // Width and Height of Email Popup
	var lang = "";            // Language parameter

	// IM Variables
	var message = "";        // IM Message
	var linkURL = "";        // Default URL is the current page.
	var pageTitle = "";      // Page Title
	var confirm = false;     // Confirmation pop-up window for non-AOL browsers

	// Launch IM
	var sendIM = function () {
		winl = (screen.width - im_width) / 2;
		wint = (screen.height - im_height) / 2;

		if (winl < 0) winl = 0;
		if (wint < 0) wint = 0;

		window.open("http://sendtoafriend.aol.com/im.adp?url=" + linkURL + "&title=" + pageTitle + "&lang=" + lang, "IM_Window", "height=" + im_height + ",width=" + im_width + ",top=" + wint + ",left=" + winl + ",statusbar=0,toolbar=0,menubar=0,location=0,resizable=0");
	}

	// Launch Email
	var sendEmail = function () {
		winl = (screen.width - width) / 2;
		wint = (screen.height - height) / 2;

		if (winl < 0) winl = 0;
		if (wint < 0) wint = 0;

		window.open("http://sendtoafriend.aol.com/?url=" + linkURL + "&title=" + pageTitle + "&lang=" + lang, "Email_Window", "height=" + height + ",width=" + width + ",top=" + wint + ",left=" + winl + ",statusbar=0,toolbar=0,menubar=0,location=0,resizable=0");
	}

	// Default Values
	var setDefault = function () {
		message = "Your friend wants you to check this out:";
		linkURL = escape(document.location);
		pageTitle = escape(document.title);
		confirm = false;
		width = 292;
		height = 500;
		im_width = 292;
		im_height = 150;
		lang = "en-US";
	}

	// Set default values.
	setDefault();

	return {

		sendIM: function () {

			if (omniture_tracking) {
				setOmniStaf("IM");
			}

			sendIM();
		},

		sendEmail: function () {

			if (omniture_tracking) {
				setOmniStaf("Email");
			}

			sendEmail();
		},

		setMessage: function (custom_message) {
			if (typeof(custom_message) == "string") {
				message = custom_message;
			}
		},

		setWidth: function (custom_width) {
			if (typeof(custom_width) == "number") {
				width = custom_width;
			}
		},

		setHeight: function (custom_height) {
			if (typeof(custom_height) == "number") {
				height = custom_height;
			}
		},

		setIMWidth: function (custom_width) {
			if (typeof(custom_width) == "number") {
				im_width = custom_width;
			}
		},

		setIMHeight: function (custom_height) {
			if (typeof(custom_height) == "number") {
				im_height = custom_height;
			}
		},

		setLang: function (custom_lang) {

			if (typeof(custom_lang) == "string") {
				lang = custom_lang;
			}
		},

		setTitle: function (custom_title) {
			if (typeof(custom_title) =="string") {
				pageTitle = escape(custom_title);
			}
		},

		setURL: function (custom_url) {
			if (typeof(custom_url) =="string") {
				linkURL = escape(custom_url);
			}
		}

	};

}
<!--
// Create and instantiate the class only if not already created:
try {
if(top.channels_refresher == null) {

	// channels_refresher constructor:
	 top.channels_refresher = function() {
	 	this.add_impression.domains = new Object();
		this.ads_list = new Array();
		var body = top.document.body;
		var inner_elem = body;
		while((inner_elem = inner_elem.lastChild).tagName.toLowerCase() != "script");
		var container_elem = inner_elem.parentNode;
		while(container_elem.tagName.toLowerCase() != "div" 
							&& container_elem.tagName.toLowerCase() != "body") {
			container_elem = inner_elem.parentNode;
		}
		this.container = container_elem;
	}
	
	top.channels_refresher.prototype = {
		/** 
		 * add_ad
		 * @param index - ZERO-BASED number indicating the declared order of the ad.
		 * @param id    - Magic Number of the ad
		 * @param w     - width of the ad in pixels
		 * @param h     - height of the ad in pixels
		 * @param s     - spot of the ad in string (e.g. 300x250_2)
		 *		  Special values: 0 (Default) - always refresh, -1 - do not refresh
		 */
		add_ad:function(id, w, h, index, s) {
			if(s == null) {
				s = 0;
			}
			if(index == null) {
				this.ads_list.push({id:id, width:w, height:h, spot:s});
			} else {
				this.ads_list[index] = {id:id, width:w, height:h, spot:s};
			}
		},
		
		// add_impression
		add_impression:function(url) {
			var domains = this.add_impression.domains;
			var make_sequential_name = function(name) {
				if(domains[name] == null) {
					domains[name] = true;
					return name;
				} else {
					var seq = 0;
					var _name = name + "_" + (++seq);
					while(domains[_name] != null) {
						_name = name + "_" + (++seq);
					}
					domains[_name] = true;
					return _name;
				}
			}
			if(url != null && url.length) {
				var frame_name = make_sequential_name("frame_" + new Date().getTime());
				var i_frame = top.document.createElement("iframe");
				i_frame.id = frame_name;
				i_frame.width = 1;
				i_frame.height = 1;
				i_frame.style.position = "absolute";
				i_frame.style.top = "-10px";
				i_frame.style.left = "-10px";
				i_frame.style.visibility = "hidden";
				i_frame.src = url;
				this.container.appendChild(i_frame);
				return frame_name;
			}
		},
		
		// add_url
		add_url:function(f_name, url) {
			//	If the target_frames object is null, create it:
			if(!this.target_frames) this.target_frames = new Object();
			//	If this frame name has not been used before, then...
			if(!this.target_frames[f_name]) {
				//	Create a new frame repository:
				this.target_frames[f_name] = new Object();
				//	Create a new list for frame urls:
				this.target_frames[f_name].urls = new Array();
				//	Create a default index of zero for this frame:
				this.target_frames[f_name].current_index = 0;
			}
			//	Add the url to the frame's url list:
			if(url && url.length) this.target_frames[f_name].urls.push(url);
		},
		
		// refresh_ads
		refresh_ads:function() {	
			var adsD = new Date();
			var adsScr1 = adsD.getTime() % 0x3fffffff;
			top.adsTile;
			for(var i = 0; i < this.ads_list.length; i++) {
				if(this.ads_list[i] != null) {
					try {
						top["adsF" + i].location.href = top.adsHt + "/html/" 
								+ this.ads_list[i].id + "/" + adsScr1 + "/" 
								+ top.adsExt + "?" + top.adsNMSG + "&width=" 
								+ this.ads_list[i].width + "&height=" 
								+ this.ads_list[i].height + "&target=" + top.adsTar 
								+ top.adsTz + top.adsScS + top.adsSr + top.adsSN 
								+ top.adsWM + top.adsOt + "&tile=" + top.adsTile + top.adsESN + top.adsRSIVal +"&CT=I";
					} catch(e) {}
				}
			}
		},
		
		// refresh_ad
		refresh_ad:function(index) {
			if(this.ads_list[index] != null) {
				var adsD = new Date();
				var adsScr1 = adsD.getTime() % 0x3fffffff;

				try {

					top["adsF" + index].location.href = top.adsHt + "/html/" 
							+ this.ads_list[index].id + "/" + adsScr1 + "/" 
							+ top.adsExt + "?" + top.adsNMSG + "&width=" 
							+ this.ads_list[index].width + "&height=" 
							+ this.ads_list[index].height + "&target=" + top.adsTar 
							+ top.adsTz + top.adsScS + top.adsSr + top.adsSN 
							+ top.adsWM + top.adsOt + "&tile=" + top.adsTile + top.adsESN + top.adsRSIVal +"&CT=I";
				} catch(e) {}
			}
		},
		
		// refresh_ads_string
		refresh_ads_string:function(str) {
			var ads = str.split(",");
			for(var i = 0; i < ads.length; i++) {
				var index = parseInt(ads[i]);
				if(!isNaN(index) && index >= 0 && index < this.ads_list.length) {
					this.refresh_ad(index);
				}
			}
		},
		
		// refresh_ads_by_spot
		refresh_ads_by_spot:function(str) {
			if (str == '-1') return;
			var spots = new Array();
			if (str == null || str == 'undefined' || str == '0') {
				for(var i = 0; i < this.ads_list.length; i++) {
					spots.push(this.ads_list[i].spot);
				}
			} else {
				spots = str.split(",");
			}
			spots = spots.sort();
			var oldVar = '';
			for(var i = 0; i < spots.length; i++) {
				var spot = spots[i];
				if (oldVar == spot) break;
				oldVar = spot;
				for(var j = 0; j < this.ads_list.length; j++) {
					if (spot == this.ads_list[j].spot) {
						this.refresh_ad(j);
						break;
					}
				}
			}
		},

		// refresh_all
		refresh_all:function() {
			//	Loop through the ads and refresh them:
			this.refresh_ads();
			//	If there are target_frames:
			this.refresh_frames();
		},
		
		// refresh_all
		refresh_frames:function() {
			if(this.target_frames) {
				for(var f in this.target_frames) {
					var frame = this.target_frames[f];
					var i_frame = top.document.getElementById(f);
					if(frame.urls.length) {
						var url = frame.urls[frame.current_index++];
						if(frame.current_index >= frame.urls.length) frame.current_index = 0;
						this.refresh_frame(f, url);	
					}
				}
			}
		},
		
		// refresh_frame
		refresh_frame:function(f_name, url) {
			if(url != null && url.length) {
				var elem = (top.frames[f_name] 
						|| top.document.getElementById(f_name).contentWindow 
						|| top.document.getElementById(f_name));
				try {
					if(elem.location) {
						if((url == elem.location.href) && elem.location.reload) {
							elem.location.reload(true);
						} else {
							elem.location.href = url;
						}
					} else {
						elem.src = url;
					}
					
				} catch(e) {}
			}
		}
	
	}
	
	// Instantiate the default refresher
	window.ch_refresher = new channels_refresher();
}
} catch(e) {}
//-->


var MP_JS_VERSION="$RCSfile: mp.js,v $ $Revision: 1.25 $ $Name: web_fe_mpp_cf0432-3 $";
function _mp(){
this.host="us.video.aol.com";
var _1=this.host;
var _2=document.location.href;
var _3=_2.indexOf("?");
if(_3>0){
_2=_2.substring(0,_3);
}
var _4=false;
var _5="";
var _6=new Array();
_6["video-browse-full"]={t:"video",w:748,h:541,page:"video.index.adp",embed:false,size:"browse-full",ar:"us_en_video_748x541_full"};
_6["video-browse-light"]={t:"video",w:748,h:541,page:"video.index.adp",embed:false,size:"browse-light",ar:"us_en_video_748x541_full"};
_6["video-browse"]={t:"video",w:748,h:541,page:"video.index.adp",embed:false,size:"browse",ar:"us_en_video_748x541_full"};
_6["video-full"]={t:"video",w:748,h:541,page:"video.full.adp",embed:false,size:"full",ar:"us_en_video_748x541_full"};
_6["audio-full"]={t:"audio",w:748,h:541,page:"audio.full.adp",embed:false,size:"full",ar:"us_en_audio_748x541_full"};
_6["video-mini"]={t:"video",w:325,h:348,page:"video.mini.adp",embed:false,size:"mini",ar:"us_en_video_176x163"};
_6["audio-mini"]={t:"audio",w:320,h:73,page:"audio.mini.adp",embed:false,size:"mini",ar:"us_en_audio_320x73"};
_6["video-oldmedium"]={t:"video",w:320,h:313,page:"widget.adp",embed:true,size:"1",ar:"us_en_video_320x313"};
_6["video-large"]={t:"video",w:320,h:313,page:"widget.adp",embed:true,size:"large",ar:"us_en_video_320x313"};
_6["video-small"]={t:"video",w:176,h:165,page:"widget.adp",embed:true,size:"small",ar:"us_en_video_176x163"};

_6["video-widescreen"]={t:"video",w:320,h:313,page:"widget.adp",embed:true,size:"widescreen",ar:"us_en_video_320x313"};

_6["video-superlarge"]={t:"video",w:748,h:541,page:"widget.adp",embed:true,size:"superlarge",ar:"us_en_video_176x163"};
_6["audio-large"]={t:"audio",w:320,h:73,page:"widget.adp",embed:true,size:"large",ar:"us_en_audio_320x73"};
_6["audio-small"]={t:"audio",w:176,h:33,page:"widget.adp",embed:true,size:"small",ar:"us_en_audio_176x33"};
_6["us_en_video_988x725_full_utility"]={t:"video",w:988,h:725,page:"player/launcher?ar=us_en_video_988x725_full_utility",embed:false,size:"na",ar:"us_en_video_988x725_full_utility"};
var _7=false;
var _8=null;
var _9="player/launcher?ar=";
var _a=new Object;
var _b=new Object;
var _c="";
var _d=null;
this.launcher=function(ar,_f,_10){
ar=ar.toLowerCase();
var idx=_f.indexOf(":");
var _12,_13;
if(idx>0){
_12=_f.substring(0,idx);
_13=_f.substring(idx+1);
var _14=_12+"="+escape(_13).replace(/%3A/g,":");
_14+=_getParams(_10,this.host);
var obj=_newWidget(ar);
if(obj!=null){
if(obj.fname!=null){
ar=obj.fname;
}
_6[ar]=obj;
_play(ar,_14);
}
}
};
this.play=function(_16,_17,_18,_19){
var idx=_17.indexOf(":");
var _1b,_1c;
if(idx>0){
_1b=_17.substring(0,idx);
_1c=_17.substring(idx+1);
var _1d=_1b+"="+escape(_1c);
_1d+=_getParams(_19,this.host);
_1d+="&lg=1";
if(_18&&_18.length){
var _1e=new Array("scroll1","scroll2","scroll3");
for(var i=0;i<_18.length;i++){
_1d+="&"+_1e[i]+"="+escape(_18[i]);
}
}
_play(_16,_1d);
}
};
this.playlist=function(_20,pls,_22,_23,_24){
if(_22==null||_22.length==0){
_22="wmv";
}
var idx=pls.indexOf(":");
if(idx>0){
pls=pls.substring(idx+1);
}
var url="pls="+pls+"&type="+_22;
if(_23){
url+="&start="+_23;
}
if(_24){
url+="&startid="+_24;
}
url+="&lg=2";
_play(_20,url);
};
this.register=function(_27){
_a[_27]=true;
var _28=_b[_27];
if(_28!=null){
for(var i=0;i<_28.length;i++){
try{
frames[_27].VGlobal.processEvent(_28[i]);
}
catch(E){
if(_4){
alert("mp.js:register - Exception calling VGlobal.processEvent for fname '"+_27+"', data element "+i+".nne:"+e);
}
}
}
_b[_27]=null;
}
};
this.broadcast=function(_2a,_2b){
if(_2a==null){
return;
}
if(_2b==null||_2b.length==0){
for(var n in _a){
if((_2a.eventSrc!=null)&&(_6[_2a.eventSrc]!=null)&&(_6[n]!=null)&&(_6[_2a.eventSrc].group==_6[n].group)){
_pubData(_2a,n);
}
}
}else{
_pubData(_2a,_2b);
}
};
this.forwardClickEvent=function(ar,_2e){
if(ar==null||ar.length==0||_2e==null){
return false;
}
try{
if(_6[ar].evtCallback){
_6[ar].evtCallback(ar,_2e);
}
}
catch(e){
if(_4){
alert("mp.js:forwardClickEvent - Exception calling evtCallback for ar '"+ar+"'.nne:"+e);
}
return false;
}
return true;
};
this.publishClick=function(ar,_30,_31){
if(ar==null||ar.length==0||_30==null||_30.length==0){
return false;
}
try{
frames[ar].TPM_Player.publishClickEvent(_30,_31);
}
catch(e){
if(_4){
alert("mp.js:publishClick - Exception calling TPM_Player.publishClickEvent for ar '"+ar+"'.nne:"+e);
}
return false;
}
return true;
};
function _newWidget(_32){
var _33=_32.split("_");
if(_33.length<4){
return;
}
var _34=_33[3].toLowerCase();
var _35=_34.indexOf("x");
if(_35<1){
return;
}
var w;
var h;
try{
w=_34.substring(0,_35);
h=_34.substring(_35+1);
if(parseInt(w)!=w-0){
return;
}
if(parseInt(h)!=h-0){
return;
}
}
catch(e){
if(_4){
alert("mp.js:_newWidget - Exception converting width and height to integers for widget '"+ar+"'.nne:"+e);
}
return;
}
var obj={};
obj.w=w;
obj.h=h;
obj.embed=_7;
obj.embedDivId=_8;
obj.page=_9+_32;
obj.ar=_32;
obj.evtCallback=_evtCallback;
obj.group=_d;
if(_d!=null&&_d.length>0){
obj.fname=_32+"-"+_d;
}else{
obj.fname=_32;
}
return obj;
}
function _getParams(_39,_3a){
_7=false;
_8=null;
_evtCallback=null;
_1=_3a;
_d=null;
var _3b="";
if(_39&&_39.length){
var idx,_3d,_3e;
var _3f=false;
for(var i=0;i<_39.length;i++){
idx=_39[i].indexOf(":");
if(idx<0){
continue;
}
_3d=_39[i].substring(0,idx);
_3e=_39[i].substring(idx+1);
if(_3d=="embed"){
_3f=true;
if(_3e=="true"){
_7=true;
}else{
_7=false;
}
}else{
if(_3d.toLowerCase()=="embeddivid"&&_3e.length!=0){
_3f=true;
_8=_3e;
}else{
if(_3d=="domain"&&_3e.length!=0){
_3f=true;

_1=_3e;

}else{
if(_3d=="autoplay"&&_3e.length==0){
_3f=true;
}else{
if(_3d.toLowerCase()=="evtcallback"&&_3e.length!=0){

_3f=true;
try{
_evtCallback=eval(_3e);
}
catch(e){
if(_4){
alert("mp.js:_getParams - Exception from eval("+_3e+") while processing 'evtCallback' param.nne:"+e);
}
}
}else{
if(_3d=="debug"&&_3e==1){
_4=true;
}else{
if(_3d=="pdomain"&&_3e.length!=0){
_3f=true;
_c=_3e;
}else{
if(_3d=="group"&&_3e.length!=0){
_d=_3e;
}
}
}
}
}
}
}
}
if(!_3f){
if(_3d.toLowerCase()=="srefid"){
_3b+="&"+_3d+"="+escape(_3e).replace(/%3A/g,":");
}else{
_3b+="&"+_3d+"="+escape(_3e);
}
}
_3f=false;
}
}
if(location.href.indexOf("mpdebug=1")>-1){
_3b+="&debug=1";
_4=true;
}else{
if(location.href.indexOf("mpdebug=2")>-1){
_3b+="&debug=2";
_4=true;
}
}
return _3b;
}
function _play(_41,_42){
_41=_41.toLowerCase();
_a[_41]=false;
var ua=navigator.userAgent.toLowerCase();
var w=null;
try{
w=_6[_41];
if(w==null){
return;
}
}
catch(e){
w=_6["video-full"];
}
if(_1=="us.video.aol.com"){
w.page=_9+w.ar;
}
var _45="?";
if(w.page.indexOf("?")>=0){
_45="&";
}
var url="http://"+_1+"/"+w.page+_45;
url+=_42;
var _47="width="+w.w+", height="+w.h+",status=yes,resizable=no";
if(_4){
_47+=",location=yes,scrollbars=yes";
}
if(w.embed){
if(w.t){
url+="&mediatype="+w.t;
}
if(w.size){
url+="&size="+w.size;
}
if(_42.indexOf("autoplay=")==-1){
url+="&autoplay=3";
}
if(_c.length==0){
url+="&pdomain="+document.domain;
}else{
url+="&pdomain="+_c;
}
url+="&referer="+escape(_2);
var af=null;
try{
af=window.frames[_41];
}
catch(e){
}
if(af){
af.location.href=url;
}else{
_embedPlayer(_41,url);
}
}else{
if(ua.indexOf("aol")!=-1){
try{
if(_5!=""){
_5.close();
}
}
catch(e){
}
}
url+="&referer="+escape(_2);
_5=window.open(url,"_aolvideo_",_47);
}
}
function _embedPlayer(_49,url){
_49=_49.toLowerCase();
if(url==null){
url="";
}
var w=null;
try{
w=_6[_49];
}
catch(e){
w=_6["video-large"];
}
var _4c=(_4)?"":" scrolling=no ";
var _4d=(_4)?"":"overflow:hidden;";
var _4e="<iframe id='"+_49+"' name='"+_49+"' width="+w.w+" height="+w.h+" marginwidth=0 marginheight=0 frameborder=0 "+_4c+" border=0 style='"+_4d+" position:relative; top:0px; left:0px;' src='"+url+"'></iframe>";
if(w.embedDivId&&w.embedDivId!=null&&w.embedDivId.length>0){
var _4f=document.getElementById(w.embedDivId);
if(_4f!=null){
_4f.innerHTML=_4e;
}
}else{
document.writeln(_4e);
}
}
function _pubData(_50,_51){
if(_50==null){
return;
}
var _52=_50.eventSrc;
if(_51!=_52){
if(_a[_51]){
try{
if(frames[_51]&&typeof (frames[_51].VGlobal)!="undefined"&&typeof (frames[_51].VGlobal.processEvent)!="undefined"){
frames[_51].VGlobal.processEvent(_50);
}
}
catch(E){
if(_4){
alert("mp.js:_pubData - Exception calling VGlobal.processEvent for fname '"+_51+"'.nne:"+e);
}
}
}else{
_50.bufferSrc=_51;
if(_b[_51]==null){
var _53=new Array();
_53[0]=_50;
_b[_51]=_53;
}else{
var _53=_b[_51];
if(_53.length==10){
_53=new Array();
}
_53[_53.length]=_50;
_b[_51]=_53;
}
}
}
}
}
var mp=new _mp();



    var sitedomain = "dplqa-ln123.websys.aol.com:8186";
    var authLev = "1";
    var _sns_bg_color_ = "CFD9E3";
    var _sns_x_offset_ = 300;
    var _sns_y_offset_ = 0;
    var _sns_showSignInOutLinks_ = 0;
    var _sns_showByDef_ = 0;
    var _sns_set_var_ = 0;
    var _sns_var_ = "";
    var siteState = encodeURIComponent("OrigUrl="+encodeURIComponent(window.location));
// TRRI JS Starts

var initialCommentBoxText = "";
var TRRI_SLIDE_SPEED = "5000"; //"slow";
var TRRI_CONTEXT_PATH = "";

var serverName = function()
{ 
    var name = location.protocol +"//"+ location.host + TRRI_CONTEXT_PATH; 
    return name; 
}

var getRating = function(score)
{
    var appID = escape(document.getElementById("vote_appID").value);
    var category = escape(document.getElementById("vote_category").value);
    var assetType = escape(document.getElementById("vote_assetType").value);
    var objectURI = escape(document.getElementById("vote_uri").value);

    document.getElementById('trriAddVoteError').innerHTML = '';

    var urlStr = serverName() + "/ajax/trri/addVote.jsp?trriObjectURI=" + objectURI + "&trriCategory=" + category + "&trriAssetType=" + assetType + "&trriAppID=" + appID + "&score=" + score;
    startXhrRequest(urlStr, handleVoteResp, "text/plain");    
}

var handleVoteResp = function()
{
    if(xmlHttp.readyState == 4)
    {
        if(xmlHttp.status == 200)
        {
            document.getElementById("share_vote").innerHTML = xmlHttp.responseText;
        }
    }
}

var createXMLHttpRequest = function()
{
    if (window.ActiveXObject)
    {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } 
    else if (window.XMLHttpRequest)
    {
        xmlHttp = new XMLHttpRequest();
    }
}
    
var startXhrRequest = function(urlStr, handler, type)
{
    createXMLHttpRequest();
    xmlHttp.onreadystatechange = handler;
    xmlHttp.open("GET", urlStr, true);
    xmlHttp.setRequestHeader("Accept", type); 
    xmlHttp.send(null);
}

var handleReportResp = function()
{
    //do nothing;
}

var readTRRICookie = function(name)
{
    //need implementation
}

var writeTRRICookie = function(name, value)
{
    //need implementation
}

var cmtStars =  new Array();
var storeRating = function(id)
{	
    var name = id.substring(0, id.length - 1);
    for(s=0;s<5;s++)
    {
        var a= name + s;
        cmtStars[s] = document.getElementById(a).className;
    }
}

var unrateCmt = function(obj)
{
    var id = obj.id;
    var name = id.substring(0, id.length - 1);
    var index = id.substring(id.length - 1,id.length);
    for(i=0;i<=index;i++)
    {
        var a= name + i;
        var img_obj = document.getElementById(a);
        img_obj.className=cmtStars[i];
    }
}

var hideComments = function(startCount, bool, sortType)
{
    var appID = escape(document.getElementById("cmmt_appID").value);
    var category = escape(document.getElementById("cmmt_category").value);
    var assetType = escape(document.getElementById("cmmt_assetType").value);
    var objectURI = escape(document.getElementById("cmmt_uri").value);

    if(true == bool)
    {
        document.getElementById("cmntOnOff").className="cmntOn";
    }
    else
    {
        document.getElementById("cmntOnOff").className="cmntOff";        
    }
    var hide = (true == bool) ? "true" : "false";
    var urlStr = serverName() + "/ajax/trri/hideComments.jsp?trriObjectURI=" + objectURI + "&trriCategory=" + category + "&trriAssetType=" + assetType + "&trriAppID=" + appID + "&hideComments=" + hide + "&startCount=" + startCount + "&sortType=" + sortType;
    startXhrRequest(urlStr, handleCommentsResp, "text/plain");
}

var showComment = function(collapsID, arwID, reviewIndex)
{
    var cmntOpen = document.getElementById(arwID).className;  

    if (cmntOpen == "closecollapsed"){ 
        document.getElementById(collapsID).style.display = "block";  //show comment
        document.getElementById(arwID).className = "opencollapsed";
        document.images[arwID].src="http://www.aolcdn.com/ch_news/collapsearrow2.gif"; //update path to cdn
        document.getElementById("collapsHdrWarning_" + reviewIndex).style.display = "none";
    }
    else 
    {
        document.getElementById(collapsID).style.display = "none";
        document.getElementById(arwID).className = "closecollapsed";
        document.images[arwID].src="http://www.aolcdn.com/ch_news/collapsearrow1.gif";  //update path to cdn
        //alert ("closed " + showCommentFlag);
        document.getElementById("collapsHdrWarning_" + reviewIndex).style.display = "inline";
    }
}
    
var sortComments = function(obj)
{
    var appID = escape(document.getElementById("cmmt_appID").value);
    var category = escape(document.getElementById("cmmt_category").value);
    var assetType = escape(document.getElementById("cmmt_assetType").value);
    var objectURI = escape(document.getElementById("cmmt_uri").value);

    var sortType = obj.value;
    var urlStr = serverName() + "/ajax/trri/sortComments.jsp?trriObjectURI=" + objectURI + "&trriCategory=" + category + "&trriAssetType=" + assetType + "&trriAppID=" + appID + "&sortType=" + sortType;
    startXhrRequest(urlStr, handleCommentsResp, "text/plain");
}

var mouseoverup = function()
{
    document.getElementById("rateup").className="rateup_on";

}


var mouseoutup = function()
{
    document.getElementById("rateup").className="rateup";
} 


var mouseoverdown = function()
{
    document.getElementById("ratedwn").className="ratedwn_on";
}

var mouseoutdown = function()
{
    document.getElementById("ratedwn").className="ratedwn";
}

var rptFont = 0;
var setfontColor = function(id)
{
    var colorTimer = 100;
    var fontShades =  new Array('#000000', '#333333', '#666666', '#999999');
    var element = document.getElementById(id);
    if(rptFont<4)
    {
	element.style.color = fontShades[rptFont];
	setTimeout("setfontColor('"+id+"');", colorTimer);
	element.style.textDecoration = "none";
	rptFont++;
    }
    else
	rptFont = 0;
    
}

var addCommentHvr = function()
{
    document.getElementById("cmtAdd").className="cmntAddHvr";
}

var cmntOffHvr = function()
{
  if(document.getElementById("cmntOnOff").className == "cmntOff")
       document.getElementById("cmntOnOff").className="cmntOffHvr";
}

var addCommentOut = function()
{
    document.getElementById("cmtAdd").className="cmntAdd";
}

var cmntOffOut = function()
{
    if(document.getElementById("cmntOnOff").className == "cmntOffHvr")
	document.getElementById("cmntOnOff").className="cmntOff";
}

var postBtnHvr = function()
{
    document.getElementById("AddCmmtButton").className="postBtnHvr";
}

var postBtnOut = function()
{
    document.getElementById("AddCmmtButton").className="postBtn";
}

var cancelBtnHvr = function()
{
    document.getElementById("cancelBtn").className="cancelBtnHvr";
}

var cancelBtnOut = function()
{
    document.getElementById("cancelBtn").className="cancelBtn";
}

var commentBoxClick = function(obj, lu)
{
    if(obj.value == 'Type your own comment here')
    {
        obj.value = '';
        obj.className =  'clickcmmntTxtArea';
    }

    if(_sns_isLoggedIn == 1)
    {
        //do nothing
    }
    else
    {
        toggleLayer('anchorImg', 'loginLayer', obj.offsetLeft, obj.offsetTop, lu);
    }
}

var addComment = function(obj, captchaReference, lu)
{
    if(_sns_isLoggedIn == 1)
    {
        var appID = escape(document.getElementById("cmmt_appID").value);
        var category = escape(document.getElementById("cmmt_category").value);
        var assetType = escape(document.getElementById("cmmt_assetType").value);
        var objectURI = escape(document.getElementById("cmmt_uri").value);

        var captchaCode = document.getElementById("capchaCodeArea").value;
        var text = escape(document.getElementById("addCommentHere").value);
        var urlStr = serverName() + "/ajax/trri/addComment.jsp?trriObjectURI=" + objectURI + "&trriCategory=" + category + "&trriAssetType=" + assetType + "&trriAppID=" + appID + "&startCount=0&text=" + text + "&captchaReference=" + captchaReference + "&captchaCode=" + captchaCode;        
        try
        {
            $("#capchaCode").slideUp(TRRI_SLIDE_SPEED);
        }
        catch(e) {} //do nothing                            
        startXhrRequest(urlStr, handleAddCommentResp, "text/plain");
    }
    else
    {
        toggleLayer('anchorImg', 'loginLayer', obj.offsetLeft, obj.offsetTop, lu);
    }
    return false;    
}

var reportComment = function(obj, commentID, lu)
{
    if(_sns_isLoggedIn == 1)
    {    
        var appID = escape(document.getElementById("cmmt_appID").value);
        var category = escape(document.getElementById("cmmt_category").value);
        var assetType = escape(document.getElementById("cmmt_assetType").value);
        var objectURI = escape(document.getElementById("cmmt_uri").value);
        var commentID = escape(commentID);

        obj.innerHTML = "REPORTED!";
        obj.href = "";
        obj.style.cursor = "default";
        obj.onclick = null;
        setfontColor(obj.id);
        var urlStr = serverName() + "/ajax/trri/reportComment.jsp?trriObjectURI=" + objectURI + "&trriCategory=" + category + "&trriAssetType=" + assetType + "&trriAppID=" + appID + "&commentID=" + commentID;
        startXhrRequest(urlStr, handleReportResp, "text/plain");
    }
    else
    {

        toggleLayer('anchorImg', 'loginLayer', obj.offsetLeft, obj.offsetTop, lu);
    }        
    return false;    

}

var submitRating = function(obj, rating, reviewIndex, reviewID, callbackID, lu)
{
    if(_sns_isLoggedIn == 1)
    {        
        for(var i = 0; i < 5; i++)
        {
            var star = document.getElementById("star" + reviewIndex + "_" + i)
            star.onclick = null;
            star.onmouseover = null;
            star.className += " arwCursor";
        }

        var appID = escape(document.getElementById("cmmt_appID").value);
        var category = escape(document.getElementById("cmmt_category").value);
        var assetType = escape(document.getElementById("cmmt_assetType").value);
        var objectURI = escape(document.getElementById("cmmt_uri").value);

        var objId = obj.id;
	var rate_id = "cmt_rate"+reviewIndex;
        var urlStr = serverName() + "/ajax/trri/rateComment.jsp?trriObjectURI=" + objectURI + "&trriCategory=" + category + "&trriAssetType=" + assetType + "&trriAppID=" + appID + "&rating=" + rating + "&reviewIndex=" + reviewIndex + "&reviewID=" + reviewID + "&callbackID=" + callbackID;
        startXhrRequest(urlStr, handleCallbackResp, "text/plain");
	document.getElementById(rate_id).innerHTML = 'thank you for rating';
    }
    else
    {
        toggleLayer('anchorImg', 'loginLayer', obj.offsetLeft, obj.offsetTop, lu);
    }
    return false;    
}

var handleSubmitCommentResp = function()
{
    if(xmlHttp.readyState == 4)
    {
        if(xmlHttp.status == 200)
        {
            document.getElementById("addcmnt").innerHTML = xmlHttp.responseText;
            try
            {
                $("#capchaCode").slideDown(TRRI_SLIDE_SPEED);
            }
            catch(e) {} //do nothing            
        }
    }
}

var handleAddCommentResp = function()
{
    if(xmlHttp.readyState == 4)
    {
        if(xmlHttp.status == 200)
        {
            document.getElementById("addcmnt").innerHTML = xmlHttp.responseText;
            try
            {
                $("#capchaCode").slideDown(TRRI_SLIDE_SPEED);
                $("#pstdCmt").slideDown(TRRI_SLIDE_SPEED);
            }
            catch(e) {} //do nothing
        }
    }
}

var newComment = function()
{
    var appID = escape(document.getElementById("cmmt_appID").value);
    var category = escape(document.getElementById("cmmt_category").value);
    var assetType = escape(document.getElementById("cmmt_assetType").value);
    var objectURI = escape(document.getElementById("cmmt_uri").value);

    var urlStr = serverName() + "/ajax/trri/newComment.jsp?trriObjectURI=" + objectURI + "&trriCategory=" + category + "&trriAssetType=" + assetType + "&trriAppID=" + appID;
    try
    {
        $("#pstdCmt").slideUp(TRRI_SLIDE_SPEED);
    }
    catch(e) {} //do nothing      
    startXhrRequest(urlStr, handleAddCommentResp, "text/plain");    
}

var editComment = function()
{
    var appID = escape(document.getElementById("cmmt_appID").value);
    var category = escape(document.getElementById("cmmt_category").value);
    var assetType = escape(document.getElementById("cmmt_assetType").value);
    var objectURI = escape(document.getElementById("cmmt_uri").value);
    var text = escape(document.getElementById("addCommentHere").value);

    var urlStr = serverName() + "/ajax/trri/newComment.jsp?trriObjectURI=" + objectURI + "&trriCategory=" + category + "&trriAssetType=" + assetType + "&trriAppID=" + appID + "&posted=edit&text=" + text;
    try
    {
        $("#pstdCmt").slideUp(TRRI_SLIDE_SPEED);
    }
    catch(e) {} //do nothing      
    startXhrRequest(urlStr, handleAddCommentResp, "text/plain");    
}

var displayComments = function(startCount, sortType)
{
    var appID = escape(document.getElementById("cmmt_appID").value);
    var category = escape(document.getElementById("cmmt_category").value);
    var assetType = escape(document.getElementById("cmmt_assetType").value);
    var objectURI = escape(document.getElementById("cmmt_uri").value);

    if(startCount < 0) {startCount = 0; }
    var urlStr = serverName() + "/ajax/trri/comments.jsp?trriObjectURI=" + objectURI + "&trriCategory=" + category + "&trriAssetType=" + assetType + "&trriAppID=" + appID + "&startCount=" + startCount + "&sortType=" + sortType;
    try
    {
        $("#pstdCmt").slideUp(TRRI_SLIDE_SPEED);
    }
    catch(e) {} //do nothing      
    startXhrRequest(urlStr, handleCommentsResp, "text/plain");
}

var handleCallbackResp = function()
{
    if(xmlHttp.readyState == 4)
    {
        if(xmlHttp.status == 200)
        {
            var responseText = xmlHttp.responseText;
            if(responseText.length > 0)
            {
                eval(responseText);
            }
        }
    }
}

var addCommentKeypress = function(e, obj, captchaReference, lu, startCount)
{
    var characterCode = "";
    if(e && e.which) { characterCode = e.which; }
    else { characterCode = event.keyCode; }
    if(characterCode == 13)
    {
        postComment(obj, captchaReference, lu, startCount);
    }
    return false;
} 

var postComment = function(obj, captchaReference, lu, startCount)
{
    if(_sns_isLoggedIn == 1)
    {
        var appID = escape(document.getElementById("cmmt_appID").value);
        var category = escape(document.getElementById("cmmt_category").value);
        var assetType = escape(document.getElementById("cmmt_assetType").value);
        var objectURI = escape(document.getElementById("cmmt_uri").value);

        var captchaCode = document.getElementById("capchaCodeArea").value;
        if(captchaCode.length > 0)
        {
            var text = escape(document.getElementById("addCommentHere").value);
            var urlStr = serverName() + "/ajax/trri/addComment.jsp?trriObjectURI=" + objectURI + "&trriCategory=" + category + "&trriAssetType=" + assetType + "&trriAppID=" + appID + "&startCount="+startCount+"&text=" + text + "&captchaReference=" + captchaReference + "&captchaCode=" + captchaCode;        
            try
            {
                $("#capchaCode").slideUp(TRRI_SLIDE_SPEED);
            }
            catch(e) {} //do nothing                            
            startXhrRequest(urlStr, handleCommentsResp, "text/plain");
        }
    }
    else
    {
        toggleLayer('anchorImg', 'loginLayer', obj.offsetLeft, obj.offsetTop, lu);
    }
    return false;    
}

var submitComment = function(obj, lu, startCount)
{
    if(_sns_isLoggedIn == 1)
    {
        var appID = escape(document.getElementById("cmmt_appID").value);
        var category = escape(document.getElementById("cmmt_category").value);
        var assetType = escape(document.getElementById("cmmt_assetType").value);
        var objectURI = escape(document.getElementById("cmmt_uri").value);

        var text = document.getElementById("addCommentHere").value;

        if((text.length > 0) && (text != initialCommentBoxText))
        {        
            var escapedText = escape(text);
            var urlStr = serverName() + "/ajax/trri/submitComment.jsp?trriObjectURI=" + objectURI + "&trriCategory=" + category + "&trriAssetType=" + assetType + "&trriAppID=" + appID + "&startCount=" + startCount + "&text=" + escapedText;
            try
            {
                $("#capchaCode").slideUp(TRRI_SLIDE_SPEED);
            }
            catch(e) {} //do nothing      
            startXhrRequest(urlStr, handleSubmitCommentResp, "text/plain");

        }
    }
    else
    {
        toggleLayer('anchorImg', 'loginLayer', obj.offsetLeft, obj.offsetTop, lu);
    }
    return false;    
}

var rateCmt = function(obj, collapsed)
{
    var id = obj.id;
    var name = id.substring(0, id.length - 1);
    var index = id.substring(id.length - 1,id.length)
    for(i=0;i<=index;i++)
    {
        var a= name + i;
        var img_obj = document.getElementById(a);
        if(collapsed){img_obj.className='pinkstarGray';}
	else {img_obj.className='pinkstar';}
    }
}

var addyourComment = function(startCount, bool, sortType)
{
	if(bool == false)
		hideComments (startCount, bool, sortType, true);
	 else 
		window.location = '#commentBottom';
}

var  handleCommentsResp = function()
{

    if(xmlHttp.readyState == 4)

    {
        if(xmlHttp.status == 200)
        {
            document.getElementById("cmmntBox").innerHTML = xmlHttp.responseText;
            try
            {
                $("#pstdCmt").slideDown(TRRI_SLIDE_SPEED);
                $("#capchaCode").slideDown(TRRI_SLIDE_SPEED);
            }
            catch(e) {} //do nothing 
            var response = xmlHttp.responseText;
	    if(response.indexOf("commentCountStart") != -1 && response.indexOf("commentCountEnd") != -1)
	    {
		var startcountIdx = response.indexOf("commentCountStart");
                var endcountIdx = response.indexOf("commentCountEnd");
		var totalComments = response.substring(parseInt(startcountIdx)+17,parseInt(endcountIdx));
		document.getElementById("ArtCmtCnt").innerHTML = totalComments;
	    }  
        }
    }
}

var hideComments = function(startCount, bool, sortType, addCmnt)
{
    var appID = escape(document.getElementById("cmmt_appID").value);
    var category = escape(document.getElementById("cmmt_category").value);
    var assetType = escape(document.getElementById("cmmt_assetType").value);
    var objectURI = escape(document.getElementById("cmmt_uri").value);

    if(true == bool)
    {
        document.getElementById("cmntOnOff").className="cmntOn";
    }
    else
    {
        document.getElementById("cmntOnOff").className="cmntOff";        
    }
    var hide = (true == bool) ? "true" : "false";
    var urlStr = serverName() + "/ajax/trri/hideComments.jsp?trriObjectURI=" + objectURI + "&trriCategory=" + category + "&trriAssetType=" + assetType + "&trriAppID=" + appID + "&hideComments=" + hide + "&startCount=" + startCount + "&sortType=" + sortType;
    if(bool == false && addCmnt == true)
	startXhrRequest(urlStr, handleAddYourCommentsResp, "text/plain");
    else
	startXhrRequest(urlStr, handleCommentsResp, "text/plain");
}

var  handleAddYourCommentsResp = function()
{
    if(xmlHttp.readyState == 4)
    {
        if(xmlHttp.status == 200)
        {
            document.getElementById("cmmntBox").innerHTML = xmlHttp.responseText;
	    window.location = '#commentBottom';
        }
    }
}

var loadCommentBox = function()
{
  var obj = document.addComment.addCommentHere;
  
  if(obj.value != 'Type your own comment here')
	obj.className =  'clickcmmntTxtArea';
}

function maxlength(obj, max)
{
    if (obj.value.length > max)
{
        obj.value = obj.value.substr(0, max);
    }
}
/* TRRI JS Ends */
/*extra */


/*function callBackSuccessOnPost()
{
  elmtCmt= $("#articleCmntHdr");
  var str=elmtCmt.html();
  
    var splitStr=str.split(" ");
    cmtCnt=parseInt(splitStr[2])+1;
    elmtCmt.html("COMMENTS ( "+cmtCnt+" )");
  
  
}*/
