isLoaded=0;
var divCount = '';
var entInterval;
var activeToolTip = '';
var activeTab = new Array();

function doDrawer (which) {
	drawersArray = new Array ('nbdl_body1','nbdl_body2','nbdl_body3');
	for (i=0; i<drawersArray.length;i++) {
		document.getElementById(drawersArray[i]).style.display = "none";
	}
	document.getElementById("nbdl_body"+which).style.display = "block";
	document.getElementById("nbdl_drawer"+which).style.backgroundColor = "#A8B11C";
}

var activeDrawer = 0;
var mo_colors = new Array(0,"#330000","#330000","#330000");
var n_colors = new Array(0,"#1B2730","#475560","#84939D");

function drawer_handleMouseOver(id) {
	if(activeDrawer == id) return;
	document.getElementById("nbdl_drawer" + id).style.backgroundColor = mo_colors[id];
}

function drawer_handleMouseOut(id) {
	if(activeDrawer == id) return;
	document.getElementById("nbdl_drawer" + id).style.backgroundColor = n_colors[id];
	
}

function drawer_handleClick(id) {
	if(activeDrawer) document.getElementById("nbdl_drawer" + activeDrawer).style.backgroundColor = n_colors[activeDrawer];
	activeDrawer = id;
	document.getElementById("nbdl_drawer" + id).style.backgroundColor = "#A8B11C";
	drawersArray = new Array ('nbdl_body1','nbdl_body2','nbdl_body3');
	for (i=0; i<drawersArray.length;i++) {
		document.getElementById(drawersArray[i]).style.display = "none";
	}
	document.getElementById("nbdl_body"+id).style.display = "block";
	
}

function tabs_handleMouseOver(id,color,instance) {
	if(activeTab[instance] == id) return;
	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+']');
	}
}

function tabs_handleMouseOut(id,instance) {
	if(activeTab[instance] == id) return;
	eval('document.images.img_'+instance+'_' + id + '.src = tabs_off_'+instance+'['+id+']');	
}

function tabs_handleClick(id,color,instance) {
	
	if(activeTab[instance] != id) {
		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+']');
		}
		eval('document.images.img_'+instance+'_' + activeTab[instance] + '.src=tabs_off_'+instance+'[activeTab[instance]]');
	}
	activeTab[instance] = id;
	/* listTableArray = new Array (0,'listtable1_'+instance,'listtable2_'+instance,'listtable3_'+instance,'listtable4_'+instance);
	for (i=1; i<listTableArray.length;i++) {
		if (document.getElementById(listTableArray[i])) document.getElementById(listTableArray[i]).style.display = "none";
	}
	document.getElementById("listtable" + id + '_' + instance).style.display = "block";
	*/
}

function returnScrollDimensions(which) {
	if(which) {
		if(document.body.scrollTop != 0)return document.body.scrollTop;
		if(document.documentElement.scrollTop != 0)return document.documentElement.scrollTop;
	} else {
		if(document.body.scrollLeft != 0)return document.body.scrollLeft;
		if(document.documentElement.scrollLeft != 0)return document.documentElement.scrollLeft;
	}
return 0;
}

var x,y,zInterval;
document.onmousemove = setMouseCoords;

function setMouseCoords(e) {
	if(!isLoaded)return;
	if(document.all) {
		x = window.event.clientX + returnScrollDimensions(0);
		y = window.event.clientY + returnScrollDimensions(1);
	} else {
		x = e.pageX;
		y = e.pageY;
	}
}

function showToolTip(divID) {
	showToolTip2(divID, -140,-10);
}

function showToolTipRight(divID) {
	showToolTip2(divID, 10,-10);
}

function showToolTip2(divID, dx, dy) {
if(activeToolTip==divID) {hideToolTip();}
	else if(activeToolTip!=divID) {
		document.getElementById("toolTip").style.top = (y+dy) + "px";
		document.getElementById("toolTip").style.left = (x+dx) + "px";
		document.getElementById("toolTip").innerHTML = document.getElementById("toolTip_"+divID).innerHTML;
		document.getElementById("toolTip").style.display = "block";
		activeToolTip = divID;
	}
	clearInterval(zInterval);
}

function timeOutToolTip(){
	zInterval = setTimeout("hideToolTip()",100);
}

function hideToolTip() {
	document.getElementById("toolTip").style.display = "none";
	document.getElementById("toolTip").innerHTML = "";
	clearInterval(zInterval);
	activeToolTip = "";
}

function showEntGuide () {
if (document.getElementById("ent_guide")){
clearInterval(entInterval);
document.getElementById("ent_guide").style.display = "block";
}
}

function hideEntGuide () {
	entInterval = setTimeout("document.getElementById(\"ent_guide\").style.display=\"none\"",100);
}

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

function google_ad_request_done(google_ads) {
        var i;
        var sBuf = '';
        var gsl = document.getElementById('sponsoredlink');


        // fix for no data
        if (google_ads.length > 0) {
            sBuf = '<div class=\"sponsoredlinks\">'
                           + '<div class=\"header\"></div>'
                           + '<div class=\"title\"> Sponsored Links:</div>'
                           + '<div class=\"body\">';
        }

        if (google_ads.length > 4)  {
            var goolength = 4;
          }  else {
            var goolength = google_ads.length;
             }


        for(i = 0; i < goolength; ++i) {

            var sDivClass   = 'sponsor';
            var sUrl        = google_ads[i].url;
            var sVisibleUrl = google_ads[i].visible_url;
            var sHeadLine   = google_ads[i].line1;
            var sSubHdLine  = google_ads[i].line2;
            var sBlurb      = google_ads[i].line3;

            trackedSUrl = redirUrl + pathList + modList + spot + sUrl.replace(/&/g,"%26");

            if (i == 0) {
                sDivClass = 'sponsor first';
            }

            // check for the length
            if (iColWidth == 4 && sVisibleUrl.length > 25) {
                sVisibleUrl = sVisibleUrl.substring(0,24);
                sVisibleUrl = sVisibleUrl + '..';
            }



            sBuf += ('<div class=\"box\">'
                       + '<span class=\"headline\">'
                       + sHeadLine
                       + '</span><br>'
                       + sBlurb
                       + '&nbsp;&nbsp;'
                       + sSubHdLine + '<br>'
                       + '<a href='
                       + trackedSUrl + ' target=window>'
                       + sVisibleUrl
                       + '</a><br></div>');


        }

        if (google_ads.length > 0) {
            sBuf += '<div class=\"smalltext\" style=\"clear:both;text-align:right; padding-right:20px;\">'
                           + '<a href=\"http://aolsearch.aol.com/aol/about.jsp#csl\">'
                           + 'What is a Sponsored Link?&nbsp;&nbsp;&nbsp;'
                           + '</a>'
                           + 'Provided by a third party and not endorsed by AOL'
                           + '</div></div></div>';
        } else {
        }
          gsl.innerHTML = sBuf;
    }
