// Global Variables
var ccob = new cob();
var divCount = '';
var entInterval;
var activeTab = new Array();
var msgObj = null;
var is_aol = navigator.userAgent.toLowerCase().indexOf("aol") != -1;
var is_mac = navigator.userAgent.indexOf('Mac') != -1;

window.onload=channel_init;

// Start Channel
function channel_init(){
    onLoadDalaiLlama();
    photoLead_playPhotos();
    dl_init();
}

//Photo gallery module - sports-specific config settings.
//The functions for this module are in channels.js.
//Defaults are set in channels.js.
var picHostURL = "http://cdn.channel.aol.com/ch_sports/";
var activeButton, playingForward, playingBackward, photoPlayer, playControlActive, storyControlActive, maxStory;
var timeDelay = 10;
var autoPlay = "on";
var playDirection = "forward";
var x = 0;
var offImg = new Array("info_btn_1_off","info_btn_2_off","info_btn_3_off","info_btn_4_off","info_btn_5_off","info_btn_6_off","info_btn_7_off","info_btn_8_off","info_btn_9_off","info_btn_10_off","info_btn_11_off","info_btn_12_off","info_btn_prev_off","info_btn_pause_off","info_btn_next_off");
var onImg = new Array("info_btn_1_on","info_btn_2_on","info_btn_3_on","info_btn_4_on","info_btn_5_on","info_btn_6_on","info_btn_7_on","info_btn_8_on","info_btn_9_on","info_btn_10_on","info_btn_11_on","info_btn_12_on","info_btn_prev_on","info_btn_pause_on","info_btn_next_on");
//END Photo gallery module

//adRefresh
function adRefresh() {
var adSpots = '0';
try {
if (pgAdSpots != null && pgAdSpots != 'undefined' && pgAdSpots != '') {
adSpots = pgAdSpots;
}
} catch(e) {
adSpots = '0';
}
try {
top.ch_refresher.refresh_ads_by_spot(adSpots);
} catch(e) { }
return true;
} 

//URL Parser
function getParam(paramName,defaultValue) {
	var q = (location.search.replace(/\?/,"")).split("&");
	var i = q.length;
	while(i-->0) {
		var t = q[i].split("=");
		if(t[0] == paramName) return t[1];
	}
	return defaultValue;
}

//AFL Embedded UnCut Video Module Code

function alfplayNewVid(vidURL){
	var alfplayerdiv = document.getElementById('alfplayer');
	var videoOutputOne = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="415" height="347" id="browser" style="padding:0;margin:0"><param name="allowScriptAccess" value="always" /><param name="wmode" value="transparent" /><param name="movie" value="http://uncutvideo.aol.com/v.06/uc_videoplayer.swf" /><param name="FlashVars" value="assetURL=';
	var videoOutputTwo = '&duration=60&showExpandButton=false&expandFunctionID=expandVideo&assetID=8b1bccf70d4305a68abc954940c28d53&wmurl=http://uncutvideo.aol.com/&pol=false&mvvis=true&mvurl=http://uncutvideo.aol.com/"/><param name="quality" value="high" /><param name="bgcolor" value="#FFFFFF" /><embed src="http://uncutvideo.aol.com/v.06/uc_videoplayer.swf" quality="high" bgcolor="#cccccc" wmode="transparent"FlashVars="assetURL=';
	var videoOutURL = vidURL;
	var videoOutputThree = '&duration=60&showExpandButton=false&expandFunctionID=expandVideo&assetID=8b1bccf70d4305a68abc954940c28d53&wmurl=http://uncutvideo.aol.com/&pol=false&mvvis=true&mvurl=http://uncutvideo.aol.com/\" width="415" height="347" name="browser" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed><\/object>'; 
	alfplayerdiv.innerHTML = videoOutputOne + videoOutURL + videoOutputTwo + videoOutURL + videoOutputThree;
}

function alfVideoDeepLink(){
	alfqs = getParam("dlink","noQuery");
	if (alfqs != "" && alfqs.indexOf('http://pdl.stream.aol.com') == 0) {
		alfplayNewVid(alfqs);
	}
}

// Header2.0
function p_o(o){return document.getElementById(o);}

function ai_posX(obj){
 var left=0;
 if(obj.offsetParent){
  while(obj.offsetParent){
   left+=obj.offsetLeft;
   obj=obj.offsetParent;
  }
 }else if(obj.x)left+=obj.x;
 return left;
}
function ai_posY(obj){
 var top=0;
 if(obj.offsetParent){
  while(obj.offsetParent){
   top+=obj.offsetTop;
   obj=obj.offsetParent;
  }
 } else if(obj.x)top+=obj.y;
 return top;
}

function togMore(e,state){
 var oDiv=p_o('smore');
 if(state=='show'){
  posMore(e);
  oDiv.style.zIndex=99999999;
  oDiv.style.display='block';
 } else {
  oDiv.style.display='none';
 }
 return false;
}
function posMore(e){
	var oDiv=p_o('smore');
	var oLnk=p_o('smorea');
	posY = findMousePos(e);
	oDiv.style.left=(ai_posX(oLnk)+15)+'px';
	oDiv.style.top=(posY+oLnk.offsetHeight/2)+'px';
}
// Begin : Headers 2 code
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}

function srchSub(ref){
  var frm=p_o("search");
  var queryval = frm.topquery.value.trim();
  queryval = queryval.replace( /\+/, " ");
  newurl = ref.href + queryval;
  window.location = newurl;
  return false;
}

// Radio Button Switch
function getValFFld (frmObj) {
    if (typeof(frmObj) == "object" && frmObj.type == undefined) {
             var objType = frmObj[0].type;
    } else {
            objType = frmObj.type;
    }
    switch (objType) {
        case "radio" :
            if (typeof(frmObj.length) == undefined) {
                return frmObj.value;
            } else {
                for (i=0;i < frmObj.length;i++) {
                    if (frmObj[i].checked == true) {
                        return frmObj[i].value;
                    }
                }
            }
        default :
            return frmObj.value;
    }
}
function formSetupAndSubmit(frmObj,keyFrmObj) {
    key = getValFFld(keyFrmObj);
    eval("allsets = srchSetsRdoBtns." + key);

    for (set in allsets) {
        cmd = set.substr(0,4);
        switch (cmd) {
            case "_fs_" :
                frmPropNm = set.substr(4,set.length);
                eval("frmObj." + frmPropNm + "='" + allsets[set]+ "'");
                break;
            case "_af_" :
                eval("ffObj=frmObj." + set.substr(4,set.length));
                if (ffObj.value.indexOf(allsets[set]) == -1 && ffObj.value != "") {
                    ffObj.value += allsets[set];
                }
                break;
            default :
                eval("frmFObj = frmObj." + set);
                frmFObj.value = allsets[set];
        }
    }
}


// NON-MODULE CODE
function popup_window(url,width,height){
	var features="status=0,menubar=0,location=0,toolbar=0";
	if (!isNaN(parseInt(width))){features+=",width="+width;}
	if (!isNaN(parseInt(height))){features+=",height="+height;}
	if (typeof(window.screenLeft)!="undefined"){
		features+=",left="+window.screenLeft;
		features+=",left="+Math.round(window.screenLeft+((document.body.clientWidth/2)-(width/2)));
	} else if (typeof(window.screenX)!="undefined"){
		features+=",left="+Math.round(window.screenX+((window.outerWidth/2)-(width/2)));
	}
	if (typeof(window.screenTop)!="undefined"){
		features+=",top="+window.screenTop;
		features+=",top="+Math.round(window.screenTop+150);
	} else if (typeof(window.screenY)!="undefined"){
		features+=",top="+Math.round(window.screenY+((window.outerHeight-window.innerHeight)+150));
	}
	var popupWin=window.open(url,"popupWin",features);
	if (popupWin.focus){popupWin.focus();}
}

function popupWindow(url,width,height,features) {
	if (!isNaN(parseInt(width))){features+=",width="+width;}
	if (!isNaN(parseInt(height))){features+=",height="+height;}
	if (typeof(window.screenLeft)!="undefined"){
		features+=",left="+window.screenLeft;
		features+=",left="+Math.round(window.screenLeft+((document.body.clientWidth/2)-(width/2)));
	} else if (typeof(window.screenX)!="undefined"){
		features+=",left="+Math.round(window.screenX+((window.outerWidth/2)-(width/2)));
	}
	if (typeof(window.screenTop)!="undefined"){
		features+=",top="+window.screenTop;
		features+=",top="+Math.round(window.screenTop+150);
	} else if (typeof(window.screenY)!="undefined"){
		features+=",top="+Math.round(window.screenY+((window.outerHeight-window.innerHeight)+150));
	}
	var popupWin=window.open(url,"popupWin",features);
	//if (popupWin.focus){popupWin.focus();}
}

var is_flash = false; var flashVer = 7;
if (window.ActiveXObject && !is_mac) {document.write('<scr' + 'ipt language="VBScript">' + '\n' + 'On Error Resume Next' + '\n' + 'is_Flash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & flashVer)))' + '\n' + '<\/sc' + 'ript>'); } 
else {var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0; var pluginStr = plugin.description; if (plugin){ if (parseInt(pluginStr.substring(pluginStr.indexOf(".")-1)) >= flashVer) { is_flash = true; }}}

function openWindow (url) {
	var argv = openWindow.arguments;
	var argc = argv.length;
	if (argc == 1) {var handle = window.open(url);}
	else if (argc == 2) {var handle = window.open(url,argv[1]);}
	else {var handle = window.open(url,argv[1],argv[2]);}
	handle.focus();
}

function showClientMsg(e) {
	if (!msgObj || window != top) {alert("This area is only available within the AOL client."); return false;}
	if (document.getElementById) {var launchLink = document.getElementById("launchLink");}
	else if (document.all) {var launchLink = document.all.launchLink;}
	else {alert("This area is only available within the AOL client."); return false;}
	launchLink.href = this.href;
	e = e ? e : event;
	var cm_xPos = (e.pageX != undefined) ? e.pageX : e.clientX + (document.documentElement ? document.documentElement.scrollLeft : document.body.scrollLeft);
	var cm_yPos = (e.pageY != undefined) ? e.pageY : e.clientY + (document.documentElement ? document.documentElement.scrollTop : document.body.scrollTop);
	cm_xPos = (cm_xPos > 438) ? 438 : cm_xPos;
	msgObj.style.left = cm_xPos + "px";
	msgObj.style.top = cm_yPos + "px";
	msgObj.style.display = "block";
	if (msgObj.focus) msgObj.focus();
	return false;
}

function hideClientMsg() {
	msgObj.style.display = "none";
	return false;
}

function onLoadDalaiLlama() {
    if (typeof onLoadDalaiLlamaMxid != 'undefined') {
        if ((typeof onLoadDalaiLlamaMxidType != 'undefined') && (onLoadDalaiLlamaMxidType == 'audio')) {
            DalaiLlama.OpenAudioFullMXID("mp.aol.com", onLoadDalaiLlamaMxid)
        } else {
            DalaiLlama.OpenFullMXID("mp.aol.com", onLoadDalaiLlamaMxid)
        }
	setOptCookie("bbDL"+onLoadDalaiLlamaMxid,onLoadDalaiLlamaMxid);
    }
}

// gets the value of the query string
function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  }
}

// check for the valid object
function testIsValidObject(objToTest) {
    if (objToTest == null || objToTest == undefined) {
        return false;
    }
    return true;
}

// Big Bowl Menus
var bb_selected=-1,bb_selected_pm=-1,bb_selected_fm=-1,bb_selected_bm=-1,bb_selected_gn=-1,bb_selected_gnp=-1;
var bb_subindex=new Array(),bb_flyindex=new Array();
var bb_menu_timer,bb_fly_timer,bb_bmenu_timer,bb_gnmenu_timer;
var bb_menu_delay=500,bb_fly_delay=200;
var bb_cgid=-1,bb_ll=-1;
var bb_ie,bbh_m,bbh_gn,bbh_gnp,bbh_bm,bbh_bmp,bbh_mp,bbh_mf,n;
if (typeof(bb_lf) == "undefined") {
var bb_lf = new Array();
}

navigator.userAgent.toLowerCase().indexOf('msie')!=-1?bb_ie=1:bb_ie=0;

function bb_o(o){return document.getElementById(o);}

function bb_l(o){return o.getElementsByTagName("li");}


// New Ticker Functions
function tickerInit(ticker){
       ticker.start();
}

function Ticker(name, id, shiftBy, interval){
  this.name     = name;
  this.id       = id;
  this.shiftBy  = shiftBy ? shiftBy : 1;
  this.interval = interval ? interval : 100;
  this.runId	= null;
  this.div = document.getElementById(id);

  var node = this.div.firstChild;
  var next;

  while (node)  {
    next = node.nextSibling;
    if (node.nodeType == 3)
      this.div.removeChild(node);
    node = next;
  }
  this.left = 436;
  this.shiftLeftAt = this.div.firstChild.offsetWidth;
  this.div.style.height	= this.div.firstChild.offsetHeight;
  this.div.style.width = 2 * screen.availWidth;
  this.div.style.visibility = 'visible';
}

function startTicker(){
  this.stop();
  
  this.left -= this.shiftBy;

  if (this.left <= -this.shiftLeftAt)
  {
    this.left = 436;
    this.div.appendChild(this.div.firstChild);
  
    this.shiftLeftAt = this.div.firstChild.offsetWidth;
  }

  this.div.style.left = (this.left + 'px');

  this.runId = setTimeout(this.name + '.start()', this.interval);
}

function stopTicker(){
  if (this.runId)
    clearTimeout(this.runId);
    
  this.runId = null;
}

function changeTickerInterval(newinterval){

  if (typeof(newinterval) == 'string')
    newinterval =  parseInt('0' + newinterval, 10); 
	
  if (typeof(newinterval) == 'number' && newinterval > 0)
    this.interval = newinterval;
    
    this.stop();
    this.start();
}

Ticker.prototype.start = startTicker;
Ticker.prototype.stop = stopTicker;
Ticker.prototype.changeInterval = changeTickerInterval;

function ctaPopup(ctaUrl)
{
	if (ctaUrl) {
		window.open (ctaUrl,'CTA','scrollbars=no,location=no,directories=no,height=265,width=275,menubar=no,resizable=no,titlebar=no');
	} else {
		window.open ("",'CTA','scrollbars=no,location=no,directories=no,height=265,width=275,menubar=no,resizable=no,titlebar=no');
	}
}

function ctaPopup2(ctaUrl)
{
	if (!ctaUrl) {
		ctaUrl = "";
	}
	window.open (ctaUrl,'CTA','scrollbars=no,location=no,directories=no,height=265,width=275,menubar=no,resizable=no,titlebar=no');
}
// End New Ticker Functions

// Launching AOL IM and CONSOLES
// STaF Functions for Email this and IM this Functionalities
var IM_global_title;
var IM_global_url;
var IM_default_text_IE = "Your%20friend%20wants%20you%20to%20check%20this%20out:";
var IM_default_text_OT = "Your friend wants you to check this out:";

// To check AIM install in the local machine or not
function canRunAIM() {
    var agt = navigator.userAgent.toLowerCase();
    var isIE =  (agt.indexOf("msie") != -1);
    if (!isIE) 
       return true;

    var a = document.anchors;
    for (var i=0;i<a.length;i++) {
        if (a[i].name=="aimnotfound") {
            return false;
        }
    }
    return true;
}

// To check AOL Client install in the local machine or not
function canRunAOLClient() {
    var agt = navigator.userAgent.toLowerCase();
    var isIE =  (agt.indexOf("msie") != -1);
    if (!isIE) 
        return true;

    var a = document.anchors;
    for (var i=0;i<a.length;i++) {
        if (a[i].name=="aolclientnotfound") {
            return false;
        }
    }
    return true;
}

// To send IM through AOL Client Messenger
function sendAOLCLNT() {
 
 var title = IM_global_title;
 var url   = IM_global_url;

 var uAgt	=	navigator.userAgent.toLowerCase();
 var isAOL	=	uAgt.indexOf(" aol ")	!= -1;
 var isIE =  uAgt.indexOf("msie") != -1;
 
 try {

  if (!isAOL) {
 	 if (!isIE) {
        document.location="aol://9293::"+ IM_default_text_OT + "<br><a href='" + url + "'>" + title + "</a>";
	 } else {
	   document.location="aol://9293::"+ IM_default_text_IE +"%3cbr%3e%3ca href='" + url + "'%3e" + title + "%3c%2fa%3e";
     }
  } else {
     document.location='aol://9293::' + IM_default_text_OT +'<br><a href="' + url + '">' + title + '</a>'
  }

 } catch (e) {
    AIMExpress.start();
 }
}

// To send IM through AIM
function sendAIM() {
 
 var title = IM_global_title;
 var url   = IM_global_url;

 var title = title.replace(/ /g, "+");
 var uAgt	=	navigator.userAgent.toLowerCase();
 var isIE	=	uAgt.indexOf(" msie ")	!= -1;
 var isAOLBrowser	=	uAgt.indexOf(" america online browser ") != -1; 
 if (!isIE) {
    var message = IM_default_text_OT + '<br><a href="' + url + '">' + title + '</a>';
 } else if(isAOLBrowser) {
    var message = IM_default_text_OT + '<br><a href="' + url + '">' + title + '</a>';
 } else {
    var message = IM_default_text_IE + "%3cbr%3e%3ca+href=%22" + escape(url) + "%22%3e" + title + "%3c%2fa%3e";
 }
	message = escape(message);  
 
 try {
  document.location = 'aim:GoIm?message=' + message;
 } catch (e) {
//	sendAOLCLNT();
  AIMExpress.start();
 }
}

// If user is not using AOL Client then 
// send IM thro AIM if exists else if AOLClient exists then 
// send IM thro AOLClient else launch AIM Express and send IM

// If user in using the AOL Client then send IM thro AOL Client Instant Messenger
function sendIM(title, url) {

 if(title == '') {
	title = 'Click here to checkout';
 }

 IM_global_title = title;
 IM_global_url = url;

 var uAgt	=	navigator.userAgent.toLowerCase();
 var isAOL	=	uAgt.indexOf(" aol ")	!= -1;
 var isIE	=	uAgt.indexOf(" msie ")	!= -1;
 if (!isAOL) {
   if (!isIE) {
      sendAIM ();
   } else {
	  if (!canRunAIM()) {
//	     if (!canRunAOLClient()) {
		    AIMExpress.start();
//	     } else {
//          sendAOLCLNT ();
//	     }
      } else {
         sendAIM ();
      }
   }
 } else {
       sendAOLCLNT ();
 }

}

// To launch the STAF User Console
function openstaf(title, url, channel) {
   window.open("http://sendtoafriend.aol.com?type=disp&channelurl="+url+"&title="+title+"&channel="+channel+"&url="+url+"",null,"height=420,width=296,statusbar=0,toolbar=no,menubar=no,location=no")
}
// End Launching AOL IM and CONSOLES

// Omniture Custom Link Tracking Script For Info Themed List Modules
function doNMClick(oLink){

/*the value of s_linkTrackVars should be set to include the variables that need to related to the link. The values of s_channe
l and s_prop19 will be gathered from the underlying page. s_prop19 contains the value of s_pageName from the underlying page.
*/
    s_linkTrackVars="s_channel,s_prop16,s_prop17,s_prop18,s_prop19,s_prop20";

//s_linkType is the same for all links, type "o" refers to Custom Links
    s_linkType='o';

//set Link Name to equal the innerHTML from the Link Object
    s_linkName=oLink.innerHTML;

/* back up the original values in the s_props on the page */
    var s_prop16bu=s_prop16;
    var s_prop17bu=s_prop17;
    var s_prop18bu=s_prop18;
    var s_prop19bu=s_prop19;
    var s_prop20bu=s_prop20;

//set the various s_props
    s_prop16=oLink.getAttribute("mt");
if (this.arrXpromoIncModules == undefined)
    {
        var s_account="aolnwmoduledev";
    } else {
        flag = false;
        var loc = window.location.href;
        for (var i=0;i<arrXpromoIncModules.length;i++)
        {
            if (arrXpromoIncModules[i] == s_prop16)
            {
                flag = true;
                break;
            }
        }
        if (flag == true)
        {
            s_account="aolxpromo";
        } else {
            s_account="aolnwmoduledev";
        }
        if (loc.indexOf('office')!=-1 || loc.indexOf('stage')!=-1 || loc.indexOf('estage')!=-1 || loc.indexOf('adpqa')!=-1)
        {
            s_account="aolxpromodev";
        } else {
            s_account="aolxpromo";
        }
    }

    s_prop17= (window['s_channel']==undefined||window['s_channel']=="")?"unavailable":s_channel;
    s_prop18=(window['s_pageName']==undefined||window['s_pageName']=="")?document.title:s_pageName;
    s_prop19=document.URL
    s_prop20=oLink.href;

//these functions are called for every link
    if (window['s_account'] != undefined){
        s_lnk=s_co(oLink);
        s_gs(s_account);
    }
/* replace the original values in the s_props on the page */
    s_prop16=s_prop16bu;
    s_prop17=s_prop17bu;
    s_prop18=s_prop18bu;
    s_prop19=s_prop19bu;
    s_prop20=s_prop20bu;
}

// END Omniture Custom Link Tracking Script For Info Themed List Modules

/*Omniture Custom Link Tracking Script For Info Themed List Modules*/
function doNMClickimg(oLink,image){

/*the value of s_linkTrackVars should be set to include the variables that need to related to the link. The values of s_channe
l and s_prop19 will be gathered from the underlying page. s_prop19 contains the value of s_pageName from the underlying page.
*/
    s_linkTrackVars="s_channel,s_prop16,s_prop17,s_prop18,s_prop19,s_prop20";

//s_linkType is the same for all links, type "o" refers to Custom Links
    s_linkType='o';

//set Link Name to equal the innerHTML from the Link Object

    s_linkName=image;

/* back up the original values in the s_props on the page */
    var s_prop16bu=s_prop16;
    var s_prop17bu=s_prop17;
    var s_prop18bu=s_prop18;
    var s_prop19bu=s_prop19;
    var s_prop20bu=s_prop20;

//set the various s_props
    s_prop16=oLink.getAttribute("mt");
    if (this.arrXpromoIncModules == undefined)
    {
        var s_account="aolnwmoduledev";
    } else {
        flag = false;
        var loc = window.location.href;
        for (var i=0;i<arrXpromoIncModules.length;i++)
        {
            if (arrXpromoIncModules[i] == s_prop16)
            {
                flag = true;
                break;
            }
        }
        if (flag == true)
        {
            s_account="aolxpromo";
        } else {
            s_account="aolnwmoduledev";
        }
        if (loc.indexOf('office')!=-1 || loc.indexOf('stage')!=-1 || loc.indexOf('estage')!=-1 || loc.indexOf('adpqa')!=-1)
        {
            s_account="aolxpromodev";
        } else {
            s_account="aolxpromo";
        }
    }

    s_prop17= (window['s_channel']==undefined||window['s_channel']=="")?"unavailable":s_channel;
    s_prop18=(window['s_pageName']==undefined||window['s_pageName']=="")?document.title:s_pageName;
    s_prop19=document.URL
    s_prop20=oLink.href;

//these functions are called for every link
    if (window['s_account'] != undefined){
        s_lnk=s_co(oLink);
        s_gs(s_account);
    }

/* replace the original values in the s_props on the page */
    s_prop16=s_prop16bu;
    s_prop17=s_prop17bu;
    s_prop18=s_prop18bu;
    s_prop19=s_prop19bu;
    s_prop20=s_prop20bu;
}

// END Omniture Custom Link Tracking Script For Info Themed List Modules

// PAGE GROUPS
// For info pages
function toggle_image(id, src){
	if (document.getElementById(id)){document.getElementById(id).src=src;}
}

 
function changeDivTop(newTop) {
	divObj = document.getElementsByTagName("div");
	for (i=0;i<divObj.length;i++) {
		if (divObj[i].className == "subNav"){divObj[i].style.top = newTop+"px";}
	}
}

function makeImageFit(obj,maxHt,maxWd) {
	var src_height = obj.height;
	var src_width  = obj.width;
	var wdiff = src_width - maxWd;
	var hdiff = src_height - maxHt;
	var aspect = 0;
  
	if (wdiff > hdiff) {
		newWd = maxWd;   
		aspect = newWd / src_width;
		newHt = Math.round(src_height * aspect);		
	} else {
		newHt = maxHt;
		aspect = newHt / src_height;
		newWd = Math.round(src_width * aspect);
	}
  
 
	obj.height= newHt;
	obj.width= newWd;
}

function openlink(url){window.open(url, '_dlplayer');}

function setOptCookie(name,value) {
   document.cookie = escape(name)+"="+escape(value)+";DOMAIN=.aol.com;PATH=/;";
}
// END PAGE GROUPS
// END NON-MODULE CODE

// MODULES JAVASCRIPT
// For "You Said It" module
var activeYousaidit = 0;
function toggle_yousaidit(){
	if (document.getElementById("yousaidit"+(activeYousaidit+1))){
		toggle_display("yousaidit"+activeYousaidit,false);
		toggle_display("yousaidit"+(++activeYousaidit),true);
	} else {
		toggle_display("yousaidit"+activeYousaidit,false);
		toggle_display("yousaidit"+(activeYousaidit=0),true);
	}
}

function toggle_display(id,state){
	if (document.getElementById(id)){
		if (typeof(state)=="undefined"){state=document.getElementById(id).style.display=="block"?false:true;}
		document.getElementById(id).style.display=state?"block":"none";
	}
}


// For "Newsmaker" module
var maxNewsmaker=new Array(), activeNewsmaker=new Array();

function swapNewsmaker(id,direction){
	if (typeof(maxNewsmaker[id])=="undefined" && document.getElementById("newsmaker"+id+"."+1)){
		maxNewsmaker[id]=activeNewsmaker[id]=1;
		while (document.getElementById("newsmaker"+id+"."+(++maxNewsmaker[id]))){}
		maxNewsmaker[id]--;
	}
	if (maxNewsmaker[id]>1){
		toggle_display("newsmaker"+id+"."+activeNewsmaker[id],false);
		if (direction=="next"){
			if (document.getElementById("newsmaker"+id+"."+(activeNewsmaker[id]+1))){
				toggle_display("newsmaker"+id+"."+(++activeNewsmaker[id]),true);
			} else {
				toggle_display("newsmaker"+id+"."+(activeNewsmaker[id]=1),true);
			}
		} else if (direction=="previous"){
			if (document.getElementById("newsmaker"+id+"."+(activeNewsmaker[id]-1))){
				toggle_display("newsmaker"+id+"."+(--activeNewsmaker[id]),true);
			} else {
				toggle_display("newsmaker"+id+"."+(activeNewsmaker[id]=maxNewsmaker[id]),true);
			}
		}
		document.getElementById("newsmakerTally"+id).innerHTML=activeNewsmaker[id]+"/"+maxNewsmaker[id];
	}
}


// For any module with tabs
function tabs_handleMouseOver(id,color,instance) {
	var undefined;
	if (instance !== undefined){
		if (activeTab[instance] == id) return;
		instance = '_' + instance;
		instance2 = '_' + instance + '_';
	} else {
		instance = '';
		instance2 = '';
		if(activeTab == id) return;
	}
	if (color == "ntrl"){eval('document.images.img' + instance2 + id + '.src = tabs_on_ntrl' + instance + '[' + id + ']');}
	else {eval('document.images.img' + instance2 + id + '.src = tabs_on' + instance + '[' + id + ']');}
}

function tabs_handleMouseOut(id,instance) {
	var undefined;
	if (instance !== undefined){
		if (activeTab[instance] == id) return;
		instance = '_' + instance;
		instance2 = '_' + instance + '_';
	} else {
		instance = '';
		instance2 = '';
		if(activeTab == id) return;
	}
	eval('document.images.img' + instance2 + id + '.src = tabs_off' + instance + '[' + id + ']');
}

function tabs_handleClick(id,color,instance) {
	var undefined;
	if (instance !== undefined){
		var numTabs = eval('tabs_off_'+instance+'.length');
		if(activeTab[instance] != id) {
			for (k=1; k<numTabs; k++){
				eval('document.images.img_' + instance + '_' + k + '.src=tabs_off_' + instance + '[k]');
			}
			if (color == "ntrl") {eval('document.images.img_' + instance + '_' + id + '.src=tabs_on_ntrl_' + instance + '['+id+']');}
			else {eval('document.images.img_' + instance + '_' + id + '.src=tabs_on_' + instance + '['+id+']');}
		}
		activeTab[instance] = id;
	} else {
		activeTab = id;
	}
}

// For top11deeplink
//Top11playlist version of the activate tab function.
function activateTab(idx,moduleId,activeClassName) {
    if (activeTab[moduleId] != idx) {
        // turn off active tab
        eval(activeElement = document.getElementById('tab_' + activeTab[moduleId] + '_' + moduleId));
                if (activeElement.className == "vidPLon")
                {
                        activeElement.className = "vidPLoff";
                }
                else
                {
                        activeElement.className = null;
                }

                // activate the clicked tab
        activeTab[moduleId] = idx;
        eval(tabToActivate = document.getElementById('tab_' + idx + '_' + moduleId));
        tabToActivate.className = activeClassName;
    }
}

//Dynamic CSS manipulation tools.
function setClassByID(objectID, newClass)
{
        var object = document.getElementById(objectID);
        object.className = newClass;
}

function setClassByObj(senderObj, newClass)
{
        senderObj.className = newClass;
}

//This function recursivelly finds a DIV in a parent element.
//It is needed because the mozilla and ie doms have different hierarchies.
//Called from hiLiteRow, a top11deeplink function.
function recurseDiv(el)
{
        if (el.nodeName == "DIV")
        {
                return el;
        }
        else if (el.hasChildNodes)
        {
                for (i = 0 ; i < el.childNodes.length; i++)
                {
                        if (el.childNodes[i].nodeName == "DIV")
                        {
                                return el.childNodes[i];
                        }
                        else if (el.childNodes[i].hasChildNodes)
                        {
                                var returnEl = recurseDiv(el.childNodes[i]);
                                if (returnEl) return returnEl;
                        }
                }
        }
        else
        {return null};
}

//A Top11DeepLink function.
function hiLiteRow(senderObj, newClass)
{
        //Set the row class.
        setClassByObj(senderObj, newClass);

        //Set the number class.
        //Get the number div element.
        var numClass = (newClass == "mouseOn")? "numPLon" : "numPL";
        setClassByObj(recurseDiv(senderObj), numClass);
}
// End top11deeplink

// Non-Deeplink Top11 Module
function sendGenContent(frameName,srcDiv,destDiv) {
	if (parent.document.location == document.location) {return;}
	else {parent.serveGenContent(frameName,srcDiv,destDiv);}
}

function serveGenContent(frameName,srcDiv,destDiv) {
	divCopy(srcDiv+'?'+frameName,destDiv);
}

function divCopy(srcDiv,destDiv) {
	var src = findObj(srcDiv);
	var dest = findObj(destDiv);
	if (src && dest) {dest.innerHTML = src.innerHTML;}
}

function findObj(theObj, theDoc){
	var p, i, foundObj;
	if (!theDoc) theDoc = document;
	if ((p = theObj.indexOf("?")) > 0 && parent.frames.length){
		theDoc = parent.frames[theObj.substring(p+1)].document;
		theObj = theObj.substring(0,p);
	}
	if (!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
	for (i=0; !foundObj && i < theDoc.forms.length; i++)
		foundObj = theDoc.forms[i][theObj];
	for (i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)
		foundObj = findObj(theObj,theDoc.layers[i].document);
	if (!foundObj && theDoc.getElementById) foundObj = theDoc.getElementById(theObj);
	return foundObj;
}


// For dynamic lead modules
var dynLeads = new Array();
var activeObjIndex = null;
var zInterval = null;
var yInterval = null;
var autoIndex = 1;
var TRANS_SPEED = 5;
var AUTO_RESTART = 10000;
var AUTO_INTERVAL=12;

function dl_init() {
	if (!document.getElementById("dl2")) return;
	dlObj = document.getElementById("dl_container");

	for (i=0; i<dlObj.getElementsByTagName("div").length; i++) {
		dynLeads[i]  = dlObj.getElementsByTagName("div")[i];
		dynLeads[i].xid = i;
		dynLeads[i].xdirection = 0;
		dynLeads[i].xheight = dynLeads[i].getElementsByTagName("h2")[0].offsetHeight*i;
		dynLeads[i].xtop = dynLeads[i].offsetTop;
		dynLeads[i].getElementsByTagName("h2")[0].onclick = function() { dl_handleClick(this.parentNode.xid); }
	}

	dlObj.style.height = dlObj.offsetHeight+"px";
	dynLeads[0].xtop=0;
	dynLeads[0].xdirection = 1;

	for (i=0; i<dynLeads.length; i++) {
		dynLeads[i].style.position = "absolute";
		dynLeads[i].style.top = dynLeads[i].xtop+"px";
	}

	yInterval = setInterval("autoScroll()",(AUTO_INTERVAL*1000));
}

function restartAutoScroll() {
	clearInterval(yInterval);
	yInterval = setInterval("autoScroll()",(AUTO_INTERVAL*1000));
}

function autoScroll() {
	activeObjIndex = autoIndex;
	dynLeads[activeObjIndex].getElementsByTagName("span")[0].style.display = "block";
	clearInterval(zInterval);
	zInterval = setInterval(dl_animate,10);
	autoIndex++;
	if (autoIndex == dynLeads.length) autoIndex = 0;
}

function dl_handleClick(objIndex) {
	if (activeObjIndex == objIndex) return;
	clearInterval(yInterval);
	autoIndex = objIndex;
	yInterval = setTimeout("restartAutoScroll()",AUTO_RESTART);
	activeObjIndex = objIndex;
	dynLeads[activeObjIndex].getElementsByTagName("span")[0].style.display = "block";
	clearInterval(zInterval);
	zInterval = setInterval(dl_animate,10);
}

function dl_animate() {
	if (dynLeads[activeObjIndex].xdirection == 0) {
		for (i=activeObjIndex; i>0; i--) {
			_w = dynLeads[i].offsetTop;
			if (_w>parseInt(dynLeads[i].xheight)) {
				_w-=TRANS_SPEED;
				dynLeads[i].style.top = _w+"px";
			} 
		}
	} else {
		svar = activeObjIndex?activeObjIndex+1:activeObjIndex;
		if (activeObjIndex == 0) svar=1;
		for (i=svar; i<dynLeads.length; i++) {
			_w=dynLeads[i].offsetTop;
			if (_w<=parseInt(dynLeads[i].xtop)) {
				_w+=TRANS_SPEED;
				dynLeads[i].style.top = _w+"px";
			}
		}
	}
	if (dynLeads[activeObjIndex+1]) {
		svar=activeObjIndex+1;
	} else {
		svar=activeObjIndex;
	}
	if (parseInt(dynLeads[activeObjIndex].style.top) <= dynLeads[activeObjIndex].xheight && dynLeads[activeObjIndex].xdirection == 0) {
		clearInterval(zInterval);
		zInterval = null;
		for (i=activeObjIndex; i>0; i--) dynLeads[i].xdirection = 1;
	} else if (parseInt(dynLeads[svar].style.top) >= dynLeads[svar].xtop && dynLeads[svar].xdirection == 1) {
		clearInterval(zInterval);
		zInterval = null;
		for (i=svar; i<dynLeads.length; i++) {
			dynLeads[i].xdirection = 0;
			dynLeads[i].style.top = dynLeads[i].xtop+"px";
		}
	}
}

// For photo gallery module
var picHostURL = "http://cdn.channel.aol.com/ch_pf/";
var activeButton, playingForward, playingBackward, photoPlayer, playControlActive, storyControlActive, maxStory
var timeDelay = 10
var autoPlay = "on"
var playDirection = "forward"
var x = 0
var offImg = new Array("info_btn_1_off-pf","info_btn_2_off-pf","info_btn_3_off-pf","info_btn_4_off-pf","info_btn_5_off-pf","info_btn_6_off-pf","info_btn_7_off-pf","info_btn_8_off-pf","info_btn_9_off-pf","info_btn_10_off-pf","info_btn_11_off-pf","info_btn_12_off-pf","info_btn_prev_off-pf","info_btn_pause_off-pf","info_btn_next_off-pf")
var onImg = new Array("info_btn_1_on-pf","info_btn_2_on-pf","info_btn_3_on-pf","info_btn_4_on-pf","info_btn_5_on-pf","info_btn_6_on-pf","info_btn_7_on-pf","info_btn_8_on-pf","info_btn_9_on-pf","info_btn_10_on-pf","info_btn_11_on-pf","info_btn_12_on-pf","info_btn_prev_on-pf","info_btn_pause_on-pf","info_btn_next_on-pf")

function photoLead_playPhotos(seconds,onOff,direction){
	if (document.getElementById("photoGalleryParent")){
		if (seconds!=undefined){timeDelay = seconds}
		timeDelay = timeDelay * 1000
		if (typeof(maxStory)=="undefined"){
			maxStory = 0;
			while (document.getElementById("pic"+maxStory)){
				maxStory++;
			}
		}
		if (onOff!=undefined){autoPlay=onOff.toLowerCase()}
		else{autoPlay=autoPlay.toLowerCase()}
		if (direction!=undefined){playDirection=direction.toLowerCase();}
		else{playDirection=playDirection.toLowerCase();}
		if (playDirection=="forward"){
			playingForward=true
			playingBackward=false
			playControlActive=14
		} else {
			playingForward=false
			playingBackward=true
			playControlActive=12
		}
		if (autoPlay=="on"){photoLead_startTimer()}
		else (photoLead_changePhotoStory(1))
	}
}

function photoLead_startTimer(){
	if (playingForward==true){
		if (document.getElementById("pic14")){document.getElementById("pic14").src = picHostURL + onImg[14]}
		if (document.getElementById("photostory" + (x+1)) && document.getElementById("pic" + x)){x=x+1}
		else{maxStory=x; x=1;}
	}
	if (playingBackward==true){
		if (document.getElementById("pic12")){document.getElementById("pic12").src = picHostURL + onImg[12]}
		x=x-1;
		if (x<1){x=maxStory}
	}
	if (document.getElementById("titledefault") && document.getElementById("photo" + x + "title") && document.getElementById("photo" + x + "title").innerHTML!=""){document.getElementById("titledefault").innerHTML=document.getElementById("photo" + x + "title").innerHTML}
	if (document.getElementById("photodefault") && document.getElementById("photostory" + x + "photo") && document.getElementById("photostory" + x + "photo").innerHTML!=""){document.getElementById("photodefault").innerHTML=document.getElementById("photostory" + x + "photo").innerHTML}
	if (document.getElementById("textdefault") && document.getElementById("photostory" + x + "text") && document.getElementById("photostory" + x + "text").innerHTML!=""){document.getElementById("textdefault").innerHTML=document.getElementById("photostory" + x + "text").innerHTML}
	if (document.getElementById("linkWrapperDefault") && document.getElementById("linkWrapper" + x) && document.getElementById("linkWrapper" + x).innerHTML!=""){document.getElementById("linkWrapperDefault").innerHTML=document.getElementById("linkWrapper" + x).innerHTML}
	storyControlActive=x-1;
	photoLead_makeActive(x);
	photoPlayer=setTimeout("photoLead_startTimer()", timeDelay);
}

function photoLead_stopTimer(){
	if (playingForward==true && document.getElementById("pic14")){document.getElementById("pic14").src = picHostURL + offImg[14]}
	if (playingBackward==true && document.getElementById("pic12")){document.getElementById("pic12").src = picHostURL + offImg[12]}
	playingForward=false;
	playingBackward=false;
	playControlActive=-1;
	if (photoPlayer){clearTimeout(photoPlayer);}
	else {if (photoPlayer==undefined && document.getElementById("pic13")){document.getElementById("pic13").src = picHostURL + offImg[13]}}
}

function photoLead_rollover(buttonID,buttonNumber,buttonState){
	if (document.getElementById(buttonID)){
		switch (buttonState){
			case "on":
				document.getElementById(buttonID).src = picHostURL + onImg[buttonNumber];
				break;
			case "off":
				if (activeButton!=buttonNumber && playControlActive!=buttonNumber && storyControlActive!=buttonNumber){
					document.getElementById(buttonID).src = picHostURL + offImg[buttonNumber];
				}
				break;
		}
	}
}

function photoLead_makeActive(isActiveNum){
	activeButton = isActiveNum - 1;
	if (activeButton==13){}
	else{
		for (i=0;i<15;i++){
			if (playingForward==true && i!=14 && document.getElementById("pic" + i)){document.getElementById("pic" + i).src = picHostURL + offImg[i]}
			else if (playingBackward==true && i!=12 && document.getElementById("pic" + i)){document.getElementById("pic" + i).src = picHostURL + offImg[i]}
			else if (playingForward==false && playingBackward==false && document.getElementById("pic" + i)){document.getElementById("pic" + i).src = picHostURL + offImg[i]}
		}
	}
	if (document.getElementById("pic" + activeButton)){document.getElementById("pic" + activeButton).src = picHostURL + onImg[activeButton]}
}

function photoLead_changePhotoStory(photStorNumber){
	if (photStorNumber>maxStory){photStorNumber=maxStory}
	storyControlActive=photStorNumber-1;
	x=photStorNumber;
	photoLead_makeActive(photStorNumber);
	if (document.getElementById("titledefault") && document.getElementById("photo" + photStorNumber + "title") && document.getElementById("photo" + photStorNumber + "title").innerHTML!=""){document.getElementById("titledefault").innerHTML=document.getElementById("photo" + photStorNumber + "title").innerHTML}
	if (document.getElementById("photodefault") && document.getElementById("photostory" + photStorNumber + "photo") && document.getElementById("photostory" + photStorNumber + "photo").innerHTML!=""){document.getElementById("photodefault").innerHTML=document.getElementById("photostory" + photStorNumber + "photo").innerHTML}
	if (document.getElementById("textdefault") && document.getElementById("photostory" + photStorNumber + "text") && document.getElementById("photostory" + photStorNumber + "text").innerHTML!=""){document.getElementById("textdefault").innerHTML=document.getElementById("photostory" + photStorNumber + "text").innerHTML}
	if (document.getElementById("linkWrapperDefault") && document.getElementById("linkWrapper" + photStorNumber) && document.getElementById("linkWrapper" + photStorNumber).innerHTML!=""){document.getElementById("linkWrapperDefault").innerHTML=document.getElementById("linkWrapper" + photStorNumber).innerHTML}
}

// For tabbed module v2
function p(j){return document.getElementById(j)}
function ob(j){return document.getElementById(j)}

function cob() {
    var cache = new Array();
	
    // methods
    this.add     = function add(key,data) {cache[key] = data}
    this.getData = function getData(key) {return cache[key]}
    this.getKeys = function getKeys() {
        var keys = new Array();
		  var ix = 0;
        for (var i in 	cache) {
            keys[ix] = i;
		    ix++;
        }
        return keys;
    }
    this.hvDat = function hvDat(key) {
	    if (cache[key] || cache[key] == 0){return 1}
 	    return 0;
    }
}

function tbmd_set(mod,t) {
    
    // get all the li tags from the parent ul 
    lis = ob('tbsid' + mod).getElementsByTagName('UL').item(0).getElementsByTagName('LI');
	  
    // if data key is in the cache object then use it to turn off tab
    key = 'curidx' + mod;
    if (ccob.hvDat(key)) {
        aObj = lis.item(ccob.getData(key)).getElementsByTagName('A').item(0);
        aObj.className = '';
	aObj.style.display = 'block';
    }
	 
    // turn on clicked tab current tab if 
    if (lis.length >= t) {
        aObj = lis.item(t).getElementsByTagName('A').item(0);
        aObj.className = 'selected';
        aObj.style.display = 'block';
        ccob.add(key,t);
    }
}
function getData(tbmid,mod,t) {
    
    // if data for tab is not it cache the get item
    key = tbmid + '_' + t;
    tbd = '';
	  
	if (ccob.hvDat(key)) {
	    tbd = ccob.getData(key);

	    tbmd_set(tbmid,t);

            // get content div object
            modObj = ob('cntd' + tbmid);

	    modObj.innerHTML = tbd;
	} else {
            // get iframe div
            tbfObj = ob('tbf' + tbmid);
            
            // store iframe src url
            tbfUrl = '/mod.adp?_miid=' + mod + '&_tbmid=' + tbmid + '&_mtb=' + t; 

            // append current query params, they may be needed by module being output via mod.adp
            tbfQry = document.location.search;
            if(tbfQry) {tbfUrl += '&' + tbfQry.substring(1)}

            // append current url and the idx of tab clicked, some modules will use this for a redir
            defTab = "_deftb" + tbmid;
            tbfTmp = location.href; 

            // rebuild params without "_deftab{instanceid}"
            if(tbfTmp.indexOf(defTab) > 1) {
                aTmp = new Array();
                aQps = tbfQry.substring(1,tbfQry.length).split('&');
                for (i=0;i < aQps.length;i++) {
                    if (aQps[i].indexOf(defTab) == -1) {
                       aTmp.push(aQps[i]);
                    } 
                }
                tbfTmp = tbfTmp.substring(0,tbfTmp.indexOf('?') + 1) + aTmp.join('&');
            }
            // append the default tab with the idx of the tab clicked
            if(tbfTmp.indexOf('?') == -1) {tbfTmp += '?'} else {tbfTmp += '&'}
            tbfUrl += '&_tbdref=' + encodeURIComponent(tbfTmp + defTab + '=' + (t + 1));
            
            // stuff iframe div then set update src
            tbfHtm = '<iframe class=\"tbf\" id=\"tbdframe\" src=\"\"></iframe>';
            tbfObj.innerHTML = tbfHtm;
            tbfObj.getElementsByTagName('iframe').item(0).src = tbfUrl;
    }
    return false;
}
function fillFromHttp(req,a) {
    // confirm data recieved successfully
	tbd = '';
    if(req) {
        key = a.key;
	tbd = req
        ccob.add(key,tbd)
    } else {
        tbd = '0';
    }
	  
    // flip tabs
    tbmd_set(a.mod,a.t);
	 
    // fillDiv 
    ob('cntd' + a.mod).innerHTML = tbd;
}

function toggleArticleDrawer(obj,id) {
	var pObj = document.getElementById(id);
	if (obj.className == "off") {
		obj.className = "on";
		if(pObj.className.match("wrap")) {
			pObj.className = "artDrawer on wrap";
		} else {
			pObj.className = "artDrawer on";
		}
	}
	else {
		obj.className = "off";
		if(pObj.className.match("wrap")) {
			pObj.className = "artDrawer off wrap";
		} else {
			pObj.className = "artDrawer off";
		}
	}
}

function toggleClassName(id,stateOne,stateTwo) {
	var obj = document.getElementById(id);
	if (obj.className == stateOne) {
		obj.className = stateTwo;
	} else {
		obj.className = stateOne;
	}
}
// END For tabbed module v2

// For info_newsmakermain module
function o(j){return document.getElementById(j).style}
var nm_a,nm_b,nm_r,nm_s,nm_f=11;
var nm_cur=new Array();

function nm_init(mod){
    var nm_max=1,f;
    nm_r=.5/20*1000;
	nm_s=10/20;
	nm_cur[mod]=1;
	while(p(mod+"."+nm_max)){nm_max++;}
	nm_max--;
	p(mod+".cou").innerHTML="1/"+nm_max;
	o(mod+".nav").visibility="visible";
	f=function nm_pre(){
		if(nm_f>=10){
			var n=nm_cur[mod]-1;
			if(!n)n=nm_max;
			p(mod+"."+n).innerHTML=p(mod+"."+n).innerHTML.replace(/AOL:/i,"");
			cf(mod+"."+nm_cur[mod],mod+"."+n);
			nm_cur[mod]=n;
			p(mod+".cou").innerHTML=n+"/"+nm_max;
		}
                return false; 
	}
	p(mod+".pre").onclick=f;
	f=function nm_nex(){
		if(nm_f>=10){
			var n=nm_cur[mod]+1;
			if(n>nm_max)n=1;
			p(mod+"."+n).innerHTML=p(mod+"."+n).innerHTML.replace(/AOL:/i,"");
			cf(mod+"."+nm_cur[mod],mod+"."+n);
			nm_cur[mod]=n;
			p(mod+".cou").innerHTML=n+"/"+nm_max;
		}
		return false;
     }
     p(mod+".nex").onclick=f;
}
function cf(c,d){
    nm_a=o(c);nm_b=o(d);
    nm_b.display="block";
    nm_f=0;
    df();
}
function df(){
    nm_a.opacity=((10-nm_f)/10);nm_a.filter="alpha(opacity:"+(10-nm_f)*10+")";
    nm_b.opacity=(nm_f/10);nm_b.filter="alpha(opacity:"+nm_f*10+")";
    nm_f+=nm_s;
    if(nm_f<10)setTimeout("df()",nm_r);
        else nm_a.display="none";
}
// End info_newsmakermain module

// Modification for Omniture tracking in DL
function sendLinkEvent()
{ 
var startpos=s_account.indexOf('aolsvc');
var nextcomma=s_account.indexOf(',',startpos);
if(nextcomma>-1){ns=s_account.substring(0,startpos)+s_account.substring(nextcomma+1,s_account.length);}
else{ns=s_account.substring(0,startpos-1)}
 
            s_linkType="o";
            s_lnk=true;
            void(s_gs(ns));
}

//-----------------------END MODULES JAVASCRIPT------------------//
// BEGIN Functions for ActiveX patch to IE/IE7 ------------------//
function FlashTag(src, width, height, version) {
    if (arguments.length < 4)
    {
        throw new Exception('RequiredAttributeException',
                            'You must pass in a src, width, height, and version when creating a FlashTag.');
    }

    for (var i = 0; i < arguments.length; ++i)
    {
        if (arguments[i] == undefined || arguments[i] == null)
        {
            throw new Exception('RequiredAttributeException',
                                'All constructor arguments must have values.');
        }
    }

    // Required
    this.src            =  src;
    this.width          =  width;
    this.height         =  height;
    this.version        =  version;

    this.id             =  null;
    this.flashVars      =  null;
    this.flashVarsStr   =  null;
    this.genericParam   = new Object();
    this.ie = (navigator.appName.indexOf ("Microsoft") != -1) ? 1 : 0;
}
FlashTag.prototype.setSource = function(src) {
    this.src = src;
}
FlashTag.prototype.setWidth = function(w) {
    this.width = width;
}
FlashTag.prototype.setHeight = function(h) {
    this.h = height;
}
FlashTag.prototype.setVersion = function(v) {
    this.version = v;
}
FlashTag.prototype.setId = function(id) {
    this.id = id;
}
FlashTag.prototype.setBgcolor = function(bgc) {
    if (bgc.charAt(0) != '#') bgc = '#' + bgc;
    this.genericParam['bgcolor'] = bgc;
}
FlashTag.prototype.addFlashVars = function(fvs) {
    this.flashVarsStr = fvs;
}
FlashTag.prototype.addFlashVar = function(n, v) {
    if (this.flashVars == null) this.flashVars = new Object();
    this.flashVars[n] = v;
}
FlashTag.prototype.removeFlashVar = function(n) {
    if (this.flashVars != null) this.flashVars[n] = undefined;
}
FlashTag.prototype.setSwliveconnect = function(swlc) {
    this.genericParam['swliveconnect'] = swlc;
}
FlashTag.prototype.setPlay = function(p) {
    this.genericParam['play'] = p;
}
FlashTag.prototype.setLoop = function(l) {
    this.genericParam['loop'] = l;
}
FlashTag.prototype.setMenu = function(m) {
    this.genericParam['menu'] = m;
}
FlashTag.prototype.setQuality = function(q) {
    if (q != 'low' && q != 'high' && q != 'autolow' && q != 'autohigh' && q != 'best')
    {
        throw new Exception('UnsupportedValueException',
                            'Supported values are "low", "high", "autolow", "autohigh", and "best".');
    }
    this.genericParam['quality'] = q;
}
FlashTag.prototype.setScale = function(sc) {
    if (sc != 'showall' && sc != 'noborder' && sc != 'exactfit' && sc != 'noscale')
    {
        throw new Exception('UnsupportedValueException',
                            'Supported values are "showall", "noborder", "exactfit, and "noscale".');
    }
    this.genericParam['scale'] = sc;
}
FlashTag.prototype.setAlign= function(a) {
    if (a != 'l' && a != 't' && a != 'r' && a != 'b')
    {
        throw new Exception('UnsupportedValueException',
                            'Supported values are "l", "t", "r" and "b".');
    }
    this.genericParam['align'] = a;
}
FlashTag.prototype.setSalign= function(sa) {
    if (sa != 'l' && sa != 't' && sa != 'r' && sa != 'b' && sa != 'tl' && sa != 'tr' && sa != 'bl' && sa != 'br')
    {
        throw new Exception('UnsupportedValueException',
                            'Supported values are "l", "t", "r", "b", "tl", "tr", "bl" and "br".');
    }
    this.genericParam['salign'] = sa;
}
FlashTag.prototype.setWmode = function(wm) {
    if (wm != 'window' && wm != 'opaque' && wm != 'transparent')
    {
        throw new Exception('UnsupportedValueException',
                            'Supported values are "window", "opaque", and "transparent".');
    }
    this.genericParam['wmode'] = wm;
}
FlashTag.prototype.setBase = function(base) {
    this.genericParam['base'] = base;
}
FlashTag.prototype.toString = function() {
    var flashTag = new String();
    if (this.ie)
    {
        flashTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
        if (this.id != null)
        {
            flashTag += 'id="'+this.id+'" ';
        }
        flashTag += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+this.version+'" ';
        flashTag += 'width="'+this.width+'" ';
        flashTag += 'height="'+this.height+'">';
        flashTag += '<param name="movie" value="'+this.src+'"/>';

        for (var n in this.genericParam)
        {
            if (this.genericParam[n] != undefined && this.genericParam[n] != null)
            {
                flashTag += '<param name="'+n+'" value="'+this.genericParam[n]+'"/>';
            }
        }

        if (this.flashVars != null)
        {
            var fv = this.getFlashVarsAsString();
            if (fv.length > 0)
            {
                flashTag += '<param name="flashvars" value="'+fv+'"/>';
            }
        }
        flashTag += '</object>';
    }
    else
    {
        flashTag += '<embed src="'+this.src+'"';
        flashTag += ' width="'+this.width+'"';
        flashTag += ' height="'+this.height+'"';
        flashTag += ' type="application/x-shockwave-flash"';
        if (this.id != null)
        {
            flashTag += ' name="'+this.id+'"';
        }

        for (var n in this.genericParam)
        {
            if (this.genericParam[n] != undefined && this.genericParam[n] != null)
            {
                flashTag += (' '+n+'="'+this.genericParam[n]+'"');
            }
        }
        if (this.flashVars != null || this.flashVarsStr != null)
        {
            var fv = this.getFlashVarsAsString();
            if (fv.length > 0)
            {
                flashTag += ' flashvars="'+fv+'"';
            }
        }
        flashTag += ' pluginspage="http://www.macromedia.com/go/getflashplayer">';
        flashTag += '</embed>';
    }
    return flashTag;
}
FlashTag.prototype.write = function(doc) {
    doc.write(this.toString());
}
FlashTag.prototype.getFlashVarsAsString = function() {
    var qs = new String();
    for (var n in this.flashVars)
    {
        if (this.flashVars[n] != undefined && this.flashVars[n] != null)
        {
            qs += (escape(n)+'='+escape(this.flashVars[n])+'&');
        }
    }

    if (this.flashVarsStr != null) return qs + this.flashVarsStr;

    return qs.substring(0, qs.length-1);
}
FlashTag.prototype.setParams = function( id, bgc, fvs, swlc, p, l, m, q, sc, a, wm, base ) {
    if (id != null) this.id             =  id;
    if (fvs != null) this.flashVarsStr   =  fvs;

    if (bgc != null) this.setBgcolor(bgc);
    if (swlc != null) this.setSwliveconnect(swlc);
    if (p != null) this.setPlay(p);
    if (l != null) this.setLoop(l);
    if (m != null) this.setMenu(m);
    if (q != null) this.setQuality(q);
    if (sc != null) this.setScale(sc);
    if (a != null) this.setAlign(a);
    if (wm != null) this.setWmode(wm);
    if (base != null) this.setBase(base); 
}
function writeOnLoad() {
         try {
                 if ( flashTagParams != undefined ) {
                         var tag =  new FlashTag(flashTagParams.src, flashTagParams.width, flashTagParams.height, flashTagParams.version );
                         document.write(tag.toString());
                 }
         } catch(ex) {
                // Do nothing
         }
}
writeOnLoad();
// END Functions for ActiveX patch to IE/IE7 ------------------//

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);
       }
    }
}

// START  Function for New Footer Design ----------------------------

function bb_makefbarnew (chname) {
	var s,vC,vM,c=0,p,sub;
	//Setup footer link bar
	if(p=bb_o("n__bb_fme")){
		// To make the first letter of Channel name to Uppercase - Bala 
        var ch_fletter = chname.charAt(0).toUpperCase();
        var chname = chname.replace(/^([a-z])([a-z]+)$/i, ""+ch_fletter+"$2");
		c=0;
		bb_ll=bb_md.length;
		s_temp='<span class="n__bb_ftb">More in '+chname+': </span>';
		for(i=0;i<bb_ll;i++){
			if(bb_md[i].l==0){
				vM=bb_md[i].v.charAt(0);
				vC=bb_md[i].v.charAt(1);
				if((vC==2||vC==bb_isC)&&(vM==2||vM==bb_isM)){
					s_temp+="<a href='"+bb_md[i].u+"'";
					if(bb_md[i].n=="Y")s+=" target='_blank'";
					s_temp+=">"+bb_md[i].t+"</a> | ";
					c++;
				}
			}
		}
		s = s_temp.substring(0,eval(s_temp.length-3));
		p.innerHTML=s;
	}	

	//Setup footer plain old links
	if (typeof(bb_fm)=="undefined" || typeof(bb_fm)!="string"){
		//return;
	}else{
		if(p=bb_o("n__bb_fr")){
		s="<span class='n__bb_ftb'>"+bb_fm+"</span> ";
		c=0;
		for(i=0;i<bb_fg.length;i++){
			vM=bb_fg[i].v.charAt(0);
			vC=bb_fg[i].v.charAt(1);
			if((vC==2||vC==bb_isC)&&(vM==2||vM==bb_isM)){
				s+="<a href='"+bb_fg[i].u+"'";
				if(bb_fg[i].n=="Y")s+=" target='_blank'";
				s+=">"+bb_fg[i].t+"</a> | ";
			}
		}
		s=s.slice(0,-3);
		p.innerHTML=s;
	}
	}

	//Setup footer links
	if(p=bb_o("n__bb_frfb")){
		s="";
		c=0;
		for(i=0;i<bb_lf.length;i++){
			vM=bb_lf[i].v.charAt(0);
			vC=bb_lf[i].v.charAt(1);
			if((vC==2||vC==bb_isC)&&(vM==2||vM==bb_isM)){
				s+="<a href='"+bb_lf[i].u+"'";
				if(bb_lf[i].n=="Y")s+=" target='_blank'";
				s+=">"+bb_lf[i].t+"</a> | ";
			}
		}
		s=s.slice(0,-3);
		d=p.innerHTML;
        if (d.length > 0 && s.length > 0) {
           s+=" | " + d;
        } else {
		   s+=d;
		}
		p.innerHTML=s;
	}
}

// END  Function for New Footer Design ----------------------------

// Snag and Feed Popup Function  - starts --------------
var sng_fd_win = '';
function sng_fd_openPopup(obj,url,type,mod_id,feed_url,turn_off) {

    if (!sng_fd_win.closed && sng_fd_win.location)
    {
        sng_fd_win.close();
    }
    
    if (type == 1)
    {
        //only snag
        wid = 360;
        hei = 120;
        var snagMarkUp=eval('snagCode_'+mod_id);
        url += "/sng_fd_popup.adp?_sngcode=" + snagMarkUp + "&_fdurl=&_fdbtns=&debug=0";
    }
    else if (type == 2)
    {
        //only feed
        wid = 360;
        hei = 180;
        url += "/sng_fd_popup.adp?_sngcode=&_fdurl=" + feed_url + "&_fdbtns=" + turn_off + "&debug=0";
    }
    else if (type == 3)
    {
        //both feed and snag
        wid = 360;
        hei = 256;
        var snagMarkUp=eval('snagCode_'+mod_id);
        url += "/sng_fd_popup.adp?_sngcode=" + snagMarkUp + "&_fdurl=" + feed_url + "&_fdbtns=" + turn_off + "&debug=0";
    }
    
    if ( ( type == 2 || type == 3 ) && turn_off != "" )
    {
    	// only feed or both feed and snag
    	var turn_off_array = turn_off.split(",");
    	if ( turn_off_array.length >= 3 && turn_off_array.length <= 5 )
    	{
    	    hei -= 25;
    	}
    	else if ( turn_off_array.length == 6 )
    	{
    	    hei -= 60;
    	}
    }
    
    wleft = (screen.width - wid) / 2;
    wtop = (screen.height - hei) / 2;
    var sStyle = 'width='+ wid +'px,height='+ hei +'px,left='+ wleft +'px,top='+ wtop +'px,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0'; 
    sng_fd_win = window.open(url,'name',sStyle);
    sng_fd_win.focus();

}
// End of Snag and Feed Popup Function  --------------------

/*Omniture Custom Link Tracking Script For Big Bowl Feed Module*/
function doFMClick(oLink,image,headline){
    s_linkTrackVars="s_channel,s_prop17,s_prop18,s_prop19,s_prop20";
    s_linkType='o';
    var img = image;
    var title = headline;
    if(img!='') {
        s_linkName=image;
    } else if(title!=''){
        s_linkName=title;
    } else {
        s_linkName=oLink.innerHTML;
    }

/* back up the original values in the s_props on the page */
    var s_prop17bu=s_prop17;
    var s_prop18bu=s_prop18;
    var s_prop19bu=s_prop19;
    var s_prop20bu=s_prop20;

//set the various s_props
    var loc = window.location.href;
    if (loc.indexOf('office')!=-1 || loc.indexOf('stage')!=-1 || loc.indexOf('estage')!=-1 || loc.indexOf('adpqa')!=-1)
    {
        s_account="aolfeedsmoddev";
    } else {
        s_account="aolfeedsmod";
    }
    
    s_prop17= (window['s_channel']==undefined||window['s_channel']=="")?"unavailable":s_channel;
    s_prop18=(window['s_pageName']==undefined||window['s_pageName']=="")?document.title:s_pageName;
    s_prop19=document.URL
    s_prop20=oLink.href;

//these functions are called for every link
    if (window['s_account'] != undefined){
        s_lnk=s_co(oLink);
        s_gs(s_account);
    }

/* replace the original values in the s_props on the page */
    s_prop17=s_prop17bu;
    s_prop18=s_prop18bu;
    s_prop19=s_prop19bu;
    s_prop20=s_prop20bu;
}
// END Omniture Custom Link Tracking Script For Big Bowl Feed Module

// Feed Module Mouse Over Popup Functions - Starts
function createPop()
{
    var popRef = document.createElement("p");
    popRef.className = 'feedPop';
    popRef.setAttribute('id','feedPop');
    document.body.appendChild(popRef);
    popRef.style.display = 'none';
   
}

function showPop(e,trgElement,textPopup)
{
    var elHt = trgElement.offsetHeight;//this is the element height
    var elWt = trgElement.offsetWidth;//this is the element height
    createPop();
	posY = findMousePos(e)
    if(document.getElementById('feedPop').style.display.indexOf('none')==0)
    {
        popRef = document.getElementById('feedPop');
        var txtNode = document.createTextNode(textPopup);
	var arrPos = findPos(trgElement);
	popRef.style.display = "block";
	popRef.style.left = arrPos[0] + "px";
    popRef.style.top = parseInt(posY+elHt/2)+ "px";
       
        try
        {
            popRef.removeChild(popRef.firstChild);
        }
        catch(e){}
        popRef.appendChild(txtNode);
    }
}

function hidePop()
{
    try 
    {
       var popRef = document.getElementById('feedPop');
       document.body.removeChild(popRef);
       popRef=null;
    } catch(e){}
}

function findPos(obj)
{
    var curleft = curtop = 0;
    if (obj.offsetParent)
    {
        curleft = obj.offsetLeft;
        curtop = obj.offsetTop;
        while (obj = obj.offsetParent)
        {
            curleft += obj.offsetLeft;
            curtop += obj.offsetTop;
        }
    }
    else if(obj.x)curleft+=obj.x;

    if(document.all)
     	curleft-=document.getElementsByTagName("body")[0].offsetLeft;
    
    if(navigator.userAgent.indexOf('Safari')!=-1)
	curleft-=document.getElementsByTagName("body")[0].offsetLeft;

    return [curleft,curtop];
}

function findMousePos(e) {
	var posY = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posY = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posY = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	return posY;
}
// Feed Module Mouse Over Popup Functions - Ends

// Contextual Feed Link Custom Popup
function feeds_subscribe_custom_pop(refEl,rssURL,lang,turnOffReaders)
{
    var myurl_array = new Array('http://feeds.my.aol.com/add.jsp?url=__FEED__',
                                'http://www.bloglines.com/sub/__FEED__',
                                'http://fusion.google.com/add?feedurl=__FEED__',
                                'http://www.newsgator.com/ngs/subscriber/subext.aspx?url=__FEED__',
                                'http://add.my.yahoo.com/content?url=__FEED__',
                                'http://client.pluck.com/pluckit/prompt.aspx?GCID=C12286x053&a=__FEED__');

    var myimg_array = new Array('http://o.aolcdn.com/art/webwidgets/sfsw_v1_1/images/feed-icons/myaol_cta1.gif',
                                'http://o.aolcdn.com/art/webwidgets/sfsw_v1_1/images/feed-icons/sub_modern5.gif',
                                'http://o.aolcdn.com/art/webwidgets/sfsw_v1_1/images/feed-icons/googlereader.gif',
                                'http://o.aolcdn.com/art/webwidgets/sfsw_v1_1/images/feed-icons/ngsub1.gif',
                                'http://o.aolcdn.com/art/webwidgets/sfsw_v1_1/images/feed-icons/addtomyyahoo4.gif',
                                'http://o.aolcdn.com/art/webwidgets/sfsw_v1_1/images/feed-icons/pluckit.gif');

    var mytxt_array = new Array('Subscribe via MyAOL',
                                'Subscribe via Bloglines',
                                'Subscribe via Google Reader',
                                'Subscribe via NewsGator',
                                'Subscribe via Yahoo Reader',
                                'Subscribe via Pluck');

	if ( lang == 'es' ) {
        var mytxt_array = new Array('Suscribirse v\u00eda MyAOL',
                                'Suscribirse v\u00eda Bloglines',
                                'Suscribirse v\u00eda Google Reader',
                                'Suscribirse v\u00eda NewsGator',
                                'Suscribirse v\u00eda Yahoo Reader',
                                'Suscribirse v\u00eda Pluck');
    }

    var myread_array = new Array('rss_myaol',
                                'rss_sub',
                                'rss_google',
                                'rss_ng',
                                'rss_yahoo',
                                'rss_pluck');

    var mycfl_readers = {};
    var temp_obj = {};
    for (i=0; i<6; i++)
    {
        if ( turnOffReaders.indexOf(myread_array[i]) == -1 ) {
            temp_obj.temp_element = {
                    url:  myurl_array[i],
                    img:  myimg_array[i],
                    text: mytxt_array[i]
            };
            eval("mycfl_readers.mycflreader_"+i+"=temp_obj.temp_element;");
        }
    }
    aol_feeds_subscribe.setReaders(mycfl_readers);
    aol_feeds_subscribe.setText(aol_feeds_subscribe.Text);
    var popup = aol_feeds_subscribe.show(refEl, null, rssURL);
    aol_feeds_subscribe.setReaders(aol_feeds_subscribe.Readers);
}
// Contextual Feed Link Custom Popup - Ends

// CrossPromo module functionality
var arrLen = 0;
var modSpan = 6;
var currId = 0;

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);
}