// DHTML popup global variable
var hide  = true;
var global_trId = ""
var count = 0;
var firstindex=1;
var secondindex=0;
if(document.all) { 
	firstindex=0;
}

var redirect = 0;
var nav = navigator.userAgent;
if(nav.indexOf("Firefox")!=-1) {
	version = parseFloat(nav.charAt(nav.indexOf("Firefox")+8)+"."+nav.charAt(nav.indexOf("Firefox")+10));
	if (version<1) {
		redirect = 1;
	}
} else if(nav.indexOf("Opera")!=-1){
	version = parseFloat(nav.charAt(nav.indexOf("Opera")+6)+"."+nav.charAt(nav.indexOf("Opera")+8));
	if (version<7.5) {
		redirect = 1;
	}
} else if (nav.indexOf("MSIE")!=-1){
	temp=navigator.appVersion.split("MSIE");
	version=parseFloat(temp[1]);
	if (version<5.5) {
		redirect = 1;
	}
} else if(nav.indexOf("Netscape")!=-1) {
	version = parseFloat(nav.charAt(nav.indexOf("Netscape")+9)+"."+nav.charAt(nav.indexOf("Netscape")+11));
	if(version<7.2) {
		redirect = 1;
	}
}
if(redirect == 1) {
	document.location.href='http://www.aol.com/upgrade.adp';
}

// Make images to force image load into cache
p2 = new Image(); p2.src="http://cdn.digitalcity.com/ch_about/feeds/twisties_closed";
p3 = new Image(); p3.src="http://cdn.digitalcity.com/ch_about/feeds/twisties_open";

function showtwist() {
    var d = document.getElementById('twistBlock');
    var e = document.getElementById('fd_twistBtn');
    if (count == 0) {
        e.firstChild.src = p3.src;
        d.style.display = "inline";
        e.style.padding = "16px 0 0 0";
        count = 1;
    } else {
        hidetwist()
    }
}

function hidetwist() {
    var d = document.getElementById('twistBlock');
    var e = document.getElementById('fd_twistBtn');
    e.firstChild.src = p2.src;
    d.style.display = "none";
    e.style.padding = "16px 0";
    count = 0;
}

/* DHTML popup starts */
function setLyr(obj,wd,url) {
	var lyr = "popBlock";
	var o = document.getElementById('popBlock');
	if(wd=="rss_vertical") {
		document.getElementById('template1').style.display="none";
		document.getElementById('template2').style.display="block";
		document.getElementById('fld1').value = url;
		var listidn = o.getElementsByTagName("LI");
		var oAnch=o.getElementsByTagName("A");
		for(aI=0;aI<listidn.length;aI++) {
			if(listidn[aI].id == "rss_myaol")
				oAnch[aI].href = rss_myaol + url;
			else if(listidn[aI].id == "rss_google")
				oAnch[aI].href = rss_google + url;
			else if(listidn[aI].id == "rss_sub")
				oAnch[aI].href = rss_sub + url;
			else if(listidn[aI].id == "rss_yahoo")
				oAnch[aI].href = rss_yahoo + url;
			else if(listidn[aI].id == "rss_pluck")
				oAnch[aI].href = rss_pluck + url;
			else if(listidn[aI].id == "rss_ng")
				oAnch[aI].href = rss_ng + url;
		}
	} else {
		document.getElementById('template1').style.display="block";
		document.getElementById('template2').style.display="none";
	}

	var newX = findPosX(obj);
	var newY = findPosY(obj);
	if (lyr == 'anchorT') newY -= 50;
	var x = new getObj(lyr);

	if (wd == "vertical") {
		x.style.top = (newY + 30) + 'px';
		x.style.left = (newX - 216) + 'px';
	} else if (wd == "rss_vertical") {
		x.style.top = (newY + 20) + 'px';
		x.style.left = (newX - 270) + 'px';
	} else {
		x.style.top = (newY + 18) + 'px';
		x.style.left = (newX - 130) + 'px';
	}
	o.style.display="block";
}
function rssBtns() {
	var rss = document.getElementById('template2');
	var obj = rss.getElementsByTagName('LI');
	for(g=0; g<obj.length; g++) {
		obj[g].style.display="block";
	}
	for(h=0; h<arguments.length; h++) {
		document.getElementById((arguments[h])).style.display="none";
	}
	return true;
}

function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	} else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	} else if (obj.y) 
		curtop += obj.y;
	return curtop;
}

function getObj(name) {
	if (document.getElementById) {
	   this.obj = document.getElementById(name);
	   this.style = document.getElementById(name).style;
	} else if (document.all) {
	   this.obj = document.all[name];
	   this.style = document.all[name].style;
	} else if (document.layers) {
	   if (document.layers[name]) {
		this.obj = document.layers[name];
		this.style = document.layers[name];
	   } else {
		this.obj = document.layers.anchorT.layers[name];
		this.style = document.layers.anchorT.layers[name];
	   }
	}
}
/* DHTML popup ends */

/* Change the styles of table module */
function fd_DirMod() {
	var o = document.getElementById('treetable');
	var t = o.getElementsByTagName('TABLE');
	for(i=0;i<t.length;i++) {
		if (i>=1)
			t[i].width="100%";
		t[0].style.width="710px";
		t[1].style.width="710px";
		t[i].border="0";
		t[i].cellSpacing="0";
		t[i].cellPadding="0";
		t[0].cellSpacing="2";
		if(i!=0 && document.all) {
			t[i].style.tableLayout="fixed";
		}

		var rowlength = t[i].rows.length;
		for(k=0;k<rowlength;k++) {
			var collength = t[i].rows[k].cells.length;		
			for(j=0;j<collength;j++) {
				if(i>=2) {
					t[i].style.marginTop="-1px";
					t[i].rows[0].cells[j].style.borderTop="#DEDEDE 1px solid";
					t[i].rows[k].cells[1].vAlign="top";
					t[i].rows[k].cells[2].vAlign="top";
					t[i].rows[k].cells[3].hspace="0";
					t[i].rows[k].cells[3].align="center";
					t[i].rows[k].cells[4].align="center";
					//t[i].rows[0].cells[0].innerHTML= " ";
					t[i].rows[0].cells[0].width="132;";
					t[i].rows[0].cells[1].width="210;";
					t[i].rows[0].cells[2].width="210;";
					t[i].rows[0].cells[3].width="50;";
					t[i].rows[0].cells[4].width="52;";
					t[i].rows[k].cells[1].style.fontWeight="bold";
					t[i].rows[k].cells[4].style.fontWeight="bold";
					if (document.all) {
						t[i].rows[0].cells[0].width="98;";
						t[i].rows[0].cells[1].width="196;";
						t[i].rows[0].cells[2].width="200;";
						t[i].rows[0].cells[3].width="62;";
						t[i].rows[0].cells[4].width="50;";
					}
					var detect = navigator.userAgent.toLowerCase();
                    if((detect.indexOf("safari") + 1)) {
                        t[i].rows[0].cells[0].width="100";
						t[i].rows[0].cells[1].width="200";
						t[i].rows[0].cells[2].width="200";
						t[i].rows[0].cells[3].width="50";
						t[i].rows[0].cells[4].width="50";
                    }
				}
				if (!document.all && i==1) {
					t[i].rows[k].cells[j].style.paddingLeft="2px";
					t[i].rows[k].cells[j].style.paddingRight="2px";
				}
			}
		}
	}
}

/* Adds link tag in head section */
function feedAddStylesheet(title, url) {
	var head=document.getElementsByTagName("head")[0];
    var link=document.createElement("link");
    link.setAttribute("href",url);
    link.setAttribute("type","application/rss+xml");
    link.setAttribute("rel","alternate");
    link.setAttribute("title",title);
    head.appendChild(link);
}