//显示状态信息
function runClock() {
theTime = window.setTimeout("runClock()", 100);
var today = new Date();
var display= today.toLocaleString();
window.status="现在时间："+display+" 欢迎来到重庆工商大学就业网！";
}
runClock();


/**function page_head_display(imgpath)
{
	var str='';
	str += '<table width="100%"  border="0" cellpadding="0" cellspacing="0" background="'+imgpath+'/application/jiuye/common/image/topbanner_r1_c3.gif">';
    str += '    <tr>'; 
    str += '      <td width="23%" align="left"><img src="'+imgpath+'/application/jiuye/common/image/topbanner_r1_c1.gif" width="236" height="77"></td>';
    str += '      <td width="77%" align="left" id="tdID_ad"><IMG style="FILTER:revealTrans(Duration=4.0, Trnsition=23)"  src="'+imgpath+'/appliation/jiuye/common/image/topbanner_r1_c2.GIF" id="imgID_ad" name="imgName_ad"  width="236" height="77"></td>';
    str += '    </tr>';
	str += '</table>';
	playHeadAd(imgpath+'/application/jiuye/common/image/','tdID_ad')
	return str;
}
function playHeadAd(url,imgobj)
{
	var ad_array = new Array();
	var timeStr  = (new Date()).getSeconds()
	ad_array[0]=url +'ad_1.gif';
	ad_array[1]=url +'ad_2.gif';
	ad_array[2]=url +'ad_3.gif';
	timeStr = timeStr % ad_array.length
	var imgstr = '<img style="FILTER:revealTrans(Duration=4.0, Trnsition=23)" src="'+ad_array[timeStr]+'" id="imgID_ad" name="imgName_ad">'
	if(eval('document.all.'+imgobj))
		eval('document.all.'+imgobj).src = ad_array[timeStr] //;imgstr;	
	setTimeout("playHeadAd('"+url+"','"+imgobj+"')",2001);
}
**/
/**
*输入数组的下拉实现
*obj		---要填充的文本框的名称
*orgindata	---前端传来的下拉js数组
*btn        ---点击的对象
*/
function getSelectOptions(obj,orginData,btn){
	var srcdata=orginData;
	var optionData
	if(event.srcElement.type != "text") {
		optionsData = orginData;
	}
	else {
		var j = 0;
		var findData = new Array();
		for(var i = 0; i < orginData.length; i++) {
			if(orginData[i].indexOf(obj.value) >= 0) {
				var showData = orginData[i];
				showData = showData.replace(obj.value, '<font color = red>' + obj.value + '</font>');				
				findData[j] = showData;
				j++;
			}
		}
		optionsData = findData;
	}
	//这里调用公共的前端分页实现。
	setSelectMenu(obj,optionsData,0,btn);
}

function getTheTime(tmpDate)
{ 
	var tmpStr;                             
	date = tmpDate.getDate();                 
	month= tmpDate.getMonth() + 1 ;                 
	year= tmpDate.getYear();                 
	tmpStr=year+'年'+month+'月'+date+'日 ';                
	myArray=new Array(6);                 
	myArray[0]="星期日"                 
	myArray[1]="星期一"                 
	myArray[2]="星期二"                 
	myArray[3]="星期三"                 
	myArray[4]="星期四"                 
	myArray[5]="星期五"                 
	myArray[6]="星期六"                 
	weekday=tmpDate.getDay();                 
	if (weekday==0 | weekday==6)                                
		tmpStr=tmpStr+myArray[weekday]; 
    else                               
		tmpStr=tmpStr+myArray[weekday];               
	return tmpStr; 
} 

/* -- 前端分页 对象 --*/
 function CountPage(obj)
 {
 	this.Name      = obj ;
	this.ListArray = new Array();
 	this.Path      = '';
	this.tabName   = '';
	//
	this.TdClass   = 'tab_5';
	this.LinkClass = '';
	this.CountClass= 'tab_3';
	this.ImgPath   = this.Path + 'image/';
	this.goImg     = '';
	this.FirstImg  = '<img src="'+this.ImgPath + 'main/scroll_left.gif"   border=1 align="absmiddle" alt="第一页">';
	this.PreImg    = '<img src="'+this.ImgPath + 'main/scroll_left1.gif"  border=1 align="absmiddle" alt="前一页">';
	this.NextImg   = '<img src="'+this.ImgPath + 'main/scroll_right1.gif" border=1 align="absmiddle" alt="下一页">';
	this.LastImg   = '<img src="'+this.ImgPath + 'main/scroll_right.gif"  border=1 align="absmiddle" alt="最后一页">';
	//
	this.PageNum   = 15;
	this.middNum   = 5;
	//
	this.nodeName  = '';
	this.nodeUrl   = '';
	//method
	this.getURL    = getCoutPageURL
	this.getList   = getCountPageList
	this.Display   = getDisplayTable;	
 }
 function getCountPageList(temp_array,nextPage)
 {
	 if(!temp_array) 
	 	return false
	var str ='';
	var ListNum   = temp_array.length;
	var PageCount = parseInt( ListNum / this.PageNum)
	if(nextPage  >  PageCount )
		nextPage  = PageCount;	
	if(nextPage  < 0 )
		nextPage  = 0;
	var FirstPage = 0;
	var LastPage  = PageCount;
	if(nextPage > this.middNum )
		FirstPage = nextPage - this.middNum;
	if(nextPage + this.middNum < PageCount )
		LastPage  =  nextPage + this.middNum;
	if(LastPage - FirstPage <  this.middNum *2 +1)
		LastPage  =  this.middNum *2 + FirstPage +1
	LastPage = (LastPage >PageCount+1)?PageCount+1:LastPage;
		
	//alert( FirstPage +"|"+ LastPage + "|"+ PageCount)
	var beginNum  = 0;
	var endNum    = ListNum;
	beginNum      = beginNum + ( nextPage * this.PageNum )
	if(this.PageNum < ListNum )
	{
		if(nextPage == PageCount )
			endNum = beginNum + ListNum % this.PageNum 
		else
			endNum  = beginNum + this.PageNum 
	}		
	//alert(beginNum + "|"+ endNum);
	for(var i=beginNum;i<endNum;i++)
	{
		var temp = temp_array[i].split("||");
		str += '<tr>';
		str += '	<td class="'+this.TdClass+'" height="22">';
		str += '		? '+this.goImg + ' <a href=# onclick="'+this.Name+'.getURL(\''+temp[1]+'\');return false" class="'+this.LinkClass+'">'+temp[0]+'</a>';
		str += '	</td>';
	  	str += '</tr>'; 
	}
	for(var ii=0;ii<this.PageNum - (endNum - beginNum);ii++)
	{
		str += '<tr><td class="'+this.TdClass+'" height ="22" ></td></tr>';
	}
	str += '<tr>';
	str += '	<td class="'+this.CountClass+'" height="25" > ?? 总共 <b>'+(PageCount+1)+'</b>页  ';
	if(nextPage > 0 )
		str += '	   <a href="#" onclick="javascript:'+this.Name+'.Display('+this.Name+'.ListArray,0);return false">'+this.FirstImg+'</a>               <a href="#" onclick="javascript:'+this.Name+'.Display('+this.Name+'.ListArray,'+(nextPage-1)+');return false">'+this.PreImg+'</a>';	
	
	for(var j=FirstPage;j<LastPage;j++)
	{
		if( j == nextPage )
			str += ' <b>'+ (j+1) +'</b> ?' ;
		else
			str += ' <a href="#" onclick="javascript:'+this.Name+'.Display('+this.Name+'.ListArray,'+j+');return false">'+(j+1)+'</a> ?';
	}
	
	if(nextPage < PageCount)
		str += '	 <a href="#" onclick="javascript:'+this.Name+'.Display('+this.Name+'.ListArray,'+(nextPage+1)+');return false">'+this.NextImg+'</a> <a href="#" onclick="javascript:'+this.Name+'.Display('+this.Name+'.ListArray,'+PageCount+');return false">'+this.LastImg+'</a> ? ? ';			
	str += '	</td>';
	str += '</tr>';	
	return str;
 }

 /*--在 页面上显示 --*/
 function getDisplayTable(temp,inum)
 {
  	var str ='  <table width="98%" border="0" cellspacing="0" cellpadding="1" align="center"> ';
	eval('document.all.'+this.tabName).innerHTML = str + this.getList(temp,inum) +'</table>'
 }

 /*--向外接口，使用同名函数，自定义函数内容--*/
 function getCoutPageURL(url)
 {
	//getWindow(url,'null','550','450');
	location.href = url ;
	return false;
 }
/*--------------------------*/
 
/*-- clip string--*/
function getClipString(str,inum)
{
 	if(str.length > inum)
		str = str.substr(0,inum) +'...';
	return str;
}	
 
 //通过URL获得数据
function fc_httpGet( url ){
  var content = "";
  try{
    var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    xmlhttp.open("POST", url, false);
    //xmlhttp.setRequestHeader( null , cookie );
    xmlhttp.send();
    content = xmlhttp.responseText;
  }
  catch( e ){
    alert( "从服务器端获得数据的过程中出现错误" + e );
  }
  return content;
}
//字符是否在S中
function checkCharsInBag (s, bag)
{ 
	var i;
	// Search through string's characters one by one.
	// If character is in bag, append to returnString.
	for (i = 0; i < s.length; i++)
	{ 
		// Check that current character isn't whitespace.
		var c = s.charAt(i);
		if (bag.indexOf(c) == -1) return false;
	}
	return true;
}

/**
 * 功能： Email较验函数
 * 输入： obj 欲校验的Object reference， msg 欲提示信息
 * 输出： true 或 false 
 */
 /*
function checkEmail(obj, msg)
{
	if ('' == obj.value.trim())
		return true;
	
	var reg = /^([a-z]){1,}([\.a-z0-9_\-]){0,}([a-z0-9]){1,}@([a-z0-9_-]){3,}(\.([a-z0-9]){2,4}){1,2}$/gi; 
	
	if (reg.test(obj.value))
	{ 
		return true;
	}
	else 
	{
		alert((msg?msg:'请输入标准格式Email'));
		obj.select();
		return false;
	}
}*/
/*
 *
 * 功能： Email较验函数
 * 输入： obj 欲校验的Object reference， msg 欲提示信息
 * 输出： true 或 false 
 */
function checkEmail(obj, msg) {
   var emailStr = obj.value.trim();
   //alert(emailStr);
   if (emailStr.length == 0) {
       return true;
   }
   var emailPat=/^(.+)@(.+)$/;
   var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
   var validChars="\[^\\s" + specialChars + "\]";
   var quotedUser="(\"[^\"]*\")";
   var ipDomainPat=/^(\d{1,3})[.](\d{1,3})[.](\d{1,3})[.](\d{1,3})$/;
   var atom=validChars + '+';
   var word="(" + atom + "|" + quotedUser + ")";
   var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
   var domainPat=new RegExp("^" + atom + "(\\." + atom + ")*$");
   var matchArray=emailStr.match(emailPat);
   if (matchArray == null) {
       alert((msg?msg:'请输入标准格式Email'));
	   obj.select();
       return false;
   }
   var user=matchArray[1];
   var domain=matchArray[2];
   if (user.match(userPat) == null) {
       alert((msg?msg:'请输入标准格式Email'));
	   obj.select();
       return false;
   }
   var IPArray = domain.match(ipDomainPat);
   if (IPArray != null) {
       for (var i = 1; i <= 4; i++) {
          if (IPArray[i] > 255) {
             alert((msg?msg:'请输入标准格式Email'));
		     obj.select();
             return false;
          }
       }
       return true;
   }
   var domainArray=domain.match(domainPat);
   if (domainArray == null) {
       alert((msg?msg:'请输入标准格式Email'));
	   obj.select();
       return false;
   }
   var atomPat=new RegExp(atom,"g");
   var domArr=domain.match(atomPat);
   var len=domArr.length;
   if ((domArr[domArr.length-1].length < 2) ||
       (domArr[domArr.length-1].length > 3)) {
       alert((msg?msg:'请输入标准格式Email'));
	   obj.select();
       return false;
   }
   if (len < 2) {
       alert((msg?msg:'请输入标准格式Email'));
	   obj.select();
       return false;
   }
   return true;
}

function checkEmail_en(obj, msg)
{
	if ('' == obj.value.trim())
		return true;
	
	var reg = /^([a-z]){1,}([\.a-z0-9_\-]){0,}([a-z0-9]){1,}@([a-z0-9_-]){3,}(\.([a-z0-9]){2,4}){1,2}$/gi; 
	
	if (reg.test(obj.value))
	{ 
		return true;
	}
	else 
	{
		alert((msg?msg:'The Email format is false!'));
		obj.select();
		return false;
	}
}

//电话格式效验
function checkTelephone(obj,msg)
{
	if ('' == obj.value.trim())
		return true;
	var reg = /^([0-9]){1,}([0-9\-]){3,}$/gi;
	if(reg.test(obj.value)) return true;
	else {
		alert((msg?msg:'输入电话有错误！'));obj.select();return false;
		}	
}
function checkTelephone_en(obj,msg)
{
	if ('' == obj.value.trim())
		return true;
	var reg = /^([0-9]){1,}([0-9\-]){3,}$/gi;
	if(reg.test(obj.value)) return true;
	else {
		alert((msg?msg:'The telephone foramt is false!'));obj.select();return false;
		}	
}

//身份证判断
function checkCardNum(s){
	/*if (isEmpty(s)){ 
		alert("必须输入数字")
		return false;
	}*/
	//alert(s.length);
	if (s.length!=15 && s.length!=18){
		alert("输入的身份证必须长度为15位或者18位!");
		return false;
	}else{
		if(s.length==15){
			if(!checkCharsInBag (s, "0123456789")){
				alert("15位身份证号码必须全部为数字!");
				return false;
			}else{
				return true;
			}
		}else{	
			var s1=s.substring(0,s.length-1);
			var s2=s.substring(s.length-1,s.length);
			//alert(s1);
			//alert(s2);
			if(!checkCharsInBag (s1, "0123456789")){
				alert("18位的身份证前17位必须为数字!");
				return false;
			}
			if(!checkCharsInBag (s2, "0123456789X")){
				alert("18位的身份证的最后一位必须为数字数字或大写X");
				return false;
			}
			return true;
		}
		
	}
	
	
}
//Please check what you input whether is number or not?
//The Id number must be 15 or 18 words long！
function checkCardNum_en(s){
	/*if (isEmpty(s)){ 
		alert("必须输入数字")
		return false;
	}*/
	if (s.length!=15 && s.length!=18){
		alert("The Id number must be 15 or 18 words long!");
		return false;
	}else{
		if(s.length==15){
			if(!checkCharsInBag (s, "0123456789")){
				alert("The  IDCard for 15 words long must be number! ");
				return false;
			}else{
				return true;
			}
		}else{	
			var s1=s.substring(0,s.length-1);
			var s2=s.substring(s.length-1,s.length);
			//alert(s1);
			//alert(s2);
			if(!checkCharsInBag (s1, "0123456789")){
				alert(" The first 17 words of  the IDCard must be number !");
				return false;
			}
			if(!checkCharsInBag (s2, "0123456789X")){
				alert("The last word of the IDCard must be number or capital X!");
				return false;
			}
			return true;
		}
		
	}
}

//邮政编码判断
function checkZipCode(s){
	//if (!isEmpty(s))
	if(s!=null&&s!="")
	{
		if(!isCharsInBag (s, "0123456789")){
			alert("请检查一下您输入的是否为数字！");
			return false;
		}
		if (s.length==6){
			return true;
		}else{
			alert("输入的邮政编码长度为6！");
			return false;
		}
	} else {
		return true;
	}
}
function checkZipCode_en(s){
	//if (!isEmpty(s))
	if(s!=null&&s!="")
	{
		if(!isCharsInBag (s, "0123456789")){
			alert("Please check what you input whether is number or not?");
			return false;
		}
		if (s.length==6){
			return true;
		}else{
			alert("The total words must be 6！");
			return false;
		}
	} else {
		return true;
	}
}

/** 
 * 功能：　判断是否日期函数
 * 输入：　srcStr 欲判断字符串, sFieldName 对象名称
 * 输出：　true 日期，　false 非日期
 */
function checkDateByValue(srcStr, sFieldName)
{	
	if (srcStr.length != 10) 
	{
		alert("【" + sFieldName + "】 日期格式错误！\n请输入如【2000-10-10】的格式");
		return false;
	}
	
	var year = srcStr.substring(0,4);
	var month = srcStr.substring(5,7);
	var day = srcStr.substring(8,10);
	var d_t1 = srcStr.substring(4,5);
	var d_t2 = srcStr.substring(7,8);	

	if (isNaN(day) || isNaN(month) || isNaN(year) || d_t1 != "-" || d_t2 != "-")
	{
		alert("【" + sFieldName + "】日期格式错误！\n请输入如【2000-10-10】的格式");
		return false;
	}
	if (day > 31 || day < 1 || month > 12 )
	{
		alert("【" + sFieldName + "】没有这个日期！");
		return false;
	}
	if (month == 4 || month == 6 || month == 9 || month == 11)
	{
		if (day > 30)
		{
			alert("【" + sFieldName + "】没有这个日期！");
			return false;
		}	
	}
	if (month == 2)
	{
		if(year % 4 !=0 || (year % 400 != 0 && year % 100 == 0))
		{
			if(day > 28)
			{
				alert("【" + sFieldName + "】 没有这个日期！");
				return false;
			}
		}
		else
		{ 
			if( day > 29)
			{
				alert("【" + sFieldName + "】没有这个日期！");
				return false;
			}
		}
	}

	return true;	
}

/** 
 * 功能：　判断是否日期函数(提示信息为英文)
 * 输入：　srcStr 欲判断字符串, sFieldName 对象名称
 * 输出：　true 日期，　false 非日期
 */
function checkDateByValue_en(srcStr, sFieldName)
{	
	if (srcStr.length != 10) 
	{
		alert("【" + sFieldName + "】 format is wrong ！\n Please input the date example as【2000-10-10】");
		return false;
	}
	
	var year = srcStr.substring(0,4);
	var month = srcStr.substring(5,7);
	var day = srcStr.substring(8,10);
	var d_t1 = srcStr.substring(4,5);
	var d_t2 = srcStr.substring(7,8);	

	if (isNaN(day) || isNaN(month) || isNaN(year) || d_t1 != "-" || d_t2 != "-")
	{
		alert("【" + sFieldName + "】format is wrong ！\n Please input the date example as【2000-10-10】");
		return false;
	}
	if (day > 31 || day < 1 || month > 12 )
	{
		alert("【" + sFieldName + "】 The date is not exist！");
		return false;
	}
	if (month == 4 || month == 6 || month == 9 || month == 11)
	{
		if (day > 30)
		{
			alert("【" + sFieldName + "】The date is not exist！");
			return false;
		}	
	}
	if (month == 2)
	{
		if(year % 4 !=0 || (year % 400 != 0 && year % 100 == 0))
		{
			if(day > 28)
			{
				alert("【" + sFieldName + "】 The date is not exist！");
				return false;
			}
		}
		else
		{ 
			if( day > 29)
			{
				alert("【" + sFieldName + "】The date is not exist！");
				return false;
			}
		}
	}

	return true;	
}

