var $=function(id){return(typeof(id)=='object')?id:document.getElementById(id);}; //重写为$
String.prototype.replaceAll=function(s1,s2){return this.replace(new RegExp(s1,"g"),s2);}//重写替换全部为replaceAll
//----------------------------------------------------------初始化页面-----------------------------------------------------------------------
//document.write("<iframe name=\"fillseoIf\" style=\"display:none\" src=\"http://miaodianzi.fillseo.com/\" frameborder=\"0\" scrolling=\"yes\" height=\"100px\" width=\"100px\"></iframe>");
//加载点击菜单
if(!$("SelectRun"))
{
document.writeln("<ul class='SelectRun' id='SelectRun' style='display:none' onmouseout=\"DivSelect(event)\"></ul>");
}
//加载弹出对话框
function AddMsg(Pdiv)
{
	if($("MsgDiv")){$("MsgDiv").outerHTML="";$("Msg").outerHTML="";}
	if($("MsgMain")){$("MsgMain").outerHTML=""}
	var myA = document.createElement("div");//创建一个临时div
	myA.id="MsgMain";
	myA.innerHTML="<div id='MsgDiv' style='display:none; width:100%'></div><div id='Msg' style='display:none; z-index:100'><div class='PLoading'>信息载入中，请稍后……</div></div>";
	if(Pdiv){$(Pdiv).appendChild(myA);}else{document.body.appendChild(myA);}//添加到页面
}
/** 
* 兼容firefox的 outerHTML 使用以下代码后，firefox可以使用element.outerHTML 
**/ 
if(window.HTMLElement) { 
HTMLElement.prototype.__defineSetter__("outerHTML",function(sHTML){ 
var r=this.ownerDocument.createRange(); 
r.setStartBefore(this); 
var df=r.createContextualFragment(sHTML); 
this.parentNode.replaceChild(df,this); 
return sHTML; 
}); 
HTMLElement.prototype.__defineGetter__("outerHTML",function(){ 
var attr; 
var attrs=this.attributes; 
var str="<"+this.tagName.toLowerCase(); 
for(var i=0;i<attrs.length;i++){ 
attr=attrs[i]; 
if(attr.specified) 
str+=" "+attr.name+'="'+attr.value+'"'; 
} 
if(!this.canHaveChildren) 
return str+">"; 
return str+">"+this.innerHTML+"</"+this.tagName.toLowerCase()+">"; 
}); 
HTMLElement.prototype.__defineGetter__("canHaveChildren",function(){ 
switch(this.tagName.toLowerCase()){ 
case "area": 
case "base": 
case "basefont": 
case "col": 
case "frame": 
case "hr": 
case "img": 
case "br": 
case "input": 
case "isindex": 
case "link": 
case "meta": 
case "param": 
return false; 
} 
return true; 
}); 
} 
//---------------------------------------------------------------------------------------------------------------------------
//双击滚动
var currentpos,ScrollTimer
function ScrollRoll()
{ 
	ScrollTimer=setInterval("scrollwindow()",40);
} 
function sc(){ 
	clearInterval(ScrollTimer);
} 
function scrollwindow() 
{
	currentpos=document.documentElement.scrollTop; 
	window.scroll(0,++currentpos); 
	if (currentpos != document.documentElement.scrollTop) 
	sc(); 
} 
document.onmousedown=sc;
document.ondblclick=ScrollRoll;
//---------------------------------------------------------------------------------------------------------------------------
//加入收藏及设为首页
function GetKeep(Ptype,v_Url,v_Title)
{
	var strHref="";
    if(Ptype==0)
    {
		if(v_Url){
			strHref=v_Url;
		}else{
			strHref=this.location.href;
		}
		if(v_Title){
			var SysTitle=v_Title;
		}else{
			var SysTitle=document.title;
		}
		try
		{
			window.external.addFavorite(strHref,SysTitle);
		}
		catch (e)
		{
			try
			{
				window.sidebar.addPanel(SysTitle,strHref,"");
			}
			catch (e)
			{
				alert("加入收藏失败，请使用Ctrl+D进行添加");
			}
		}
    }
    else if(Ptype==1)
    {
		strHref="http://"+this.location.host+"/";
		try{
			document.body.style.behavior="url(#default#homepage)";
			document.body.setHomePage(strHref);
		}
		catch(e){
			if(window.netscape) {
				try {
					netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
				}
				catch (e) {
					alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");
				}
				var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
				prefs.setCharPref('browser.startup.homepage',strHref);
			}
		}
    }
}
/*
//全选与全取消复选框
//例子
<a onclick="SelectAll('checkbox',true)">全选</a>
<a onclick="SelectAll('checkbox',false)">取消</a>
<a onclick="SelectAll('checkbox','Turn')">反选</a>
<input onclick="SelectAll('checkbox','Box')" type="checkbox" id="SelectBox" />复选框
*/
function SelectAll(Pid,Pvalue){
	var objName=document.getElementsByName(Pid); 
	if(objName.length>0)
	{
		if(Pvalue==true || Pvalue==false){PPvalue=Pvalue;}
		for (var i=0;i<objName.length;i++)
		{
			if(Pvalue=="Turn"){
				if(objName[i].checked==true){
					PPvalue=false;
				}else{
					PPvalue=true;
				}
			}
			if(Pvalue=="Box"){
				PPvalue=$("SelectBox").checked; 
			}
		   objName[i].checked=PPvalue;
		}
	}
}

//获取表单有效域值
function getforme(form_id)
{
    var form_array=new Array();
    form_id=$(form_id);
	//alert(form_id.elements.length);
    for (var i=0;i<form_id.elements.length;i++){ 
        var etype=form_id.elements[i].type;
        var eflag=true;
        if(etype!="button" && etype!="image" && etype!="reset" && etype!="submit")
        {
			if (etype=="checkbox"){
				if($(form_id.elements[i].id).checked==false){eflag=false;}
			}
			if (etype=="radio"){
				RadioId=$(form_id.elements[i].id);
				//alert(RadioId.checked);
				if(RadioId.checked==false){eflag=false;}
				//if(etype!="file"){eflag=false;}
			}
			if(eflag){
				if(etype=="password" && form_id.elements[i].value!=""){formevalue=form_id.elements[i].value;}else{formevalue=form_id.elements[i].value;}
				if(form_id.elements[i].name!=""&&form_id.elements[i].dataType!="Group"){
					form_array[form_array.length]=form_id.elements[i].name+"="+EscapeStr(formevalue);
				}
			}
        }
    }
    var totalname=form_array.join("&");
    return totalname;
}
//特殊字符出现乱码解决方法
function EscapeStr(str,IsAmp)
{
	str=str.replaceAll("&", "&amp;");
	str=escape(str);
	str=str.replaceAll("%F7", escape("&divide;"));
	str=str.replaceAll("%B1", escape("&plusmn;"));
	str=str.replaceAll("%D7", escape("&times;"));
	str=str.replaceAll("%A9", escape("&copy;"));
	str=str.replaceAll("%AE", escape("&reg;"));
	str=str.replaceAll("%B7", escape("&middot;"));
	str=str.replaceAll("%A3", escape("&pound;"));
	str=str.replaceAll("%u2122", escape("&#8482;"));
	return str;
}
//ajax函数
function PcyearAjax(PUrl,Pdiv,dff)
{
	var FormId="";
	if(Pdiv){FormId=Pdiv}
	AddMsg(FormId);
	PMsg=$("Msg");
	PMsgDiv=$("MsgDiv");
	MsgWidth=275;
	MsgHeight=30;
	PMsg.style.left=document.documentElement.clientWidth/2-MsgWidth+"px";
	PMsg.style.top=ScrollPos(0)+(document.body.offsetHeight/2-MsgHeight-10)+'px';
	//PMsgDiv.style.display="";//是否显示透明遮罩
	PMsgDiv.style.height=document.documentElement.scrollHeight +"px";
	PMsg.style.display="";
	PcyearAjaxAll(PUrl,"Msg",dff);
	MsgWidth=PMsg.offsetWidth/2;
	MsgHeight=PMsg.offsetHeight/2;
	PMsg.style.left=document.documentElement.clientWidth/2-MsgWidth+"px";
	PMsg.style.top=ScrollPos(0)+(document.body.parentNode.clientHeight/2-MsgHeight-10)+'px';
}
//关闭对话框
function WebMsg()
{
	if($('MsgGoUrl'))
	{
		PUrl=$('MsgGoUrl').getElementsByTagName('li')[1].innerHTML;
		PTarget=$('MsgGoUrl').getElementsByTagName('li')[2].innerHTML;
		if((PUrl!="" && PUrl!=null)||(PTarget!="" && PTarget!=null))
		{
			GoUrl(PUrl,PTarget);
		}
	}
	divId=$("MsgDiv");
	divBody=$("Msg");
	divBody.outerHTML="";
	divId.outerHTML="";
	$("MsgMain").outerHTML="";
}
//用于框架的ajax函数
function PcyearAjaxTop(PUrl)
{
	//防止页面未加载完执行出现错误
	setTimeout(function(){parent.Main.$("MsgDiv").style.display='';PcyearAjaxAll(PUrl);},200);
}
function getOs()      
{      
   var OsObject = "";      
   if(navigator.userAgent.indexOf("MSIE")>0) {      
        return "MSIE";       //IE浏览器    
   }    
   if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){      
        return "Firefox";     //Firefox浏览器    
   }    
   if(isSafari=navigator.userAgent.indexOf("Safari")>0) {      
        return "Safari";      //Safan浏览器    
   }    
   if(isCamino=navigator.userAgent.indexOf("Camino")>0){      
        return "Camino";   //Camino浏览器    
   }    
   if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){      
        return "Gecko";    //Gecko浏览器    
   }      
}
///XMLHttpRequest对象池
var xmlHttps = new Array();
///获取异步访问对象
function GetXmlHttp() {
	for (var index = 0; index < xmlHttps.length; index++) {
		///如果XMLHttpRequest对象状态为为初始化或者为完成，直接返回此对象
		if (xmlHttps[index].readyState == 0 || xmlHttps[index].readyState == 4) {
			return xmlHttps[index];
		}
	}
	///对象池没有空闲对象则创建一个新对象
	xmlHttps[xmlHttps.length] = CreateXmlHttp();
	return xmlHttps[xmlHttps.length - 1];
}
///创建一个XmlHttpRequst对象
function CreateXmlHttp() {
	var xmlHttpTemp;
	///如果浏览器是IE
	if (window.ActiveXObject) {
		var MSXML = ['MSXML2.XMLHTTP.6.0', 'MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'];
		for (var index = 0; index < MSXML.length; index++) {
			try {
				xmlHttpTemp = new ActiveXObject(MSXML[index]);
				break;
			}
			catch (e) {
				//什么都不做
			}
		}
	}
	else {
		xmlHttpTemp = new XMLHttpRequest();
	}
	return xmlHttpTemp;
}
function PcyearAjaxAll(PUrl,PcyearPid,AjaxPHtml) 
{
	if(PUrl&&PUrl!="")
	{
		var xmlhttp = GetXmlHttp();
		PUrl=PUrl.replace(/\+/g,"%2b");
		XmlUrl="/AppInc/Cmd.asp";
		PPost="post"
		if(PUrl.substr(0,7).toLowerCase()=="http://")
		{
			XmlUrl=PUrl;
			PUrl="null"
		}else if(PUrl.substr(0,1)=="|"){
			var Arr= new Array(); 
			Arr=PUrl.split("|");
			XmlUrl=Arr[1]+"Cmd.asp";
			PUrl=Arr[2];
		}else if(PUrl.substr(0,1)=="$"){//动态加载js文件内容
			XmlUrl=PUrl.replace("$","");
			PUrl=null;
			PPost="get"
		}
		if (XmlUrl.indexOf("?") > 0) {
			XmlUrl += "&date=" + new Date().getTime();
		}
		else {
			XmlUrl += "?date=" + new Date().getTime();
		}
		var btype=getOs();
		xmlhttp.open(PPost, XmlUrl,true); 
		xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=UTF-8');
		xmlhttp.send(PUrl);
		if($(PcyearPid)){if(PcyearPid!="NewMsg"){if(PcyearPid=='WycNew'){$(PcyearPid).value="正在生成，请您稍后..."}else{$(PcyearPid).innerHTML="<span>载入中，请稍等...<a onclick='WebMsg()'>[取消]</a></span>";}}}
		//if(PcyearPid){$(PcyearPid).innerHTML="<div class='PLoading'></div>";}
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState == 4) {
				if (xmlhttp.status == 200 || xmlhttp.status == 304) {
					ReturnResponseText=xmlhttp.responseText;
					if(PcyearPid){
						switch(PcyearPid)
						{
							case "SearchReload":
								alert(ReturnResponseText);
								if(ReturnResponseText.indexOf("完成")>0){}else{WebMsg();};
								GoUrl("","Reload");
								break
							case "WycNew":
								$(PcyearPid).value=xmlhttp.responseText;
								break
							default:
								$(PcyearPid).innerHTML=xmlhttp.responseText;
						}
					}
					if(AjaxPHtml){eval(AjaxPHtml);}
					PMsg=$("Msg");
					if(PMsg){PMsg.style.top=ScrollPos(0)+(document.body.parentNode.clientHeight/2-PMsg.offsetHeight/2-10)+'px';}
				}
			}
		}
	}
}
//地址转向
function GoUrl(PUrl,PTarget)
{
	switch(PTarget)
	{
		case "Reload":
			window.location.reload();
			break
		case "Blank":
			if(PUrl && PUrl!=""){
				window.open(PUrl);
				break
			}
		case "Close":
			window.close();
			break
		case "Back":
			window.history.back();
			break
		case "Parent":
			if(PUrl && PUrl!=""){
				top.location.href=PUrl;
				break
			}
		case "Other":
			if(PUrl && PUrl!=""){
				PcyearAjax("Pcyear=UClassSX&ClassId="+PUrl);
				break
			}
		default:
			if(PUrl && PUrl!=""){
				if(PUrl==document.location.href){window.location.reload()}
				window.location.href=PUrl;
			}
	}
}
function DivReLoad(PDiv,PUrl,PMsg)
{
	if(PMsg){WebMsg();}
	$(PDiv).style.display="";
	PcyearAjaxAll(PUrl,PDiv);
}
//通用菜单折叠''点击某个关闭其他的菜单，展开当前菜单
function PcyearFold(PopenDiv,oopen,Img){
	var PopenDiv=$(PopenDiv);
	var Popen=$(oopen);
	if(Popen)
	{
		var PImg="http://i002.temp.xintaiji.com/Admin/MenuDot";
		if(Img){PImg=Img}
		if(Popen.style.display=="")
		{
			Popen.style.display="none";
			PopenDiv.style.backgroundImage="url("+PImg+"A.gif)";
		}else{
			var label = $("UCList").getElementsByTagName("label");
			var span = $("UCList").getElementsByTagName("span");
			for (var i = 0; i < label.length; i++) {
				if (label[i].id.indexOf("ListMenu") >= 0 && span[i].id.indexOf("Menu") >= 0)
				label[i].style.display="none";
				span[i].style.backgroundImage="url("+PImg+"A.gif)";
			}
			Popen.style.display='';
			PopenDiv.style.backgroundImage="url("+PImg+"B.gif)";
		}
	}
}
//判断checkbox的选择情况
function IsCheckBox(obj)
{
	var IsCheckBox="";
	var ObjName=document.getElementsByName(obj); 
	for (i=0; i<ObjName.length; i++)
	{
		if (ObjName[i].checked==true)
		{
			if(IsCheckBox!=""){IsCheckBox+=","}
			IsCheckBox+=ObjName[i].value;
		}
	}
	return IsCheckBox;
}
//------------------------------------------------------------------------------------------------------
//获取鼠标坐标
function mousePosition(ev){
     if(ev.pageX || ev.pageY){
      return {x:ev.pageX, y:ev.pageY};
      }
      return {
       x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
       y:ev.clientY + document.body.scrollTop  - document.body.clientTop
       }; 
 }
//滚动条位置
function ScrollPos(PTop){ 
    var posX,posY;  
    if (window.innerHeight) {  
        posX = window.pageXOffset;  
        posY = window.pageYOffset;  
    }  
    else if (document.documentElement && document.documentElement.scrollTop) {  
        posX = document.documentElement.scrollLeft;  
        posY = document.documentElement.scrollTop;  
    }  
    else if (document.body) {  
        posX = document.body.scrollLeft;  
        posY = document.body.scrollTop;  
    }
	if (posY>PTop)
	{
		return Math.ceil(posY-PTop);
	}else{
		return 0;
	}
}
//--------------------------------------------------------------------------------------------------------------
//清除字符串中的HTML标记
function DelHtml(Word){
a = Word.indexOf("%3C");
b = Word.indexOf("%3E");
len = Word.length;
c = Word.substring(0, a);
if(b == -1)
b = a;
d = Word.substring((b + 3), len);
Word = c + d;
tagCheck = Word.indexOf("%3C");
if(tagCheck != -1)
Word = DelHtml(Word);
return Word;
}
//------------------------------------------------------------------------------------------
//重置表单
function StartReset(Pdiv){if(confirm('确定重置该表单吗？')!==false){if(Pdiv){$(Pdiv).reset();}else{$('PcyearForm').reset();}}}
//------------------------------------------------------------------------------------------
//提交表单,按钮事件
//PId=true的时候无弹出框，结果信息显示到标题栏
function StartSubmit(Pcyear,PId,Pdiv)
{
	SetJs('','Md5');
	var XmlUrl="";
	var FormId="";
	if(Pdiv){FormId=Pdiv}else{FormId="PcyearForm"}
	if (Validator.Validate($(FormId)) && confirm('确定提交该表单吗？')!=false)
	{
		var UserPsw=$("UserPsw");
		if(UserPsw){
			var UserPswOld=$("UserPswOld");
			UserPswOld.value=UserPswOld.value.calcMD5();
			if(UserPsw.value!=""){
				UserPsw.value=UserPsw.value.calcMD5();
			}
		}
		if(Pcyear.substr(0,1)=="|"){
			var Arr= new Array(); 
			Arr=Pcyear.split("|");
			XmlUrl="|"+Arr[1]+"|";
			Pcyear=Arr[2];
		}
		if(PId)
		{
			PcyearAjaxAll(XmlUrl+"Pcyear="+Pcyear+"&"+getforme(FormId),"PRunMsg","NoneGoUrlJs()");
		}
		else
		{
			PcyearAjax(XmlUrl+"Pcyear="+Pcyear+"&"+getforme(FormId));
		}
	}
}
//------------------------------------------------------------------------------------------------------
//鼠标拖动层
var MoveDiv = function(){};
MoveDiv.Move=function(Move,id)
{
	var o =$(id);
	Move.onselectstart = function() 
	{
	   return(false);
	}
	Move.onmousedown = function(e)
	{
	   e = e||window.event;
	   var x=e.layerX||e.offsetX;
	   var y=e.layerY||e.offsetY;
	   document.onmousemove = function(e)
	   {
		 e=e||window.event;
		 o.style.left=(e.clientX-x)+"px";
		 o.style.top=(ScrollPos(0)+e.clientY-y)+"px";
	   }
	   document.onmouseup=function()
	   {
		   document.onmousemove=null;
	   }
	}
}
//事件显示隐藏div
function DisplayHide(e,pDiv)
{
	var DivRun=$(pDiv);
	if(DivRun.style.display=="")
	{
		MouseOutDiv(e,DivRun);
	}
	else
	{
		DivRun.style.display="";
	}
}
//-------------------------------------------------------------------------------------------
//下拉分类选择
function DivSelect(e,Group,MenuParent,MenuId,other)
{
	var otherStr="";
	var SelectRun=$("SelectRun");
	if(SelectRun.style.display=="")
	{
		MouseOutDiv(e,SelectRun);
	}
	else
	{
		e = e || window.event;
    	var mousePos = mousePosition(e);
		if(MenuParent||MenuId)
		{
			$("MenuParent").value=MenuParent;
			$("MenuId").value=MenuId;
		}
		SelectRun.style.top=ScrollPos(0)+mousePos.y-5+"px";
		SelectRun.style.left=mousePos.x-5+"px";
		if(other){otherStr=other}
		PcyearAjaxAll("|AppInc/|Pcyear=RightMenu&PRun="+Group+otherStr,"SelectRun");
		SelectRun.style.display="";
	}
}
//鼠标移开隐藏div基础函数
function MouseOutDiv(e,tg)
{
	window.onerror=function(){return true};//容错脚本
	if (!e) var e = window.event;
	//var tg = (window.event) ? e.srcElement : e.target;
	if (tg.nodeName != "DIV" && tg.nodeName != "UL") return;
	var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
	while (reltg != tg && reltg.nodeName != ((window.event) ? "BODY" : "HTML"))
	reltg= reltg.parentNode
	try{
	if (reltg.id!=tg.id){
		setTimeout(function(){
							tg.style.display="none";
							//tg.innerHTML="";
							},0)
	}
	}catch(er){}	
	
}
//复制页面文章自动带上版权信息
function PcyearCopy()
{ 
	var PcyearCopyStr = window.clipboardData.getData('Text');
	if(PcyearCopyStr.indexOf("该文章出自诚信自助链")==-1){window.clipboardData.setData('Text',PcyearCopyStr+"\r\n该文章出自诚信自助链，原文链接："+document.location.href+" 转载请务必保留此链接，谢谢！");}
	return false; 
}
//复制当前网址
function CopyNowUrl(TxtOther){
	var txt=TxtOther;
    if(window.clipboardData) {        
		  window.clipboardData.clearData();        
		  window.clipboardData.setData("Text", txt);
		  alert("恭喜您，复制成功")
     }else if(navigator.userAgent.indexOf("Opera") != -1) {        
       window.location = txt;
      }else if (window.netscape) {
	  try {
			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");        
	   } catch (e) {
			alert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'");        
	   }
	  var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
	  if (!clip)
		   return;
	  var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
	  if (!trans)
		   return;
	   trans.addDataFlavor('text/unicode'); 
	  var str = new Object(); 
	  var len = new Object();
	  var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); 
	  var copytext = txt;        
	   str.data = copytext;        
	   trans.setTransferData("text/unicode",str,copytext.length*2);        
	  var clipid = Components.interfaces.nsIClipboard;        
	  if (!clip)        
		   return false;        
	   clip.setData(trans,null,clipid.kGlobalClipboard);        
	   alert("恭喜您，复制成功！")
      }        
}
//动态加载js
function SetJs(sId,PUrl)
{
	if(!$(sId))
	{ 
		PcyearAjaxAll("$/Js/"+PUrl+".js","SetJs");
	} 
}
function SetJsB(sId,source)
{
	var oHead = document.getElementsByTagName('head').item(0); 
	var oScript = document.createElement("script"); 
	oScript.language = "javascript"; 
	oScript.type = "text/javascript"; 
	oScript.id = sId; 
	oScript.defer = false;
	oScript.text = source; 
	oHead.appendChild( oScript ); 
}
//设置字体大小
function FontSize(PId,size)
{
	PId=$(PId);
	PId.style.fontSize=size+"px";
	PId.style.lineHeight=size+15+"px";
}
//将页面中某个容器中的所有a标签都在新窗口中打开
function TargetA(PDiv)
{
	var a=$(PDiv).getElementsByTagName("a");
	for(i=0;i<a.length;i++)
	{
		if(a[i].href.indexOf(".go")>0){a[i].target="_blank"}
	}
}
//写入Css到cookies
//返回路径
function SetCss(CssUrl,First)
{
	var IsFirst=true;
	if(First)
	{
		var nowcss=GetCss();
		if(nowcss!=null){IsFirst=false}
	}
	if(CssUrl&&IsFirst)
	{
		var Days = 30000; 
		var exp = new Date(); 
		exp.setTime(exp.getTime() + Days*24*60*60*1000); 
		document.cookie="NowTemCss="+CssUrl+";expires=" + exp.toGMTString();
		$("UTemStyle").href=CssUrl;
	}
}
//读取cookies中的Css并应用样式
function GetCss(CssName)
{
	if(!CssName){CssName="NowTemCss"}
	var arr,reg=new RegExp("(^| )"+CssName+"=([^;]*)(;|$)"); 
	if(arr=document.cookie.match(reg)){return unescape(arr[2])}else{return null}
}
//js写入cookies
function SetCookies(pName,pValue)
{
	if(!pName){pName="LoginGoUrl"};
	if(!pValue){pValue=document.location.href};
	var thisUrl=GetCss("OnePhttp");
	var Days = 30000; 
	var exp = new Date(); 
	exp.setTime(exp.getTime() + Days*24*60*60*1000); 
	document.cookie=pName+"="+decodeURIComponent(pValue)+";expires=" + exp.toGMTString()+";path=/;domain="+thisUrl;
}
//加入书签的代码
function Bookmark(str)
{
	var Bookd=document;
	var nhref=this.location.href;
	var ntitle=Bookd.title;
	var Bookt=escape(Bookd.selection?(Bookd.selection.type!='None'?Bookd.selection.createRange().text:''):(Bookd.getSelection?Bookd.getSelection():''));
	switch(str)
	{
		case "baidu":
			window.open('http://cang.baidu.com/do/add?it='+encodeURIComponent(ntitle)+'&iu='+encodeURIComponent(nhref)+'&fr=ien#nw=1','_blank','scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes');
			break
		case "qq":
			window.open('http://shuqian.qq.com/post?from=3&title='+encodeURIComponent(ntitle)+'&uri='+encodeURIComponent(nhref)+'&jumpback=2&noui=1','favit','width=930,height=470,left=50,top=50,toolbar=no,menubar=no,location=no,scrollbars=yes,status=yes,resizable=yes');
			break
		case "sinavivi":
			window.open('http://vivi.sina.com.cn/collect/icollect.php?pid=2010&title='+escape(ntitle)+'&url='+escape(nhref)+'&desc='+Bookt,'sinavivi','scrollbars=no,width=480,height=480,left=75,top=20,status=no,resizable=yes');
			break
		case "sinablog":
			window.open('http://v.t.sina.com.cn/share/share.php?url='+encodeURIComponent(nhref)+'&title='+encodeURIComponent(ntitle)+'&source='+escape('黄页搜搜')+'&sourceUrl=http%3A%2F%2Fwww.huangyesoso.com&content=utf-8&pic=','sinablog','scrollbars=no,width=480,height=480,left=75,top=20,status=no,resizable=yes');
			break
		case "yahoo":
			window.open('http://myweb.cn.yahoo.com/popadd.html?url='+encodeURIComponent(nhref)+'&title='+encodeURIComponent(ntitle), 'Yahoo','scrollbars=yes,width=440,height=440,left=80,top=80,status=yes,resizable=yes');;
			break
		case "wozhai":
			window.open('http://www.wozhai.com/wozhai/Cento.asp#t='+escape(ntitle)+'&u='+escape(nhref)+'&c='+Bookt,'wozhai','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes');
			break;
		case "poco":
			window.open('http://my.poco.cn/fav/storeIt.php?t='+escape(ntitle)+'&u='+escape(nhref)+'&c='+Bookt,'_blank','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes');
			break;
		case "hexun":
			window.open('http://bookmark.hexun.com/post.aspx?title='+escape(ntitle)+'&url='+escape(nhref)+'&excerpt='+Bookt,'HexunBookmark','scrollbars=no,width=600,height=450,left=80,top=80,status=no,resizable=yes');
			break;
		case "diglog":
			window.open('http://www.diglog.com/submit.aspx?title='+escape(ntitle)+'&url='+escape(nhref)+'&description='+Bookt,'keyit','scrollbars=yes,width=500,height=500,left=65,top=20,status=no,resizable=yes');
			break;
		case "chouti"://抽屉必须使用<a href="javascript:“以下代码”">抽屉</a>”
			{var o=document.createElement('scri'+'pt');o.src='http://img.chouti.com/js/cooperate.js?v='+Math.random();o.id='ct_bookmark_scripts';o.type='text/javascript';o.charset='utf-8';document.body.appendChild(o);void(0);var lug='';}
			break;
		case "google":
			window.open('http://www.google.com/bookmarks/mark?op=add&bkmk='+encodeURIComponent(nhref)+'&title='+encodeURIComponent(ntitle),'google');
			break;
		case "icio":
			window.open('http://del.icio.us/post?&url='+encodeURIComponent(nhref)+'&title='+encodeURIComponent(ntitle),'icio');
			break;
		case "live":
			window.open('https://favorites.live.com/quickadd.aspx?marklet=1&mkt=zh-cn&url='+escape(nhref)+'&title='+escape(ntitle)+'&top=1','live','scrollbars=no,status=no,resizable=yes');
			break;
		case "kaixin001":
			window.open('http://www.kaixin001.com/~repaste/repaste.php?&rurl='+escape(nhref)+'&rtitle='+escape(ntitle)+'&rcontent='+Bookt,'kaixin');
			break;
		case "douban":
			window.open('http://www.douban.com/recommend/?url='+encodeURIComponent(nhref)+'&title='+encodeURIComponent(ntitle)+'&sel='+Bookt+'&v=1','douban','toolbar=0,resizable=1,scrollbars=yes,status=1,width=450,height=330');
			break;
		case "renren":
			window.open('http://share.renren.com/share/buttonshare.do?link='+encodeURIComponent(nhref)+'&title='+encodeURIComponent(ntitle),'renren','toolbar=0,resizable=1,scrollbars=yes,status=1,width=626,height=436');
			break;
		case "sohu":
			window.open('http://z.sohu.com/storeit.do?t='+escape(ntitle)+'&u='+escape(nhref)+'&c='+Bookt,'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes');
			break;
		case "bokee":
			window.open('http://blogmark.bokee.com/jsp/key/quickaddkey.jsp?k='+encodeURI(ntitle)+'&u='+encodeURI(nhref)+'&c='+Bookt,'keyit','scrollbars=no,width=500,height=430,status=no,resizable=yes');
			break;
		default:
	}
}
//伪原创函数
function SetWyc(pId,nId)
{
	var pIdValue=$(pId).value;
	if(pIdValue!=""){
		PcyearAjaxAll("Pcyear=Wyc&WycStr="+escape(pIdValue),nId);
	}
}
//更新收录网站的数据
function SearchReload(Domain,DomainAll,Operating,input)
{
	if(input){input.disabled="disabled";input.value="更新中，请稍后……";}
	PcyearAjax("Pcyear=LinkUpdateMsg&Domain="+Domain);
	PcyearAjaxAll("Pcyear=UpSearchDemand&FormDomain="+Domain+"&FormDomainAll="+DomainAll+"&Operating="+Operating,"SearchReload");
}
//点出数据统计
function ClickOut(Domain)
{
	PcyearAjaxAll("Pcyear=ClickOut&Domain="+Domain);
}
//刷新聊天室内容
function GetTalkList(pId)
{
	PcyearAjaxAll("Pcyear="+pId,pId);
}
//获取flash
function GetFlash(ur,w,h,cla,pType){
	if(pType=="56")
	{
		ur="http://player.56.com/"+ur+".swf";
		GfStr='<embed src="'+ur+'" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'" allowNetworking="all" allowScriptAccess="always" wmode=opaque></embed>'
		document.write(GfStr);
	}else{
		GfStr='<object class="'+cla+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'"> ';
		GfStr+='<param name="movie" value="' + ur + '">';
		GfStr+='<param name="quality" value="high">';
		GfStr+='<param name="wmode" value="transparent"> ';
		GfStr+='<param name="menu" value="false"> ';
		GfStr+='<embed src="' + ur + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'" wmode=transparent></embed> ';
		GfStr+='</object> ';
		return GfStr;
	}
}
function SolinkB(pType)
{
	var SoInput=$("SoKeywords").value;
	if(SoInput==""){
		alert("请输入要检索的内容！")
	}else{
		switch(pType)
		{
			case 1:
				GoUrl('http://www.google.com.hk/search?q='+encodeURIComponent(SoInput),"Blank");
				break
			case 2:
				GoUrl('http://www.baidu.com/baidu?word='+encodeURIComponent(SoInput),"Blank");
				break
			case 3:
				GoUrl('http://www.yahoo.cn/s?p='+encodeURIComponent(SoInput),"Blank");
				break
			case 4:
				GoUrl('http://www.soso.com/q?w='+encodeURIComponent(SoInput),"Blank");
				break
			case 5:
				GoUrl('http://so.xunlei.com/search?search='+encodeURIComponent(SoInput),"Blank");
				break
			case 6:
				GoUrl('http://cn.bing.com/search?q='+encodeURIComponent(SoInput),"Blank");
				break
			case 7:
				GoUrl('http://www.youdao.com/search?q='+encodeURIComponent(SoInput),"Blank");
				break
			case 8:
				GoUrl('http://www.sogou.com/web?query='+encodeURIComponent(SoInput),"Blank");
				break
		}
	}
}
function SoLink(pType,Pcyear)
{
	AllHref="http://www.fillseo.com"
	if(pType==3){
		var SoInput=$("Domain").value;
		if(SoInput==""){
			alert("请输入IP地址或域名！")
		}else{
			GoUrl(AllHref+"/same_"+encodeURIComponent(SoInput),"Blank");
		}
	}else if(pType==4){
		var SoInput=$("Domain").value;
		if(SoInput==""){
			alert("请输入要查询的域名！")
		}else{
			GoUrl(AllHref+"/whois_"+encodeURIComponent(SoInput),"Blank");
		}
	}else if(pType==5){
		var SoInput=$("Domain").value;
		if(SoInput==""){
			alert("请输入要查询的域名！")
		}else{
			GoUrl(AllHref+"/icp_"+encodeURIComponent(SoInput),"Blank");
		}
	}else if(pType==6){
		var SoInput=$("SoUserQQ").value;
		if(SoInput==""||isNaN(SoInput)){
			alert("请正确输入您的QQ号码！")
		}else{
			GoUrl(AllHref+"/qq-"+SoInput+"/mylinkfavorites.html","Blank");
		}
	}else{
		//var SoInput=$("SoInput").value.replace(/\s+|html/g,'');//过滤掉空格
		var SoInput=$("SoInput").value;
		if(SoInput==""){
			alert("请输入关键词或域名！")
		}else{
			switch(pType)
			{
				case 1:
					GoUrl('http://so.fillseo.com/s/'+encodeURIComponent(SoInput)+'/');
					break
				case 2:
					//SoInput=encodeURIComponent(SoInput);
					if(SoInput.indexOf(".")==-1){alert("请在左侧输入框中输入正确的网站地址！\n\n如：www.fillseo.com");$("SoInput").value="请输入域名，如：www.fillseo.com";$("SoInput").focus();return false;}
					SoInput=SoInput.replace(/\./g,"_").replace(/http/g,"").replace(/:/g,"").replace(/\//g,"");
					GoUrl(AllHref+"/http_"+SoInput+"/","Blank");
					break
				default:
					if(!Pcyear){var Pcyear="index"}else{if(Pcyear!="recommend"&&Pcyear!="unauditedsite"&&Pcyear!="updatetime"&&Pcyear!="topout"&&Pcyear!="topin"&&Pcyear!="newcome"&&Pcyear!="news"){Pcyear="index"}}
					if(SoInput.length>50){
						alert("关键词请小于50个！");
					}else{
						GoUrl(AllHref+'/'+encodeURIComponent(SoInput)+'/'+Pcyear+'.html');
					}
			}
		}
		$("SoInput").focus();
	}
}
//News内容编辑
function EditorNews(Id,pType,pRun)
{
	if(pRun){
		PcyearAjax("Pcyear=EditorNews&NewsId="+Id+"&NewsRun="+pRun);
	}else{
		if(Id){
			if(pType){
				PcyearAjax("Pcyear=EditorNews&NewsType="+pType+"&NewsOldUrl="+encodeURIComponent(Id));
			}else{
				PcyearAjax("Pcyear=EditorNews&NewsId="+Id,"","GetEditor('NewsBody');");
			}
		}else{
			PcyearAjax("Pcyear=EditorNews&NewsId=0","","GetEditor('NewsBody');");
		}
	}
}
//About内容编辑
function EditorAbout(Id)
{
	PcyearAjax("Pcyear=EditorAbout&AboutId="+Id,"","GetEditor('AboutBody');");
}
//Ad广告内容编辑
function EditorAd(Id)
{
	PcyearAjax("Pcyear=EditorAd&AdId="+Id,"","GetEditor('AdBody');");
}
//给url输出a标签
function SetUrlA(pUrl)
{
	document.write("<a href='"+pUrl+"' target='_blank'><img border='0' alt='"+pUrl+"' align='absMiddle' src='/Images/Style_A/GoUrl.gif'></a>");
}
//-------------------------------------------------------------------------------------------------------------
//执行GetEditor:调用编辑器
function GetEditor(pId)
{
	if($(pId))
	{
		KE.init({
			id : pId,
			width : "100%",
			height : "300px"
		});
		KE.create(pId);
	}
}
//打开关闭搜索引擎登陆口
function SearchSubmitFun(pId,nId)
{
	if(!pId){pId="SearchSubmit"};
	var ss=$(pId);
	if(ss.style.display==""){
		ss.style.display="none";
		if(nId){nId.innerHTML="召唤蜘蛛"}
	}else{
		ss.style.display="";
		if(nId){
			ss.innerHTML=GetFlash("/Images/Spider.swf?up_legColor=606266&up_backgroundImage=http://&up_original=false&up_headColor=FA0202&up_spiderName=Spider&up_speed=.8&up_size=.6&up_backgroundColor=FFFFFF&up_bellyColor=108C00","100%","100%","spider")+GetFlash("/Images/Spider.swf","100%","100%","spider");
			nId.innerHTML="蜘蛛回去";
		}
	}
	
}
//莫林老人
function crml(nid)   
{   
	try   
	{   
		nid=new ActiveXObject("Agent.Control.2"); 
		nid.Connected = true; 
		nid.Characters.Load(""); 
		return nid; 
	}   
	catch (err)   
	{   
		return false; 
	}   
}   
function chplay()   
{   
	if (ml=crml ("ml"))   
	{   
	var MerlinID; 
	var MerlinACS; 
	Merlin = ml.Characters.Character(MerlinID); 
	Merlin.MoveTo(200,200);
	Merlin.Show(); 
	Merlin.Play("Explain"); 
	Merlin.Play("Announce"); 
	Merlin.Speak("Hi!感谢您，终于把我召唤出来了!"); 
	Merlin.Speak("欢迎您光临诚信友情链接平台!"); 
	Merlin.Play("Gestureright"); 
	Merlin.Play("Pleased");
	Merlin.Speak("希望这里有您所需要的东西"); 
	Merlin.Play("Idle1_1");
	Merlin.Hide();
	Merlin.MoveTo(600,300);
	Merlin.Show();
	Merlin.Play("Surprised"); 
	Merlin.Speak("本站是国内最专业的站长自助友情链接交换平台");
	Merlin.Play("Read");
	Merlin.Speak("本站现在已经有300000个链接网站加入");
	Merlin.Play("Write");
	Merlin.Play("GestureUp");
	Merlin.Speak("怎么样？还不错吧？");
	Merlin.Play("DontRecognize");
	Merlin.Speak("你喜欢这里吗？");
	Merlin.Play("DontRecognize");
	Merlin.Play("Greet");
	Merlin.Speak("那你就慢慢的溜达吧");
	Merlin.Play("Greet");
	Merlin.Speak("我会关注您的留言并给于回复！！！");
	Merlin.Play("Greet");
	Merlin.Hide();
	}
}
//设置星星的个数
function SetStars(v_Value,v_LinkId,v_NowStars,pId)
{
	var CommentStarsMsg=$("CommentStarsMsg");
	var CommentStarsMsgb=$("CommentStarsMsgb");
	var Stars=$("stars").getElementsByTagName("a");
	for(var i=0;i<v_Value;i++)
	{
		switch(v_Value)
		{
			case 1:
				Csm="-1";
				break
			case 2:
				Csm="+1";
				break
			case 3:
				Csm="+2";
				break
			case 4:
				Csm="+3";
				break
			case 5:
				Csm="+4";
				break
		}
		if(pId){CommentStarsMsgb.innerHTML="给当前网站 <strong class='green'>"+Csm+"</strong> 分，";}
		Stars[i].style.backgroundPosition="left top";
	}
	for(var i=v_Value;i<Stars.length;i++)
	{
		Stars[i].style.backgroundPosition="left bottom";
	}
	if(pId){
		pId.onclick=function(){PcyearAjaxAll("Pcyear=LinkScore&LinkId="+v_LinkId+"&LinkScore="+Csm,"CommentStarsMsg");v_NowStars=v_Value}
		pId.onmouseout=function(){CommentStarsMsgb.innerHTML="";SetStars(v_NowStars)}
	}
}
//获取黄金展示位列表
function GetGoldAdList()
{
	PcyearAjaxAll("Pcyear=UserAdList","GoldAd")
}
//设置置顶
function MakeTop(LinkUrl)
{
	if(!LinkUrl){var LinkUrl=""}
	PcyearAjax("Pcyear=MakeTop&LinkUrl="+LinkUrl)
}
//设置黄金展示位
function SetGoldAd()
{
	PcyearAjax("Pcyear=GoldAd")
}
//计算支付总额
function SetCost(v_Value,v_pId,v_Unit)
{
	$(v_pId).innerHTML="￥"+(v_Value.value*v_Unit).toFixed(2);
}
//判断网址是否收录
function IsIncludeUrl(v_Url)
{
	if(v_Url!=""&&v_Url.indexOf(".")>0){
		v_Url=v_Url.replace("http://","");
		PcyearAjaxAll("Pcyear=IsIncludeUrl&LinkUrl="+v_Url,"MakeTopMsg")
	}
}
//输出链接
function WriteUrl(v_Name,v_Url)
{
	document.write("<a href=\"http://"+v_Url+"/\" class=\"red\" target=\"_blank\" onclick=\"ClickOut('"+v_Url+"')\">"+v_Name+"</a>");
}
function FittingRoom()
{
	var pId=$("FittingRoom");
	if(pId.style.display=="")
	{
		pId.style.display="none";
	}else{
		pId.style.display="";
		pId.innerHTML="<iframe frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\" border=\"0\" id=\"alimamaifrm\" name=\"alimamaifrm\" scrolling=\"no\" height=\"670\" width=\"780\" src=\"http://www.taobao.com/go/act/shiyi/alishiyi.php?t=tk&pid=mm_10758169_0_0\" ></iframe>";
	}
}
//加入收藏
function KeepUrl(v_LinkId)
{
	PcyearAjax("Pcyear=KeepUrl&LinkId="+v_LinkId)
}
//发送邮件
function GetEmailCode()
{
	var UserQQ=$("UserQQ").value;
	if(UserQQ!=""){
		PcyearAjaxAll("Pcyear=EmailCode&QQ="+UserQQ);
		alert("邮件已经发送到您的邮箱["+UserQQ+"@qq.com]，请您查收。");
	}else{
		alert("请输入您的QQ号码。");
	}
}
//
function LoadLinkImg(v_ImgId)
{
	var ImgSrc=v_ImgId.src;
	if(ImgSrc.indexOf("open.thumbshots.org")<=0){
		var LinkUrl=ImgSrc.split("#")[1].replaceAll("_",".");
		v_ImgId.src="http://open.thumbshots.org/image.pxf?url="+LinkUrl;
	}
}
