String.prototype.LenGB=function(){
    var arr=this.match(/[^\x00-\x80]/g);
    return this.length+(!arr?0:arr.length);
}
//管理员登录验证
function AdminChkLogin()
{
    var obj=document.getElementsByTagName("input");
    for(var i=0;i<obj.length;i++)
    {
        if(obj[i].type=="text")
            if(obj[i].value.length<5)
            {
                alert("用户名要大于5个字!");
                obj[i].focus();
                return false;
            }
        if(obj[i].type=="password")
            if(obj[i].value.length<6)
            {
                alert("密码要大于6个字!");
                obj[i].focus();
                return false;
            }
    }
    return true;
}
//确认删除
function ckDel()
{
	return confirm('此次删除不可恢复,确认删除?');
}
//Option 添加
function OptionAdd(d,text,value)
{
  for(var i=0;i<d.options.length;i++) 
	  if(d.options(i).value==value)
		  return 0;
  d.options.add(new Option(text,value));
  d.options(d.options.length-1).selected=true;
}
//添加选择的项
function SelectAdd(s,d)
{
	for(var i=0;i<s.options.length;i++)
	{
		if(s.options(i).selected)
		{
			  OptionAdd(d,s.options(i).text,s.options(i).value);
		}
	}
}
//删除所选
function SelectDel(d)
{
  for(var i=d.options.length -1 ;i>=0;i--)
	  if(d.options(i).selected)
		  d.options.remove(i);
}
//选择全部
function SelectAll(obj)
{
	for(var i=0;i<obj.options.length;i++)
	{
		obj.options(i).selected=true;
	}
}
//顶部表格改变样式
function on(obj,Color)
{
	if(typeof(Color)=="undefined")
		obj.style.background="#DCF7AD";
	else if(Color==1)
		obj.style.background="#ADD7F7";
	else
		obj.style.background="#FFD866";
}
//顶部表格恢复样式
function off(obj,Color)
{
	if(typeof(Color)=="undefined")
		obj.style.background="#EFFDD5";
	else if(Color==1)
		obj.style.background="#D5ECFD";
	else
		obj.style.background="#FFF0AE";
}
//顶部公共搜索验证
function frmSearch()
{
	if(document.search.KeyWord.value=="" || document.search.KeyWord.value=="关键字")
	{
		alert("请输入搜索关键字")
		document.search.KeyWord.select();
		document.search.KeyWord.focus();
		return false;
	}
	return true;
}
//复选框全选
function CheckBoxSelectAll()
{
var obj=document.getElementsByTagName("INPUT");
	for(var i=0;i<obj.length;i++)
		if(obj[i].type=="checkbox")
		{
			obj[i].checked=true;
			if(obj[i].onclick && obj[i].onclick.toString().indexOf("CheckBoxSetColor")!=-1)
			{
				CheckBoxSetColor(obj[i]);
			}
		}
}
//复选框全取消
function CheckBoxUNSelectAll()
{
var obj=document.getElementsByTagName("INPUT");
	for(var i=0;i<obj.length;i++)
		if(obj[i].type=="checkbox")
		{
			obj[i].checked=false;
			if(obj[i].onclick && obj[i].onclick.toString().indexOf("CheckBoxSetColor")!=-1)
			{
				CheckBoxSetColor(obj[i]);
			}
		}
}
//复选框反选
function CheckBoxReverseSelect()
{
var obj=document.getElementsByTagName("INPUT");
	for(var i=0;i<obj.length;i++)
		if(obj[i].type=="checkbox")
		{
			obj[i].checked=!obj[i].checked;
			if(obj[i].onclick && obj[i].onclick.toString().indexOf("CheckBoxSetColor")!=-1)
			{
				CheckBoxSetColor(obj[i]);
			}
		}
}
//**********************************************************
function CheckBoxSetColor(obj)
{
	if(obj.type && obj.type=="checkbox")
		if(obj.parentElement && obj.parentElement.parentElement && obj.parentElement.parentElement.tagName == "TR" && obj.checked)
			obj.parentElement.parentElement.style.backgroundColor	=	"#FFFFCC";
		else
			obj.parentElement.parentElement.style.backgroundColor	=	"#000000";
}
//**********************************************************
function SetColor(obj, color)
{
	obj.style.backgroundColor	=	color;
}
//**********************************************************
function CheckIsChecked(Key)
{
	var obj	=	document.getElementsByName(Key);
	for(var i=0;i<obj.length;i++)
		if(obj[i].checked)
			return true;
	alert("请至少选择一个");
	return false;	
}
//**********************************************************
function InvitePage(UserID)
{
	if(UserID=="")
	{
		alert("至少选择一个用户!")
		return;
	}
	
	window.open("/InvitePage.asp?UserID=" + UserID, "", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=650,height=450");
}
//**********************************************************
function TableInsertRow(obj, Color, RowIndex)
{
	if(!(obj && obj.tagName=="TABLE"))
	{
		return;
	}
	if(obj.rows.length>1 && Color!='')
		return;
	else if(obj.rows.length==1)
		RowIndex	=	1;
	else
		RowIndex	=	-1;	

	var tr	=	obj.insertRow(RowIndex);
	try
	{
		tr.style.color	=	Color;
		tr.align	=	"center";
	}
	catch(e){}
	for(var i=3;i<arguments.length;i++)
	{
		var td	=	tr.insertCell(tr.cells.length);
		td.innerHTML	=	arguments[i];
	}
}
//**********************************************************
function frmElementSet_innerHTML(target, value)
{
	var obj	=	document.getElementById(target);
	if(!obj)return;
	obj.innerHTML	=	value;
}
//**********************************************************
function frmElementSetValue(obj, value)
{
	if(typeof(obj)!="object"){return;}
	if(!obj.tagName || (obj.tagName != "INPUT" && obj.tagName!="SELECT" && obj.tagName!="TEXTAREA")){return;}
	if(!obj.type){return;}
	switch(obj.type.toUpperCase())
	{
		case "SELECT":
			for(var i=0;i<obj.options.length;i++)
			{
				if(obj.options[i].value == value)
				{
					obj.selectedIndex	=	i;
					break;
				}
			}
		default:
			{
				obj.value	=	value;
			}
	}
}
//*********************************************************
function isDate(op)
{
	if(/^\d{4}(-[01]{0,1}[0-9]{1})(-[0123]{0,1}[0-9]{1})$/.test(op))
	{
		var tmp	=	parseInt(op.split("-")[0]);
		if(tmp<1900 || tmp>new Date().getFullYear())
			return false;
		return true;
	}
	else
		return false;
}
//**********************************************************
function HigheLine(str)
{
	if(str=="")return;
	var obj	=	document.getElementsByTagName("div");
	str	=	str.replace(/([\\\^\$\*\+\?\{\}\.\(\)\[\]\|])/g,"\\$1");
	var re = new RegExp("(" + str + ")","ig");
	for(i=0;i<obj.length;i++)
	{
		if(obj[i].getAttribute("id")!="1")continue;
		var tmp	=	obj[i].innerHTML;
		obj[i].innerHTML	=	tmp.replace(re,"<span class=bg>$1</span>")
	}
}
//**********************************************************
function InitJobLable()
{
	var Lable_Txt	=	new Array();
	Lable_Txt[0]	=	"-请选择工作种类-";
	Lable_Txt[1]	=	"不限";
	Lable_Txt[2]	=	"其他类";
	Lable_Txt[3]	=	"机械类";
	Lable_Txt[4]	=	"电子类";
	Lable_Txt[5]	=	"计算机类";
	Lable_Txt[6]	=	"电气类";
	Lable_Txt[7]	=	"土木建筑类";
	Lable_Txt[8]	=	"房地产经营类";
	Lable_Txt[9]	=	"化工类";
	Lable_Txt[10]	=	"食品类";
	Lable_Txt[11]	=	"纺织服装类";
	Lable_Txt[12]	=	"财务会计类";
	Lable_Txt[13]	=	"公关营销类";
	Lable_Txt[14]	=	"对外贸易类";
	Lable_Txt[15]	=	"生产管理类";
	Lable_Txt[16]	=	"文秘行政类";
	Lable_Txt[17]	=	"法律类";
	Lable_Txt[18]	=	"语言翻译类";
	Lable_Txt[19]	=	"广告企划类";
	Lable_Txt[20]	=	"教育类";
	Lable_Txt[21]	=	"医疗卫生类";
	Lable_Txt[22]	=	"农林水类";
	Lable_Txt[23]	=	"交通运输类";
	Lable_Txt[24]	=	"电器仪器仪表类";
	Lable_Txt[25]	=	"旅游餐饮服务类";
	Lable_Txt[26]	=	"金融证券类";
	Lable_Txt[27]	=	"新闻传播类";
	Lable_Txt[28]	=	"党政机关类";
	Lable_Txt[29]	=	"其他服务类";
	Lable_Txt[30]	=	"技工操作工";
	Lable_Txt[31]	=	"经营管理类";

	for(i=0;i<Lable_Txt.length;i++)
	{
		if(i==0)
			document.write('<option value="" selected>' + Lable_Txt[i] + '</option>');
		else
			document.write('<option value="' + Lable_Txt[i] + '">' + Lable_Txt[i] + '</option>');
	}
}
//**********************************************************
function InitArea()
{
	var txt	=	"选择地区,不限,福建省,　泉州市,　　晋江市,　　石狮市,　　南安市,　　惠安县,　　安溪县,　　永春县,　　德化县,　福州市,　厦门市,　莆田市,　三明市,　漳州市,　南平市,　龙岩市,　宁德市,福建省外".split(",");
	var val	=	",,350000,350500,350582,350581,350583,350521,350524,350525,350526,350100,350200,350300,350400,350600,350700,350800,350900,359999".split(",");
	for(i=0;i<txt.length;i++)
	{
		document.write('<option value="' + val[i] + '">' + txt[i] + '</option>');
	}
}
//**********************************************************
// Author:	陈世华
// QQ:		47210879
//**********************************************************
function ShowPage(PageCount, ShowNumber, ShowCNNext, ShowGO, RecNum)
{
	var PageSize	=	10;
	var queryStr	=	location.search;
	var CurrentPage	=	1;
	if(queryStr != "")
		queryStr	=	queryStr.replace("?","");
	if(queryStr.toLowerCase().indexOf("page=") == -1)
	{
		if(queryStr == "")
			queryStr	=	"Page=1";
		else
			queryStr	+=	"&Page=1";
	}
	else
	{
		CurrentPage	=	queryStr.toLowerCase().replace(/^[^\ ]*page=(\d+)[^\ ]*$/gi,"$1");
	}

	PageCount	=	parseInt(PageCount);
	if(isNaN(PageCount) || PageCount < 0)
		PageCount	=	0;
	CurrentPage	=	parseInt(CurrentPage);
	if(isNaN(CurrentPage) || CurrentPage < 0)
		CurrentPage	=	1;
	CurrentPage	=	CurrentPage>PageCount?PageCount:CurrentPage;

	//首页,上一页
	this.ShowFirstPrevious	=	function(PageCount, CurrentPage, FirstText, PreviousText, PageSize)
	{
		if(isNaN(parseInt(PageSize)))
			PageSize	=	0;
		if(PageSize > 0)
		{
			if(CurrentPage > 1)
			{
				document.write("<a href='?" + queryStr.replace(/page=(\d+)/gi,"Page=1") + "'>" + FirstText + "</a> ");
			}
			if(parseInt(CurrentPage / PageSize) + (CurrentPage % PageSize==0?0:1) > 1)
			{
				document.write("<a href='?" + queryStr.replace(/page=(\d+)/gi,"Page=" + ((parseInt(CurrentPage / PageSize) - (CurrentPage % PageSize==0?1:0)) * PageSize).toString()) + "'>" + PreviousText + "</a> ");
			}
		}
		else
		{
			if(CurrentPage > 1)
			{
				document.write("<a href='?" + queryStr.replace(/page=(\d+)/gi,"Page=1") + "'>" + FirstText + "</a> ");
			}
			if(CurrentPage > 1)
			{
				document.write("<a href='?" + queryStr.replace(/page=(\d+)/gi,"Page=" + (CurrentPage - 1).toString()) + "'>" + PreviousText + "</a> ");
			}
		}
	}
	//下一页,尾页
	this.ShowLastNext	=	function(PageCount, CurrentPage, NextText, LastText, PageSize)
	{
		if(isNaN(parseInt(PageSize)))
			PageSize	=	0;
		if(PageSize > 0)
		{
			if((parseInt(CurrentPage / PageSize) + (CurrentPage % PageSize==0?0:1)) * PageSize < PageCount)
			{
				document.write("<a href='?" + queryStr.replace(/page=(\d+)/gi,"Page=" + ((parseInt(CurrentPage / PageSize) + (CurrentPage % PageSize==0?0:1)) * PageSize + 1).toString()) + "'>" + NextText + "</a> ");
			}/*
			if(CurrentPage < PageCount)
			{
				document.write("<a href='?" + queryStr.replace(/page=(\d+)/gi,"Page=" + PageCount.toString()) + "'>" + LastText + "</a> ");
			}*/
		}
		else
		{
			if(CurrentPage < PageCount)
			{
				document.write("<a href='?" + queryStr.replace(/page=(\d+)/gi,"Page=" + (CurrentPage + 1).toString()) + "'>" + NextText + "</a> ");
			}/*
			if(CurrentPage < PageCount)
			{
				document.write("<a href='?" + queryStr.replace(/page=(\d+)/gi,"Page=" + PageCount.toString()) + "'>" + LastText + "</a> ");
			}*/
		}
	}
	if(typeof(RecNum)!='undefined')
	{
		document.write("共有<font color='red'><b>" + RecNum + "</b></font>个记录,");
	}
	//显示1..10
	if(ShowNumber)
	{
		var tmp	=	parseInt(CurrentPage / PageSize);
		if(CurrentPage % PageSize == 0)
			tmp--;
		tmp	=	tmp<0?0:tmp;
		this.ShowFirstPrevious(PageCount, CurrentPage, "<font face=webdings>9</font>", "<font face=webdings>7</font>", PageSize);
		for(var i = tmp * PageSize + 1; i <= PageSize * (tmp + 1); i++)
		{
			if(i > PageCount)break;
			if(CurrentPage != i)
				document.write("<a href='?" + queryStr.replace(/page=(\d+)/gi,"Page=" + i.toString()) + "'>" +  i.toString() + "</a> ");
			else
				document.write("<font color=red><b>" +  i.toString() + "</b></font> ");
		}
		this.ShowLastNext(PageCount, CurrentPage, "<font face=webdings>8</font>", "<font face=webdings>:</font>", PageSize);
	}
	//显示上一页,下一页
	if(ShowCNNext)
	{
		this.ShowFirstPrevious(PageCount, CurrentPage, "首页", "上一页");
		this.ShowLastNext(PageCount, CurrentPage, "下一页", "尾页");
	}
	//显示转到第几页
	if(ShowGO)
	{
		document.write('转到 <INPUT NAME="PageNumber" id="PageNumber" value="' + CurrentPage.toString() + '" TYPE="text" onchange="javascript:javascript:this.value=this.value.replace(/[^0-9]/gi,\'\');" onKeyUp="javascript:this.value=this.value.replace(/[^0-9]/gi,\'\');" SIZE="3" MAXLENGTH="5"> 页 ');
		document.write("<input type=button name=Submit value=GO onclick='var obj = document.getElementById(\"PageNumber\").value;if(!isNaN(parseInt(obj))){location.href=\"?" + queryStr.replace("\\","\\\\").replace(/\"/gi,"\\\"").replace(/\'/gi,"&#39;") + "\".replace(/page=(\\\d+)/gi,\"Page=\" + obj);}else{alert(\"请输入正确的页码!\");}'>");
	}
	//window.status	=	queryStr;
}