<!-- 
function createxmlhttp()
{
 var xmlhttp=false;
 try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e) {
    try {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
  catch (e) {
      xmlhttp = false;
   }
  }
 if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
    if (xmlhttp.overrideMimeType) {//设置MiME类别
   xmlhttp.overrideMimeType('text/xml');
  }
 } 
 return xmlhttp; 
}
//getdata()获取指定URL的数据在obj2里面显示,obj1是本过程的提示信息,可删除
function send_request(url)
{
  var xmlhttp=createxmlhttp();
  if(!xmlhttp)
  {
   alert("Create XMLHTTP failed！");
   return;
  }
  xmlhttp.onreadystatechange=requestdata;
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);

function requestdata(){
  　if(xmlhttp.readyState==4){//判断对象状态
　　if(xmlhttp.status==200){//信息已成功返回，开始处理信息
　　 　 　document.getElementById("applycontent").innerHTML=xmlhttp.responseText;
　　 　 }
　　 　 else{//页面不正常
　　 　 　alert("Page Error！");
　　 　 }
　  }
}
}
//postdata()发送指定的数据data到url地址,并且使用obj来显示返回的数据
function postdata(url,data)
{ 
  var xmlhttp=createxmlhttp();
  if(!xmlhttp)
  {
   alert("Create XMLHTTP failed！！");
   return;
  }
  var obj=document.getElementById("applycontent");
  obj.innerHTML="<div style=\"border:1pt solid #BF9477; background-color:#F9F3F2;height:30px;width:400px;text-align:center; line-height:40px;\"><img src=\"images/loading.gif\" />Loading data...</div>";
  xmlhttp.open("POST",url+"?"+data, true);
  xmlhttp.onreadystatechange=requestdata;
  xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  xmlhttp.send(data);
  function requestdata()
  {
   if(xmlhttp.readyState==4)
   {
    if(xmlhttp.status==200)
    {
		if(xmlhttp.responseText=="LOGINED")
		{
			send_apply(url);
		}
		else if(xmlhttp.responseText=="SEND_OK")
		{
			obj.innerHTML="";
			alert("Apply successful,please wait for checking,we will contact with you very soon");
		}
		else if(xmlhttp.responseText=="SENT")
		{
			obj.innerHTML="";
			alert("This job you have applyed!");
		}
		else
		{
			alert("Username or password is wrong");
			send_request(url);
		}
		
    }
   }
  }
} 

function send_apply(url)
{
  var xmlhttp=createxmlhttp();
  if(!xmlhttp)
  {
   alert("Create XMLHTTP failed！");
   return;
  }
  xmlhttp.onreadystatechange=requestapply;
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);

function requestapply(){
  　if(xmlhttp.readyState==4){//判断对象状态
　　if(xmlhttp.status==200){//信息已成功返回，开始处理信息
　　 　 　document.getElementById("applycontent").innerHTML=xmlhttp.responseText;
　　 　 }
　　 　 else{//页面不正常
　　 　 　alert("Page Error！");
　　 　 }
　  }
}	
}

function checklogin()
{
	if(goldfrm.username.value=="")
	{
		alert("Please input your username");
		return;
	}
	if(goldfrm.password.value=="")
	{
		alert("Please input your password");
		return;
	}
	data="action=login&username="+escape(goldfrm.username.value)+"&password="+escape(goldfrm.password.value)+"&schoolemail="+escape(document.getElementById('_SCHOOOLEMAIL').value)+"&jobid="+escape(document.getElementById('_JOBID').value)+"&schoolid="+escape(document.getElementById('_SCHOOLID').value);
	postdata("checksend.php",data);
	
}


function checkok() 
{ 
    var frm=document.userlog; 
    if(frm.user.value=="") 
    { 
        alert("please input your account name"); 
        frm.user.focus(); 
        return false; 
    } 
    if(frm.pwd.value=="") 
    { 
        alert("please input your password"); 
        frm.pwd.focus(); 
        return false; 
    } 
} 

function checksend()
{
	if(goldfrm.email.value=="")
	{
		alert("Please input your email");
		return ;
	}
	if(goldfrm.subject.value=="")
	{
		alert("Please input your subject");
		return ;
	}
	if(goldfrm.content.value=="")
	{
		alert("Please input your content");
		return ;
	}
	if(goldfrm.content.value.length>300)
	{
		alert("Content length must be less than 300 letters");
		return ;
	}
	data="action=send&schoolid="+escape(document.getElementById('_SCHOOLID').value)+"&jobid="+escape(document.getElementById('_JOBID').value)+"&subject="+escape(goldfrm.subject.value)+"&content="+escape(goldfrm.content.value);
	postdata("checksend.php",data);
}



function checkemail(email) 
  { 
    var str=email; 
    var i=str.indexOf("@"); 
    var j=str.indexOf("."); 
    var k=str.length-1-j; 
    if((i<1)||(i-j>1)||(j<1)||(k<0))  
     return true; 
    else 
      return false; 
}  

function MM_swapImgRestore() { //v3.0 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; 
} 

function MM_preloadImages() { //v3.0 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); 
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) 
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} 
} 

function MM_findObj(n, d) { //v4.01 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { 
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} 
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; 
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); 
  if(!x && d.getElementById) x=d.getElementById(n); return x; 
} 

function MM_swapImage() { //v3.0 
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) 
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} 
} 
//--> 

