function Request(strName,strHref)
{
var intPos = strHref.indexOf("?");
var strRight = strHref.substr(intPos + 1); 
var arrTmp = strRight.split("&");
    for(var i = 0; i < arrTmp.length; i++)
    {
    var arrTemp = arrTmp[i].split("=");

    if(arrTemp[0].toUpperCase() == strName.toUpperCase()) return arrTemp[1];
    }
return "";
}

function regname()
{
	var strHref = parent.location.href;
	
	var fromhost = Request('fromhost',strHref);
	
	if(fromhost != "")
	{	
		var regUrl = "http://reg.hexun.com/regname.aspx?fromhost="+fromhost+"&";
	}
	else
	{
		var regUrl = "http://reg.hexun.com/regname.aspx?";	
	}
	regUrl+= 'urlReferrerhost=<%=Server.UrlEncode(urlReferrerhost)%>';
	//alert(regUrl);
	window.open (regUrl,"newwindow")
}

function CheckLoginForm()
{
	if(document.LoginForm.username.value=='')
	{
		alert('ÇëÌîÐ´ÓÃ»§Ãû£¡');
		document.LoginForm.username.focus();
		return false;
	}
	else if(document.LoginForm.password.value=='')
	{
		alert('ÇëÌîÐ´ÃÜÂë£¡');
		document.LoginForm.password.focus();
		return false;
	}
	document.getElementById("gourl").value = 'http://rss.hexun.com/';  //parent.location.href;	 
	//alert(document.getElementById("gourl").value);
	document.LoginForm.submit();
}

function getCookie(name) 
{ 
	var prefix = name + "=" 
	var cookieStartIndex = document.cookie.indexOf(prefix) 
	if (cookieStartIndex == -1) 
	 	return null 
	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length) 
	if (cookieEndIndex == -1) 
	 	cookieEndIndex = document.cookie.length 
	return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex)) 
}

function SetCookie(sName, sValue)
{
	var expdate = new Date();
	expdate.setTime (expdate.getTime() + (86400 * 1000 * 31*12));
	var curCookie = sName + "=" + escape(sValue) + "; expires=" + expdate.toGMTString() + 
	"; path=/" + 
	"; domain=rss.hexun.com"
	document.cookie = curCookie ;
}

function DelCookie(sName)
{
	var expdate = new Date();
	expdate.setTime (expdate.getTime() -1);
	var curCookie = sName + "=0; expires=" + expdate.toGMTString() + 
	"; path=/" + 
	"; domain=rss.hexun.com"
	document.cookie = curCookie ;
}	
		
function fnLoad()
{
var ck = getCookie('scrollTop') ;
if(ck)
	{
		document.body.scrollTop = ck;
		DelCookie('scrollTop');											
	}	

}

function SetPosition()
{
	SetCookie("scrollTop", document.body.scrollTop);	
}

window.onload = fnLoad;
var curtime =new Date().getTime();	


function SetPosition()
{
    SetCookie("scrollTop", document.body.scrollTop);	
}

function sectionClick()
{/*{{{*/
    httpReq = crtHttpReqest();
    if(httpReq)
    {
        try
        {
            httpReq.open("GET", url, true);
            httpReq.send(null);
        }
        catch(e)
        {
        }
    }
}/*}}}*/


function crtHttpReqest()
{/*{{{*/
    var xmlHttp = false;
    try 
    {
        xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    } 
    catch (e) 
    {
        try 
        {
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e2) {
            xmlHttp = false;
        }
    }

    if (!xmlHttp && typeof XMLHttpRequest != 'undefined') 
        xmlHttp = new XMLHttpRequest();
    return xmlHttp;
}/*}}}*/



////////////////////////////////////////////////////////////////////////////


var x =new Date().getTime();

//var x = h -curtime;

function GotoLogin()
{
	parent.document.location.href='/?gourl=<%=HttpUtility.UrlEncode("http://rss.hexun.com"+Request.RawUrl,Encoding.GetEncoding("gb2312"))%>';
}


/////////////////////////////////////////////////////////////////////////////

function showLay(divId)
        {
        var objDiv = eval(divId);
        tagID = divId.substring(5);
        //var cookieName = "u_"+userID+"t_"+tagID;
        var cookieName = "u_"+userID;
        var isDisplay = 1;
        
        if (objDiv.style.display=="none")
             {
				
                eval("img1"+divId+".innerHTML='<img border=0 src=/img/folder.gif>'");
                //eval("img2"+divId+".innerHTML='<img border=0 src=/imgs/folderopen.gif>'");
                //document.getElementById("sp"+divId).innerHTML=document.getElementById("sp"+divId).innerHTML.replace("icon2.gif","icon1.gif").replace("folderclosed","folderopen");
                objDiv.style.display="";
             }
        else
        {
				isDisplay = 0;
                //eval("sp"+divId+".innerHTML='<img border=0 src=/imgs/icon2.gif><img src=/imgs/folderclosed.gif border=0>'");
                //alert(document.getElementById("sp"+divId).innerHTML);
                eval("img1"+divId+".innerHTML='<img border=0 src=/img/folder_c.gif>'");
                //eval("img2"+divId+".innerHTML='<img border=0 src=/imgs/folderclosed.gif>'");
                //document.getElementById("sp"+divId).innerHTML = document.getElementById("sp"+divId).innerHTML.replace("icon1","icon2").replace("folderopen","folderclosed");
                objDiv.style.display="none";
                //alert(document.getElementById("sp"+divId).innerHTML);
                //alert(objDiv.style.display);
        }
             
            if(isSelf)
            {
				//alert(cookieName);
				var ck = getCookie(cookieName) ;
				
				//alert(ck);
				
				var expdate = new Date();
				
				var UnisDisplay = 0;
				if(isDisplay == 0)
				{
					UnisDisplay = 1;
				}
				
				if(ck)
				{
					if(ck.toLowerCase().indexOf("["+tagID+"="+escape(UnisDisplay)) >= 0)
					{
						ck = ck.replace("["+tagID+"="+escape(UnisDisplay),"["+tagID+"="+escape(isDisplay));						
					}
					else
					{
						 ck = ck + "[" + tagID + "=" + escape(isDisplay) + "]";
					}
					//alert(ck);
					expdate.setTime (expdate.getTime() + (86400 * 1000 * 31*12));
					var curCookie = cookieName + "="+ck+"; expires=" + expdate.toGMTString() + 
						"; path=/" + 
						"; domain=rss.hexun.com"
					document.cookie = curCookie ;
				}
				else
				{
					expdate.setTime (expdate.getTime() + (86400 * 1000 * 31*12));
					var curCookie = cookieName + "=[" + tagID + "=" + escape(isDisplay) + "]; expires=" + expdate.toGMTString() + 
						"; path=/" + 
						"; domain=rss.hexun.com"
					document.cookie = curCookie ;
				}				
			}  
        }	       	