﻿// JScript 文件
function getCookie(name)
{
	var cname = name + "=";
	var dc = document.cookie;
	if (dc.length > 0) 
	{
		begin = dc.indexOf(cname);
		if (begin != -1) 
		{
			begin += cname.length;
			end = dc.indexOf(";", begin);
			if (end == -1) end = dc.length;
			return dc.substring(begin, end);
		}
	}
	return null;
}
function writeCookie(name, value) 
{ 
	var expire = ""; 
	var hours = 365;
	expire = new Date((new Date()).getTime() + hours * 3600000); 
	expire = ";path=/;expires=" + expire.toGMTString(); 
	document.cookie = name + "=" + value + expire; 
}
function addFavorites(id,name)
	{
		var urlid=getCookie("cname");
		if(urlid==null || urlid.indexOf('undefined')!=-1){
			urlid="";
		}
		
		if(urlid.indexOf(''+id+',')==-1)
		{
			urlid=urlid+""+id+",";
			writeCookie("cname", urlid); 
			alert('收藏'+name+'成功'); 
			 Fun_GetPostData(id,'A')
		}
		else
		{
			alert('已添加过该网站');
		} 
		
		
		
	}
	function removeFavorites(id,name)
	{
		var urlid=getCookie("cname");
		if(urlid==null) urlid="";
		
		if(urlid!="")
		{
			urlid=urlid.replace(""+id+",","");
			writeCookie("cname", urlid); 
			alert('取消'+name+'收藏');  
		    Fun_GetPostData(id,'D')
		}	
	}
function Fun_GetPostData(id,cz){
   
	var urlid=getCookie("cname");
	
	if(urlid==null || urlid.indexOf('undefined')!=-1){
			urlid="";
		}
	var url='Favorites.aspx?idstr='+id+'&cz='+cz+'';
	var str = ''; 
	var responsevalue=Fun_PostData(url,str);
	if (responsevalue!='')
	{
	
		document.getElementById("shouc").innerHTML=responsevalue;
	}
	
} /*
 function displayx(div){
  var sdiv=document.getElementById("menus");
    sdiv.style.visibility="visible";
    sdiv.style.top=(div.offsetTop+div.offsetHeight+2);
    sdiv.style.left=(div.offsetLeft+39);
    LoadXmlFileName(div.id);
 }
 */
  function displayx(div){
 
    LoadXmlFileName(div);
 }
 function conceal(div){
     document.getElementById("menus").style.visibility="hidden";
 }
 function menudiv(){
     document.getElementById("menus").style.visibility="visible";
 }

function coloseChl(d){
document.getElementById(d).style.display="none";
}



/*头导航*/
	function selectChl(id)
	{
         var counts = 0;
		if(id=='pID5'||id=='pID6'||id=='pID8'||id=='pID9'||id=='pID10'||id=='pID12'||id=='pID13'||id=='pID14'||id=='howall')
		{
		    document.getElementById("showall").className=""
		    document.getElementById("spID5").className=""
		    document.getElementById("spID6").className=""
		    document.getElementById("spID8").className=""
		    document.getElementById("spID9").className=""
		    document.getElementById("spID10").className=""
		    document.getElementById("spID12").className=""
		    document.getElementById("spID13").className=""
		    document.getElementById("s"+id).className="sel"
        var counts = 0;
		for(var i=0;i<document.all.tags("DIV").length;i++){
		    if(document.all.tags("DIV")[i].className=="content"){
		        if(id!='howall'){
        			
			            document.all.tags("DIV")[i].style.display = 'none';
				        counts++;
			            if(document.all.tags("DIV")[i].id == id.replace('pID','cont')){
				            document.all.tags("DIV")[i].style.display = 'block';
		                }
		           }else{
        		   
		               counts++;
		               document.all.tags("DIV")[i].style.display = 'block';
		           }
		       }
		 }
		
		if(counts <=1){
			location.href = './.?' + id;
			return ;
		}
	}
}
function search4() 
{ 

if(form1.nsns[0].checked){ 
window.open("http://www.baidu.com/baidu?tn=site37021&wd="+form1.key.value,"mspg0"); 
return false; 
} 

if(form1.nsns[1].checked){ 
window.open("http://www.google.com/search?hl=zh-CN&inlang=zh-CN&ie=GB2312&oe=GB2312&q="+form1.key.value,"mspg4"); 
return false; 
}
if(form1.nsns[2].checked){ 
window.open("http://www.soso.com/q?w="+form1.key.value,"mspg10"); 
return false; 
}  
if(form1.nsns[3].checked){ 
window.open("http://search.union.yahoo.com.cn/click/search.htm?fw=union&m=60168&p=1006&name="+form1.key.value,"mspg14"); 
return false; 
} 
if(form1.nsns[4].checked){ 
window.open("http://beta.search.msn.com.cn/results.aspx?cp=936&FORM=FREEWS&q="+form1.key.value,"mspg2"); 
return false; 
} 
if(form1.nsns[5].checked){ 
window.open("http://iask.com/s?k="+form1.key.value,"mspg0"); 
return false; 
} 
if(form1.nsns[6].checked){ 
window.open("http://www.sogou.com/web?query="+form1.key.value,"mspg1"); 
return false; 
} 

if(form1.nsns[7].checked){ 
window.open("http://news.baidu.com/ns?cl=2&rn=20&tn=news&word="+form1.key.value,"mspg9"); 
return false; 
} 


if(form1.nsns[8].checked){ 
window.open("http://image.baidu.com/i?z=&s=1&ct=201326592&cl=2&lm=-1&tn=baiduimage&word="+form1.key.value,"mspg11"); 
return false; 
} 

} 
function GetQueryString(sProp)   

{   

    var re = new RegExp("[&,?]"+sProp + "=([^\\&]*)", "i");   

    var a = re.exec(document.location.search);   

    if (a == null)   

        return "";   

    return a[1];   

}
function logints(){

alert('用户或密码错误!');
}