function ShowLogin()
{
    var loginLinksLayer = 'loginLinks';
    var loginFieldsLayer = 'loginFields';

    if (document.getElementById(loginLinksLayer).style.display == "block") {
        document.getElementById(loginLinksLayer).style.display = "none";
        document.getElementById(loginFieldsLayer).style.display = "block";
    }
}
function toggleShowLogin()
{
    var loginLinksLayer = 'uloginOut';
    var loginFieldsLayer = 'uloginForm';

    if (document.getElementById(loginLinksLayer).style.display == "block") {
        document.getElementById(loginLinksLayer).style.display = "none";
        document.getElementById(loginFieldsLayer).style.display = "block";
    } else {
        document.getElementById(loginLinksLayer).style.display = "block";
        document.getElementById(loginFieldsLayer).style.display = "none";
    }
}
function goToSeeBenefitsUrl() {
    window.location = 'http://' + location.host + '/1320-20_4-133.html?tag=dhd_why&path=' + urlEncode(location.href);
}
function goToForgotPasswordUrl() {
    window.location = 'http://' + location.host + '/1328-20_4-133.html?tag=dhd_fg&path=' + urlEncode(location.href);
}
function urlEncode(path) {
    if (path.indexOf('%') > -1) {
        return path;
    } else {
        return escape(path);
    }
}

function ShowTab(sTabLayers,sTabs,sImageNameBases,iIndex)
{
    var aTabLayers = sTabLayers.split(",");
    var aTabs = sTabs.split(",");
    var aImageNameBases = sImageNameBases.split(",");
    var i = 0;

    for(i=0;i<aTabLayers.length;i++)
    {
        //turn off all tab sections
        document.getElementById(aTabLayers[i]).style.display = "none";

        //turn off all tabs themselves
        document.getElementById(aTabs[i]).src = "/i/dl/doors/" + aImageNameBases[i] + "_off.gif";
    }

    //display the correct tab section and tab image (according to the arguments passed in to this function)
    var sSectionDivId = aTabLayers[iIndex];
    var sTabImageId = aTabs[iIndex];
    document.getElementById(sSectionDivId).style.display = "block";
    document.getElementById(sTabImageId).src = "/i/dl/doors/" + aImageNameBases[iIndex] + "_on.gif";
}

function MouseOverTab(sTabs, sImageNameBases, iIndex)
{
    var aTabs = sTabs.split(",");
    var aImageNameBases = sImageNameBases.split(",")
    var sTabId = aTabs[iIndex];
    var sTabName = aImageNameBases[iIndex];

    var sImage = document.getElementById(sTabId).src;
    sImage = sImage.substring(sImage.length-6,sImage.length-4)
    if (sImage != "on")
    {
        document.getElementById(sTabId).src = "/i/dl/doors/" + sTabName + "_over.gif";
    }
}

function MouseOutTab(sTabs, sImageNameBases, iIndex)
{
    var aTabs = sTabs.split(",");
    var aImageNameBases = sImageNameBases.split(",")
    var sTabId = aTabs[iIndex];
    var sTabName = aImageNameBases[iIndex];

    var sImage = document.getElementById(sTabId).src;
    sImage = sImage.substring(sImage.length-6,sImage.length-4)
    if (sImage != "on")
    {
        document.getElementById(sTabId).src = "/i/dl/doors/" + sTabName + "_off.gif";
    }
}

function popUp(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=838,height=628');");
}


function openPopup(url, name) {
    popupWin = window.open(url, name, 'scrollbars,resizable,width=480,height=320');
    window.self.name = 'cnetParent';
}

//

function downloadNow(file,redUrl,extUrl) {
    var isIe = (window.navigator.userAgent.toUpperCase().indexOf('MSIE') != -1);
    var isOpera = (window.navigator.userAgent.toUpperCase().indexOf('OPERA') != -1);

    if (isIe && extUrl == 0 && !isOpera) {
        window.open(file,'dlnow','toolbar=0,location=no,directories=0,status=0, scrollbars=no,resizable=0,width=1,height=1,top=0,left=0');
        window.focus();
        location.href = redUrl + '?idl=n';
    } else {
        location.href = redUrl;
    }
}

function dlNow(file,redUrl,extUrl) {
    // skip if external url or old browser
   // if (extUrl == 0 && document.readyState) {
        // first try to download file in same window    
   //     location.href = file;
        // mozilla readyState is always undefined
        // safari readyState is always complete
        // ie readyState is loading -> interactive -> complete
   //     if (document.readyState && document.readyState == 'loading') {
            // possible to detect when download dialog starts
            // check readyState every 250ms and
            // redirect to post download page with initiate download disabled
    //        setTimeout('dlComplete(\'' + redUrl + '%3Fidl=n\')', 250);
    //        return false;
    //    }
    //}
    // not possible to detect when download dialog starts
    // just follow href to post download page and let it initiate the download
    //location.href = redUrl;
    //return true; 
    newDLNow(file,redUrl,extUrl);
    return false;
}	

///

function dlComplete(redUrl) {
    if (document.readyState == 'loading') {
	/*window.onunload=function(){
		//alert("unloading in dlComplete: " + document.readyState);
		//if (document.readyState == 'loading') {		
			// this means the file url is bad
			// redirect to post download page
			redUrl = redUrl.substring(0,redUrl.indexOf('%3Fidl=n'));			
			location.href = redUrl;
		//}
	} */   
        // still loading, check again in 250ms        
        setTimeout('dlComplete(\'' + redUrl + '\')', 100);
    } else {
        // readyState = interactive or complete means download dialog started
        // redirect to post download page with initiate download disabled        
        location.href = redUrl;
    }    
}

function newDLNow(file,redUrl,extUrl) { 
    var isIe = (window.navigator.userAgent.toUpperCase().indexOf('MSIE') != -1);
    var isOpera = (window.navigator.userAgent.toUpperCase().indexOf('OPERA') != -1);   

    if (isIe && extUrl == 0 && !isOpera) 
		{  	
	 		myDLWindow = window.open(file,'_blank','toolbar=0,location=no,directories=0,status=0,scrollbars=no,resizable=0,width=0,height=0,top=0,left=0');               	     
			location.href = redUrl + '?idl=n';                    
    	} 
	else 
		{
    	//alert('this is not ie, is an ext url, or is Opera');
        location.href = redUrl;
    	}    
}

////

//sniffs out Safari
var isSafari=(navigator.userAgent.indexOf('Safari')>=0)?true:false;
if (isSafari == true) {
//alert("Safari");
document.write("<style>#cobr-header #search-bar .search-fields .input-search {float: left; width: 100px; padding: 0; margin: 2px 5px 0 7px;}</style>");
}

/* remainder for front door carousel and panels */
function dbugScripts(baseurl, libs){if(window.location.href.indexOf("jsdebug=true")>0){for(i=0;i<libs.length;i++){document.write("<scri"+"pt src=\""+baseurl+libs[i]+"\" type=\"text/javascript\"></script>");}return true;}return false;}
if(!dbugScripts("http://c18-x-publish1.cnet.com:8100/html/js/redball/global/",["carousel_non_gf.js"])){
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[(function(e){return d[e]})];e=(function(){return'\\w+'});c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('5 Q=2m.24();Q.2o={h:[],s:[],k:[],n:-1,25:0,22:4(3){2.3=2p.28({1y:"P",1r:"29",1x:1U,1z:2b,1k:0,9:"2n",19:"2c",1s:"2l",p:"1B://i.i.K.K/1u.1d/i/1w/c/2e.I",q:"1B://i.i.K.K/1u.1d/i/1w/c/2i.I",z:\'T\',M:2k},3||{});5 6=2;2.s=2.J({f:2.s,C:2.3.1y,w:2.3.9,y:2.3.9+"1C"});2.h=2.J({f:2.h,C:2.3.1r,w:2.3.9,y:2.3.9+"1D"});2.k=2.J({f:2.k,C:2.3.1s,w:2.3.9,y:2.3.9+"1E"});2.12();8(!B.1F){2.3.p=2.3.p.X(".I",".1n");2.3.q=2.3.q.X(".I",".1n")}2.k.j(4(u){$(u).F=6.3.q});2.Y();2.G(2.3.1k);8(2.3.M)2.M();8(2.3.z!=\'T\')2.1o(2.3.z)},1o:4(10){5 6=2;2.h.j(4(b,7){13.1I(b,10,4(){6.g[7].1J({1c:1K});6.1A();8(6.n!=7)6.G(7)})})},12:4(){5 6=2;v=B.1T("1L");v.d=2.3.19;$(2.3.9).1a(v);5 6=2;$A(2.h).j(4(14){v.1a($(14))});2.k.j(4(u){u.F=6.3.p})},J:4(3){8(V 3.f=="R"||3.f.L==0){5 18=B.1e(3.C,3.w);18.j(4(b,7){8(V b.d=="R"||b.d=="")b.d=3.y+7;3.f.1P(b.d)});1Q 3.f}},Y:4(){2.g=[];5 6=2;2.s.j(4(P,7){6.g[7]=17 D.1V(P,{1c:6.3.1z});6.g[7].1b()})},G:4(a){H=2.n;5 6=2;2.g.j(4(D,7){8(7!=a&&D.1j>0)D.1m(1,0);$(6.h[7]).1X("N");$(6.k[7]).F=6.3.q});8(2.g[a].1j<.1Z)2.g[a].1m(0,1);$(2.h[a]).23("N");$(2.k[a]).F=2.3.p;2.n=a},M:4(){2.1t=26(2.1v.27(2),2.3.1x)},1A:4(){2f(2.1t)},1v:4(){H=2.n;a=(H+1>=2.s.L)?0:H+1;2.G(a)},1G:4(){$(\'9\').11="1H"},1b:4(){$(\'9\').11="1M"}};5 15=U;13.1N(4(){15=17 Q({z:\'1R\'});4 S(x){8(m!=x){$(E+x).1f="N";$(t+x).1g.1i="1W";8(m!=U){$(E+m).1f="";$(t+m).1g.1i="T"}m=x}};4 16(1l,1q){1l.20=4(){S(1q);2.2a()}};5 Z="2d";5 E="2g";5 1h="2h";5 t="2j";5 m=U;5 O=$(Z);8(V(O)!="R"){5 o=O.W("1O");5 1p=B.1e(t,1h);1Y(5 x=0;x<o.L;x++){o[x].d=E+x;1p[x].d=t+x;5 l=o[x].W("A");16(l[0],x)}21{8(!(r>=0&&r<o.L)){r=0}}1S(e){r=0};S(r)}});',62,150,'||this|options|function|var|crsl|idx|if|carouselContainer|next|el||id||idArray|slideFx|bubbles||each|bubbleBGImgButtons||activePanel|currentSlide|ts|buttonOnGifSrc|buttonOffGifSrc|startUpPanel|slides|panelName|img|bubbleBoxes|containerSelector||idPrefix|rotateAction||document|elementSelector|fx|tabName|src|showSlide|current|gif|setUpElementIds|com|length|autoplay|on|tabs|slide|CNETcarousel|undefined|ShowTab|none|null|typeof|getElementsByTagName|replace|createFx|tabSetName|action|visibility|createBubbles|Event|bub|testCrsl|SetTabOnClick|new|elements|carouselLinksId|appendChild|hide|duration||getElementsByClassName|className|style|panelSetName|display|now|startIndex|what|custom|png|setupAction|ps|where|bubblesSelector|bubbleButtonBGImgSelector|slideshowInt|cnwk|rotate|fd|slideInterval|slidesSelector|transitionDuration|stop|http|_slide|_bubble|_bblbuttons|all|show|visible|observe|setOptions|100|div|hidden|onDOMReady|LI|push|return|mouseover|catch|createElement|4000|Opacity|block|removeClassName|for|999|onclick|try|initialize|addClassName|create|nextSlide|setInterval|bind|extend|bubble|blur|700|CaroLinks|tabSet|green_button|clearInterval|tab|panelSet|gray_button|panel|true|bbg|Class|Carousel|prototype|Object'.split('|'),0,{}));
}

