/*功能：
 *
 *
 */
var focusColor="2489DB";
/*打开一个窗口，并把窗口置于屏幕的中间
 *url：是目标，winName是窗口的名字
 *width和height分别是窗口的宽度和高度
 *scroll默认为0，即不滚动，滚动则可置为1
 */

function opensetwin(url, winName, width, height,scroll)
{
	if(winName==null||winName=='')winName="123";
	winName=winName+""+new Date().getSeconds(); 
	//alert(new Date().getSeconds());
	if(typeof scroll=="undefined") scroll="0";
	xposition=0; yposition=0;
	if ((parseInt(navigator.appVersion) >= 4 ))
	{
		xposition = (screen.width - width) / 2;
		yposition = (screen.height - height) / 2;
	}
	theproperty= "width=" + width + ","
	+ "status:0,"
	+ "height=" + height + ","
	+ "location=0,"
	+ "menubar=0,"
	+ "resizable=1,"
	+ "scrollbars="+scroll+","
	+ "titlebar=0,"
	+ "toolbar=0,"
	+ "hotkeys=0,"
	+ "screenx=" + xposition + "," //仅适用于Netscape
	+ "screeny=" + yposition + "," //仅适用于Netscape
	+ "left=" + xposition + "," //IE
	+ "top=" + yposition; //IE
	//alert(theproperty);

	return window.open(url,winName,theproperty );
}
function opensetwin_1(url, winName, width, height)
{
	if(winName==null)winName="";
	winName=winName+""+new Date().getSeconds(); 
	if(typeof scroll=="undefined") scroll="0";
	xposition=0; yposition=0;
	if ((parseInt(navigator.appVersion) >= 4 ))
	{
	xposition = (screen.width - width) / 2;
	yposition = (screen.height - height) / 2;
	}
	theproperty= "width=" + width + ","
	+ "height=" + height + ","
	+ "location=1,"
	+ "menubar=1,"
	+ "resizable=1,"
	+ "scrollbars=1,"
	+ "status=1,"
	+ "titlebar=1,"
	+ "toolbar=1,"
	+ "hotkeys=0,"
	+ "screenx=" + xposition + "," //仅适用于Netscape
	+ "screeny=" + yposition + "," //仅适用于Netscape
	+ "left=" + xposition + "," //IE
	+ "top=" + yposition; //IE
	return window.open(url,winName,theproperty );
}
function opensetwin_2(url, winName, width, height)
{
	if(typeof scroll=="undefined") scroll="0";
	xposition=0; yposition=0;
	if ((parseInt(navigator.appVersion) >= 4 ))
	{
		xposition = (screen.width - width) / 2;
		yposition = (screen.height - height) / 2;
	}
	theproperty= "width=" + width + ","
	+ "status:0,"
	+ "height=" + height + ","
	+ "location=0,"
	+ "menubar=0,"
	+ "resizable=0,"
	+ "scrollbars="+scroll+","
	+ "titlebar=0,"
	+ "toolbar=0,"
	+ "hotkeys=0,"
	+ "screenx=" + xposition + "," //仅适用于Netscape
	+ "screeny=" + yposition + "," //仅适用于Netscape
	+ "left=" + xposition + "," //IE
	+ "top=" + yposition; //IE
	//alert(theproperty);

	return window.open(url,winName,theproperty );
}

/*功能：组合指定复选框元素值用,号隔开
 *element是复选框的全部名字，包括form
 *返回的字符串两端没有逗号
 */
function getIds(element)
{
	var strids="";

	if (!eval(element+".length"))
	{
		if (eval(element+".checked"))
		{
			strids=eval(element+".value")+",";
		}

	}
	else
	{

		for(var i=0;i< eval(element+".length");i++)
		{
			if (eval(element+"[i].checked"))
			{
				strids=strids+eval(element+"[i].value")+",";
			}
		}
	}
	if(strids.length>0)
	{
		strids=strids.substring(0,strids.length-1);
	}
	return strids;

}

/*功能：打开一个对话框
 *url:目标url，winName：对话框的名字
 *width和height是对话框的宽度和高度
 *scroll:设置是否有滚动条
 *
 */
function openDialog(url, winName, width, height,scroll)
{
	scroll=scroll==null?"no":scroll;
	theproperty="dialogwidth:" + width + "px;" + "dialogHeight:"+height+
				"px;help:no;status:no;scroll:"+scroll;
	var opensetwin = showModalDialog(url,winName,theproperty);
}

/*功能：检查是否有选择数据，即是否选择相关复选框
 *form是checkbox所在的form，name是checkbox的名字
 *返回：true是有选择，至少一条，否则false则是一条也没有选取或者
 *checkbox不存在
 */
function checkselect(form,name)
{
	if(form==null) form=document.main;
	if(name==null) name="ID";
	return ifSelectChk(form,name);
}
function ifSelectChk(form,name)
{
	if(form==null) form=document.main;
	if(name==null) name="ID";

    var ifcheck=false;
	var ifexit=false;

	var ifnull="";
	var inputList = form.getElementsByTagName("input");
	for(var i=0;i<inputList.length;i++)
	{
		var aInput = inputList[i];
		if(aInput.getAttribute("type")=="checkbox")
		{
			 if(aInput.getAttribute("name")==name)
			 {
				 ifexit=true;
			 }
		}
	}

	if(ifexit)
	{

		if (form.ID.length==undefined)
		{
			if (form.ID.checked==true){ifcheck=true;}

		}else{

			for(var i=0;i<form.ID.length;i++)
			{
				if (form.ID[i].checked==true){ifcheck=true;}
			}
		}
	}
	else
	{
		ifcheck=false;
	}

	return ifcheck;

}


function myConfirm(value,trueValue,action)
{
	if(value==trueValue)
	{
		return confirm("内容有变化，确定要"+action+"？");
	}
	else
	{
		return true;
	}
}
function changePic(objPic,ysn)
{
	objPic.src="/SrvCreateImage?ysn="+ysn+"&testbuff="+new Date().getSeconds();
	try{document.forms[0].yanzhengma.value='';document.forms[0].yanzhengma.focus();}catch(e){}
}
//对入参进行去除前导空格
function trimN(str)
{
	if(str==null || str=='')return '';
	str=trim(str);
	var newstr="";
	for(var i=0;i<str.length;i++)
	{
		if(str.substring(i,i+1)=="\r" || str.substring(i,i+1)=="\n")
		{}else{
			newstr+=str.substring(i,i+1)
		}
	}
	return trim(newstr);
}
//对入参进行去除前导空格
function ltrim(str)
{
	if(str==null || str=='')return '';
	var newstr="";
	for(var i=0;i<str.length;i++)
	{
		if(str.substring(i,i+1)==" " || str.substring(i,i+1)=="\r" || str.substring(i,i+1)=="\n"){
			continue;
		}else{
			newstr=str.substring(i);
			break;
		}
	}
	return newstr;
}
//对入参进行去除后导空格
function rtrim(str)
{
	if(str==null || str=='')return '';
	var newstr="";
	for(var i=str.length-1;i>=0;i--)
	{
		if(str.substring(i,i+1)==" " || str.substring(i,i+1)=="\r" || str.substring(i,i+1)=="\n")
		{
			continue;
		}
		else
		{
			newstr=str.substring(0,i+1);
			break;
		}
	}
	return newstr;
}
//对入参进行去除前导后导空格  
function trim(str)
{
	return ltrim(rtrim(str));
}
//函数名：chkMoneys
//功能介绍：检查是否为有小数位数字
//参数说明：要检查的数字，总位长，小数位长
//返回值：1为是数字，0为不是数字
function chkFloat(NUM,tL,fL) {
  var v=NUM.length;
  var f=NUM.indexOf(".");
  if(f==-1 ) {//没小数
	if(v<=(tL-fL))
	  return 1;
	else 
	  return 0;
  } else {//有小数
    if((v-f-1)>fL) {//若小数位大与指定的小数位长
	  return 0;
	}
	if(f>(tL-fL)) return 0;
	if(v<=(tL+1)) return 1;
	else return 0;

  }
}

function trimComma(str)
{
	if(str!=null)
	{
		if(str.length>0 && str.substring(0,1)==(","))
			str=str.substring(1);
		if(str.length>0 && str.substring(str.length-1)==(","))
			str=str.substring(0,str.length-1);
	}
	else{str='';}
	return str;
}

function myonmouseover(obj)
{
	obj.style.backgroundColor=focusColor;
	//obj.bordercolor="#F26522";
	//obj.border=1;
	obj.style.border="1px solid";// #f0c895";
}
function myonmouseout(obj)
{
	obj.style.backgroundColor='';
	//obj.border=0;
	//obj.bordercolor="FA9452";
	obj.style.border="0";
}
function myonmouseover1(obj)
{
	obj.style.backgroundColor="D2D0D0";
	//obj.style.backgroundColor="FFFFFF";
	//obj.bordercolor="#F26522";
	//obj.border=1;
	//obj.style.border="1px solid";// #f0c895";
}
function myonmouseout1(obj)
{
	obj.style.backgroundColor='';
	//obj.border=0;
	//obj.bordercolor="FA9452";
	//obj.style.border="0";
}
//单页全部选取函数//
function checkOnePageAll(form,chkOnePageAll,chkOneName)
{
  for (var i=0;i<form.elements.length;i++)
    {
		var e = form.elements[i];
		if (e.name == chkOneName)
		{
		   e.checked = eval("form."+chkOnePageAll).checked;
		   e.onclick(e);
		}
    }
}

function addIds(obj,formName)
{
	if(formName==null)formName="main";
	var form=eval("document."+formName);
	//alert(document.main.idsnum.value);
	var checked=obj.checked;
	var id=obj.value;
	var idss=form.ids.value;
	if(idss!=null && idss.length>0 && idss.substring(idss.length-1)!=",")idss+=",";

	//alert(checked+" "+ids);
	var idx=idss.indexOf(id+",");
	//alert(idx+" "+idx);
	if(idx>=0)
	{
		if(!checked)
		{
			var idss1=idss.substring(0,idx);
			var idss2=idss.substring(idx);
			idss2=idss2.substring(idss2.indexOf(','));
			if(idss2==',')idss2='';
			else idss2=idss2.substring(1);
			idss=idss1+idss2;
			form.idsnum.value=parseInt(form.idsnum.value,10)-1;
		}
	}
	else
	{
		if(checked)
		{
			idss=idss+id+",";
			form.idsnum.value=parseInt(form.idsnum.value,10)+1;
		}
	}
	form.ids.value=idss;
	//alert("共选择了 "+form.idsnum.value+" 条记录，ids："+form.ids.value);
	//alert("ids="+form.ids.value+":qx="+form.qx.value+":idsnum="+form.idsnum.value);
}

function focusWindow(win,win1,win2,win3,win4)
{
	if(win!=null && !win.closed)
	{
		win.focus();
	}
	if(win1!=null && !win1.closed)
	{
		win1.focus();
	}
	if(win2!=null && !win2.closed)
	{
		win2.focus();
	}
	if(win3!=null && !win3.closed)
	{
		win3.focus();
	}
	if(win4!=null && !win4.closed)
	{
		win4.focus();
	}
}
function closeWindow(win,win1,win2,win3,win4)
{
	if(win!=null && !win.closed)
	{
		win.close();
	}
	if(win1!=null && !win1.closed)
	{
		win1.close();
	}
	if(win2!=null && !win2.closed)
	{
		win2.close();
	}
	if(win3!=null && !win3.closed)
	{
		win3.close();
	}
	if(win4!=null && !win4.closed)
	{
		win4.close();
	}
}

//删除操作
//haveRowObj.value表示没有记录为"no"
function doDelete(haveRowObj,idsNumObj,qxObj,form,action,isHaveChkRow,isSelf,fromModule){
	if(!fromModule){fromModule="namecard";}
	if(isSelf==null || isSelf==''){isSelf='y';}
	if(isHaveChkRow==null)isHaveChkRow=true;
	//alert(idsNumObj.value);
	var val = "yes";
	var IsUn=true;
	if(haveRowObj){
		val=haveRowObj.value;
		IsUn=false;
	}
	if (val=="no")
	{
		alert("对不起，没有记录，不能删除!");
		return;
	}
	if(!IsUn && parseInt(idsNumObj.value,10)<=0  && qxObj.value!="1"){
		alert("请选择记录！");
		return ;
	}else{
		var bb="";
		if(isHaveChkRow && !checkselect(form))
		{
			bb="已在其他页面";
		}else{
			bb="共";
		}
		if(IsUn){
			bb="您选择了 1 条记录";
		}else{
			bb="您"+bb+"选择了 "+idsNumObj.value+" 条记录";
		}
		if(!IsUn && qxObj.value=="1")bb="您选择了全部记录";
		bb=bb+"，真的要删除吗？";
		if(isHaveChkRow==false)bb="确定要删除所选信息吗？";
		if(fromModule=="namecard"){
			bb+="\n\n注意：\n同步后删除通讯录，下一次同步将会删除客户端手机相应的通讯录！";
		}
		if(confirm(bb))
		{
			form.action=action;
			if(isSelf=='y'){
				form.target = "_self";
			}else{
				form.target = "_blank";
			}
			form.submit();
		}
	}
}
function ifSelectRow(strAction,haveRowObj,idsnumObj,qxObj)
{
	if (haveRowObj.Value=="no")
	{
		alert("对不起，没有记录，不能"+strAction+"！");
		return false;
	}
	if(parseInt(idsnumObj.value,10)<=0  && qxObj.value!="1"){
		alert("请选择记录！");
		return false;
	}else{
		return true;
	}
}
function myQx(idsObj,idsNumObj,qxObj,btnSelectallObj,IDObj,btnOnePageAllObj)
{
	idsObj.value='';
	idsNumObj.value='0';
	var qx=qxObj;
	//alert(qx.value);
	var btnSelectall=btnSelectallObj;
	var id=IDObj;
	button_ID=btnOnePageAllObj;
	var idchecked="";
	var iddisabled="";
	if(qx.value=="0")
	{
		btnSelectall.value="取消全选";
		button_ID.checked="checked";
		button_ID.disabled=true;
		idchecked="checked";
		iddisabled="disabled";
		qx.value="1";
	}
	else if(qx.value=="1")
	{
		btnSelectall.value="点击全选";
		button_ID.checked="";
		button_ID.disabled=false;
		qx.value="0";
	}

	//alert(rowNum);
	if(rowNum>1)
	{
		for(var i=0;i<id.length;i++)
		{
			id[i].checked=idchecked;
			id[i].disabled=iddisabled;
		}
	}
	if(rowNum==1)
	{
		id.checked=idchecked;
		id.disabled=iddisabled;
	}
}
function myQx1(idsObj,idsNumObj,qxObj,IDObj,chkPageQXObj)
{
	idsObj.value='';
	idsNumObj.value='0';
	var qx=qxObj;
	//alert(qx.value);
	var id=IDObj;
	button_ID=chkPageQXObj;
	var idchecked="";
	if(qx.value=="0")
	{
		idchecked="checked";
		qx.value="1";
	}
	else if(qx.value=="1")
	{
		qx.value="0";
	}

	//alert(rowNum);
	if(document.f1.rownum.value>1)
	{
		for(var i=0;i<id.length;i++)
		{
			id[i].checked=idchecked;
		}
	}
	if(document.f1.rownum.value==1)
	{
		id.checked=idchecked;
	}
}

function deleteEndChar(str,c)
{
	if(c==null || c=='')c=',';

	if(str!=null && str!='' && str.substring(str.length-1)==c)
	{
		str=str.substring(0,str.length-1);
	}
	return str;
}

function deleteSameStr(str,sp)
{
	if(isMyNull(str))return str;
	if(isMyNull(sp))sp=",";

	arrBuff=new Array();
	arrBuff=str.split(sp);
	str="";
	var j;
	var isExist=false;
	if(arrBuff!=null)
	{
		for(var i=0;i<arrBuff.length;i++)
		{
			var vv=arrBuff[i];
			if(!isMyNull(vv)){
				isExist=false;
				for(j=i+1;j<arrBuff.length;j++)
				{
					if(vv.toLowerCase()==arrBuff[j].toLowerCase()){
						isExist=true;
					}
				}
				if(!isExist){
					str+=vv+sp;
				}
			}
		}
	}
	return trimComma(str);
}
function isNoExistInArr2(str,no,sp1,sp2)
{
	if(isMyNull(str))return false;
	if(isMyNull(sp1))sp1=",";
	if(isMyNull(sp2))sp2=";";
	var arr1=new Array();
	var arr2=new Array();
	arr1=str.split(sp1);
	for(var i=0;i<arr1.length;i++)
	{
		var vv=arr1[i];
		
		if(!isMyNull(vv))
		{
			arr2=vv.split(sp2);
			if(arr2!=null)
			{
				for(var j=0;j<vv.length;j++)
				{
					if(arr2[j]==no)
						return true;
					j++;
				}
			}
		}		
	}
	return false;
}

function onMemoChange(s, max, o) {
	//alert("ok");
	if(document.readyState != "complete") {
		//alert("err");
		return;
	}
	var words=s.lenB();
	//alert(words);
	if(words > max)
		words = "<font color=red>"+ words+ "</font>";
	else
		words = "<font color=green> "+ words+ " </font>";
	o.innerHTML = "已输入"+ words+ "个字符(最多"+ max+ "个字符)";
}

function doIframeSelect()
{}

var http_request = false;
var http_request0 = false;
var http_request1 = false;
var http_request2 = false;
var http_request3 = false;
var http_request4 = false;
var http_request5 = false;
var http_request6 = false;
function makeRequest(url) {
	http_request = false;
	if (window.XMLHttpRequest) {
		http_request = new XMLHttpRequest();
		//document.write("ok");
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) {
		/*var xmlHttp_vers = ["MSXML2.XmlHttp.5.0","MSXML2.XmlHttp.4.0","MSXML2.XmlHttp.3.0","MSXML2.XmlHttp","Microsoft.XmlHttp"];
		if(!http_request){
			for(var i=0;i<xmlHttp_vers.length;i++){
				try{
					new ActiveXObject(xmlHttp_vers[i]);
					http_request = xmlHttp_vers[i];
					break;
				}catch(oError){;}
			}
		}
		if(http_request){
			http_request=new ActiveXObject(http_request);
		}else{
			//throw new Error("Could not create XML HTTP Request.");
		}*/
		if(!http_request){
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
		}
	}
	if (!http_request) {
		alert('Giving up :(无法创建一个XMLHTTP实例');
		return false;
	}
	if(typeof proessHttpRequest == 'undefined')proessHttpRequest=function(){};
	http_request.onreadystatechange = proessHttpRequest;
	http_request.open('POST', url, true);
	http_request.send(null);
}

function makeRequest0(url,func) {
	http_request0 = false;

	if (window.XMLHttpRequest) {
		http_request0 = new XMLHttpRequest();
		if (http_request0.overrideMimeType) {
			http_request0.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) {
		try {
			http_request0 = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request0 = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request0) {
		alert('Giving up :(无法创建一个XMLHTTP实例');
		return false;
	}
	if(typeof func == 'undefined')func=function(){};
	http_request0.onreadystatechange = func;
	http_request0.open('POST', url, false);
	http_request0.send(null);
}

function makeRequest1(url,func) {
	http_request1 = false;

	if (window.XMLHttpRequest) {
		http_request1 = new XMLHttpRequest();
		if (http_request1.overrideMimeType) {
			http_request1.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) {
		try {
			http_request1 = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request1 = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request1) {
		alert('Giving up :(无法创建一个XMLHTTP实例');
		return false;
	}
	http_request1.onreadystatechange = func;
	http_request1.open('POST', url, false);
	//alert("send");
	http_request1.send(null);
}
function makeRequest2(url,func) {
	http_request2 = false;

	if (window.XMLHttpRequest) {
		http_request2 = new XMLHttpRequest();
		if (http_request2.overrideMimeType) {
			http_request2.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) {
		try {
			http_request2 = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request2 = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request2) {
		alert('Giving up :(无法创建一个XMLHTTP实例');
		return false;
	}
	http_request2.onreadystatechange = func;
	http_request2.open('POST', url, false);
	http_request2.send(null);
}
function makeRequest3(url,func) {
	http_request3 = false;

	if (window.XMLHttpRequest) {
		http_request3 = new XMLHttpRequest();
		if (http_request3.overrideMimeType) {
			http_request3.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) {
		try {
			http_request3 = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request3 = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request3) {
		alert('Giving up :(无法创建一个XMLHTTP实例');
		return false;
	}
	http_request3.onreadystatechange = func;
	http_request3.open('POST', url, false);
	http_request3.send(null);
}
function makeRequest4(url,func) {
	http_request4 = false;

	if (window.XMLHttpRequest) {
		http_request4 = new XMLHttpRequest();
		if (http_request4.overrideMimeType) {
			http_request4.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) {
		try {
			http_request4 = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request4 = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request4) {
		alert('Giving up :(无法创建一个XMLHTTP实例');
		return false;
	}
	http_request4.onreadystatechange = func;
	http_request4.open('POST', url, false);
	http_request4.send(null);
}
function makeRequest5(url,func) {
	http_request5 = false;

	if (window.XMLHttpRequest) {
		http_request5 = new XMLHttpRequest();
		if (http_request5.overrideMimeType) {
			http_request5.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) {
		try {
			http_request5 = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request5 = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request5) {
		alert('Giving up :(无法创建一个XMLHTTP实例');
		return false;
	}
	http_request5.onreadystatechange = func;
	http_request5.open('POST', url, false);
	http_request5.send(null);
}
function makeRequest6(url,func) {
	http_request6 = false;

	if (window.XMLHttpRequest) {
		http_request6 = new XMLHttpRequest();
		if (http_request6.overrideMimeType) {
			http_request6.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) {
		try {
			http_request6 = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request6 = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request6) {
		alert('Giving up :(无法创建一个XMLHTTP实例');
		return false;
	}
	http_request6.onreadystatechange = func;
	http_request6.open('POST', url, false);
	http_request6.send(null);
}

function vis(obj){
	if(obj.style.display=='none'){
		obj.style.display='';
	}else{
		obj.style.display='none';
	}
	return (obj.style.display=='');
}
String.prototype.lenB = function(){
	return this.unHtmlReplace().replace(/\*/g," ").replace(/[^\x00-\xff]/g,"**").length;
}
function exitUI(){
	var ht = document.getElementsByTagName("body");
	//ht[0].style.filter = "progid:dXImageTransform.Microsoft.BasicImage(grayscale=1)";
	ht[0].style.filter = "progid:DXImageTransform.Microsoft.Pixelate(maxSquare=4)";	
}
function exitUI_(){
	var ht = document.getElementsByTagName("body");
	ht[0].style.filter = "";
}
function dwScript(str){
	document.write("<script language=\"javascript\" src=\"/js/"+str+".js\"><\/script>");
}
function dwCss(str){
	document.write('<link rel="stylesheet" type="text/css" href="/css/' + str + '.css" />');
}
function showDiv(div,v)
{
	if(v==null)
	{
		isShow=true;
		v=isShow;
	}
	else{
		isShow=v;
	}
	try{
		obj=document.getElementById(div);
		if(typeof obj!='undefined'){
			obj.style.visibility=isShow?'visible':'hidden';
		}
	}
	catch(e){}
}
function showDiv_1(div){
	try{
		var obj=document.getElementById(div);
		if(obj.style.visibility=='hidden'){
			obj.style.visibility='visible';
		}else{
			obj.style.visibility='hidden';
		}
	}
	catch(e){}
}
function setMyRequest(a,url,func)
{
	action=a;
	setProessFont();
	makeRequest(url,func);
}
function setCopy(str,isAlert)
{
	if(!str)str=window.location.href;
	if(isAlert==null)isAlert=true;
	try{
		clipboardData.setData('Text',str)
		alert("已经把该网址复制到系统剪贴板，您可以使用（Ctrl+V或鼠标右键）粘贴的功能！");
	}catch(e){}
}
function setHome(str)
{
	try{
		//if(str==null)str=window.document.location;
		if(!str)str=window.location.href;
		window.external.AddFavorite(str,window.document.title)
	}catch(e){};
}
function setCopy1(str,isAlert)
{
	if(!str){
		str=window.location.href;
	}else{
		var _buff=window.location.href;
		var _idx=_buff.indexOf("com");
		if(_idx>=0){
			str=_buff.substring(0,_idx+3)+str;
		}else{
			str="http://192.168.1.33"+str;
		}
	}
	if(isAlert==null)isAlert=true;
	try{
		clipboardData.setData('Text',str)
		alert("已经把该网址复制到系统剪贴板，您可以使用（Ctrl+V或鼠标右键）粘贴的功能！");
	}catch(e){}
}
function setHome1(str)
{
	try{
		//if(str==null)str=window.document.location;
		if(!str){
			str=window.location.href;
		}else{
			var _buff=window.location.href;
			var _idx=_buff.indexOf("com");
			if(_idx>=0){
				str=_buff.substring(0,_idx+3)+str;
			}else{
				str="http://192.168.1.33"+str;
			}
		
		}
		window.external.AddFavorite(str,window.document.title)
	}catch(e){};
}
function isHasZH1(temp)
{
	if(temp==null || temp=='')return false;
	var strtemp = "`1234567890-=\\~!@#$%^&*()_+|abcdefghijklmnopqrstuvwxyz[];',./{}:\"<>?";
	
	var checked = false;
	for(var j=0;j<temp.length();j++)
	{
		if(strtemp.indexOf(temp.charAt(j)) == -1)
		{}
	}
}
function isZH(ch)
{
	if(ch.charCodeAt(0)>255)return true;
	else false;
}
function zhNum(str){
	var c=0;
	for(var idx=0;str && idx<str.length;idx++){
		if(isZH(str.substring(idx,idx+1)))c++;
	}
	return c;
}
function isHasZH(str)
{
	return /[^\x00-\xff]/g.test(str);
}
function chkpwd(str)
{
  var strSource ="_0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  var ch;
  var i;
  var temp;
  
  for (i=0;i<=(str.length-1);i++)
  {
  
    ch = str.charAt(i);
    temp = strSource.indexOf(ch);
    if (temp==-1) 
    {
     return 0;
    }
  }
  if (strSource.indexOf(ch)==-1)
  {
    return 0;
  }
  else
  {
    return 1;
  } 
}
function processNullPic(doc){
	var imgs=doc.images;
	alert(imgs.length);
	for(var idx=0;idx<imgs.length;idx++){
		var pic;
		try{
			pic =imgs[idx];
			//alert(pic.fileSize);
			if(pic.fileSize<1){
				pic.src="/webimages/null.gif";
				pic.height="20";
				pic.width="100";
			}
		}
		catch(e){
			//alert("ee");
			pic.src="/webimages/null.gif";
			pic.height="20";
			pic.width="100";
		}
	}
}

String.prototype.leftB = function(len){
	var s=this.replace(/\*/g," ").replace(/[^\x00-\xff]/g,"**");
	return this.slice(0,s.slice(0,len).replace(/\*\*/g," ").replace(/\*/g,"").length);
}
String.prototype.unHtmlLeftB = function(len){
	var newLen=len;
	while(newLen <= this.length && this.substr(0,newLen).unHtmlReplace() != this.unHtmlReplace().substr(0,len))
		newLen ++;
	return this.substr(0,newLen);
}
String.prototype.htmlReplace = function() {
	return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\'/g,"&#39;").replace(/\"/g,"&quot;");
}

function check_mobile(obj){ 
	//var obj = document.dataform.phoneno;
    var regu_1 =/(^[1][3][4-9][0-9]{8}$)|(^0[1][3][4-9][0-9]{8}$)/;   
	var regu_2 =/(^[1][5][8-9][0-9]{8}$)/;   
    var re_1 = new RegExp(regu_1);  
	var re_2 = new RegExp(regu_2);
    if (re_1.test( obj.value ) || re_2.test( obj.value )) {   
      return true;   
    }   
    return false;      
}
function checkMobile(list,p){
	if(typeof p=='undefined')p=true;
	var retu="";
	if(list=="")return "";
	var arr=list.split(",");
	var errNo="";
	var cc=0;
	for(var idx=0;idx<arr.length;idx++){
		var value=arr[idx];
		if(!value)continue;
		//var regu_1 =/(^[1][3][4-9][0-9]{8}$)|(^0[1][3][4-9][0-9]{8}$)/;   
		//var regu_2 =/(^[1][5][8-9][0-9]{8}$)/;   
		var regu_1 =/(^[1][3][0-9][0-9]{8}$)|(^0[1][3][0-9][0-9]{8}$)/;   
		var regu_2 =/(^[1][5][0-9][0-9]{8}$)/;   
		var re_1 = new RegExp(regu_1);  
		var re_2 = new RegExp(regu_2);
		if (re_1.test(value) || re_2.test(value)) {   
		   retu+=value+",";
		}else{
			//alert(p);
			if(p){
				cc++;
				errNo=errNo+value+","+(cc%3==0?"\n":"");
			}
		}
	}
	if(errNo!=''){
		//alert(errNo+"\n\n以上号码不符合要求(只支持移动号码)！");
		alert(errNo+"\n\n以上号码不符合要求！");
	}
	return trimComma(retu);
}
//alert(checkMobile("15960846274"));

function getHOTPIM(str,is70){
	if(typeof is70 == 'undefined'){
		is70=true;
	}
	var v1="[www.hotpim.com]",v2="[hotpim.com]";
	if(str==''){return v1;}
	if(is70 && str.length+v2.length>70){
		str=str.substring(0,70-v2.length);
	}
	var p1=(str.length+v1.length);
	var p2=(str.length+v2.length);
	if( parseInt(p1/70,10)==parseInt(str.length/70,10) || (parseInt(p1/70,10)==parseInt(str.length/70,10)+1 && p1%70==0) || (parseInt(p2/70,10)!=parseInt(str.length/70,10) && p2%70!=0)){
		return str+v1;
	}
	return str+v2;
}
function getHOTPIM(str,v1,v2,is60){
	if(typeof is60 == 'undefined'){
		is60=true;
	}
	//var v1="[www.hotpim.com]",v2="[hotpim.com]";
	if(str==''){return v1;}
	if(is60 && str.length+v2.length>60){
		str=str.substring(0,60-v2.length);
	}
	var p1=(str.length+v1.length);
	var p2=(str.length+v2.length);
	if( parseInt(p1/60,10)==parseInt(str.length/60,10) || (parseInt(p1/60,10)==parseInt(str.length/60,10)+1 && p1%60==0) || (parseInt(p2/60,10)!=parseInt(str.length/60,10) && p2%60!=0)){
		return str+v1;
	}
	return str+v2;
}
function over(divid,id){
	var obj;
	for(var idx=1;idx<4;idx++){
		obj=eval("div"+divid+"_t"+idx);
		obj.className="indexConentNoOnfucus";
		obj.style.color="#666";

		obj=eval("div"+divid+"_"+idx);
		obj.style.display="none";
	}
	obj=eval("div"+divid+"_t"+id);
	if(id==3){
		obj.className="indexConentOnfucus";
	}else{
		obj.className="indexConentOnfucus_";	
	}
	obj.style.color="#"+"000";
	obj=eval("div"+divid+"_"+id);
	obj.style.display="";
}
function replace(str, sub1, sub2) {
	if (str == null || str=="") {
	    return "";
	}

	if (sub1 == null || trim(sub1) == "") {
	    //sub1 = "\\";
	}
	if (sub2 == null || trim(sub2) == "") {
	    //sub1 = "/";
	}
	var idx = -1;
	var start = 0;
	//System.out.println(sub1.length+":"+sub2.length);
	//int buff=0;
	if (str != null && str != "") {
	    while (start < str.length) { // && buff<10)
		idx = (str.substring(start)).indexOf(sub1);
		if (idx < 0) {
		    break;
		}
		idx = start + idx;
		if (idx == 0) {
		    if (str.length > 1) {
			str = sub2 + str.substring(sub1.length);
			start = sub2.length;
			continue;
		    } else {
			str = sub2;
			break;
		    }
		} else if (idx == (str.length - 1)) {
		    str = str.substring(0, str.length - 1) + sub2;
		    break;
		} else {
		    str = str.substring(0, idx) + sub2 +
			  str.substring(idx + sub1.length);
		    start = idx + sub2.length;
		}
	    }
	}
	return str;
}
function commInstalize(_comm_init)
{
	//MSIE
	if(navigator.userAgent.indexOf("MSIE") != -1)
	{
		document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
		var script = document.getElementById("__ie_onload");
		script.onreadystatechange = function() 
		{
			if (this.readyState == "complete")
			{
				_comm_init(); // call the onload handler
			}
		};
	}//SAFARI
	else if (navigator.userAgent.indexOf("Safari") != -1)
	{
		if (/WebKit/i.test(navigator.userAgent)) { // sniff
			var _timer = setInterval(function() {
				if (/loaded|complete/.test(document.readyState)) {
					_comm_init(); // call the onload handler
				}
			}, 10);
		}
	}//FIREFOX
	else if (navigator.userAgent.indexOf("Firefox") != -1)
	{
		if (document.addEventListener)
		{
			document.addEventListener("DOMContentLoaded", _comm_init, false);
		}
	}
	else
	{
		window.onload = _comm_init; 
	}
}

function spFunction(obj,sp,ttt){
	if(sp){
	}else{
		sp=",";
	}
	if(obj && obj.value){
		var v=obj.value;
		if(sp!=","){v=v.replace(/,/g,sp);}
		if(sp!=";"){v=v.replace(/;/g,sp);}
		if(sp!="，"){v=v.replace(/，/g,sp);}
		if(sp!="；"){v=v.replace(/；/g,sp);}
		if(sp!="、"){v=v.replace(/、/g,sp);}
		//if(sp!="." && v.indexOf()){v=v.replace(".",sp);}
		if(sp!="。"){v=v.replace(/。/g,sp);}
		
		if(typeof ttt !='undefined'){
			if(ttt==0){
				if(sp!=" "){v=v.replace(/ /g,'');}
			}
		}

		if(v!=obj.value){
			obj.value=v;
		}
	}
}

window.onbeforeunload = function(){ 
	try{
		if(chkLeave()){
			var c=chkLeave();
			if(c){
				event.returnValue=c;
			}
		}
	}catch(e){}
} 
