<?php
include("../session.php");
include("../connect.php");

$user=$_SESSION['admin'];
//echo "admin success!!!";

		$str = "SELECT Max(id) FROM company";
	
		$result2 = mysql_query ($str,$login);
		list($result2)=mysql_fetch_array($result2);
		$number = ++$result2;
			
		if($number == "1")
		{
			$number = "C000001";
		}
				
?>
<html>
<head>
<link href="header.css" rel="stylesheet" type="text/css"/>
<link type="text/css" rel="stylesheet" href="overflow.css" />
<script type="text/javascript" src="jquery.js"></script>
</head>
</head>
<body>
<!-----------------Outer table--------------->
<div id="content2">
<?php include("registerForm.php")?></td>
	


</div>
<!-----------------------End outer table-------------------------->
<script type="text/javascript">

function mobileCodeFun(no){
	document.getElementById("codes").value=no;
}
function vali(name,value){

if(value==''){
document.getElementById(name+'field').innerHTML='x invalid';
myObj=document.getElementById(name+"field");
myObj.style.color = "red";

 return;
}

if(name=='email'){
	var fmail= document.getElementById('email2').value;
	if((value!=fmail)&&(fmail!="")){
		document.getElementById('fEmailfield').innerHTML='*Not match email ';
	}else if(value==fmail){
		document.getElementById('fEmailfield').innerHTML='OK';
	}
}

if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById(name+'field').innerHTML=xmlhttp.responseText;
	myObj=document.getElementById(name+"field");
	
	if(xmlhttp.responseText=="OK"){
		myObj.style.color = "green";
	}else{
		myObj.style.color = "red";
	}
    }
  }
  
xmlhttp.open('GET','valiRegister.php?q='+name+'&q2='+value,true);

xmlhttp.send();
}

function valiMail(value,value2){

if(value2==''){
	document.getElementById('fEmailfield').innerHTML='*Please fill in';
	return;
}

if(value2!=value){
	document.getElementById('fEmailfield').innerHTML='*Not match email';
	myObj=document.getElementById("fEmailfield");
	myObj.style.color = "red";
	return;
}else{
	document.getElementById('fEmailfield').innerHTML='OK';
	myObj=document.getElementById("fEmailfield");
	myObj.style.color = "green";
}

}
</script>
<script type="text/javascript">
function finalCheck(){
var error=0;
var div = document.getElementById('cNamefield');
var div2 = document.getElementById('addressfield');
var div3 = document.getElementById('cNofield');
var div4 = document.getElementById('emailfield');
var div5 = document.getElementById('fEmailfield');
var div6 = document.getElementById('postfield');
var div7 = document.getElementById('classfield');
var div8 = document.getElementById('countryfield');



if(div.innerHTML!='OK'){
	
	//document.form1.name.value='';
	document.getElementById('cNamefield').innerHTML='*Please fill in';
	myObj=document.getElementById('cNamefield');
	myObj.style.color = "red";
	error++;
}

 if(div2.innerHTML!='OK'){
	//document.form1.ic.value='';
	document.getElementById('addressfield').innerHTML='*Please fill in';
	myObj=document.getElementById("addressfield");
	myObj.style.color = "red";
	error++;
} 
 if(div3.innerHTML!='OK'){
	//document.form1.dateOfBirth.value='';
	document.getElementById('cNofield').innerHTML='*Please fill in';
	myObj=document.getElementById("cNofield");
	myObj.style.color = "red";
	error++;
}
 if(div4.innerHTML!='OK'){
	//document.form1.gender.value='';
	document.getElementById('emailfield').innerHTML='*Please fill in';
	myObj=document.getElementById("emailfield");
	myObj.style.color = "red";
	error++;
}
 if(div5.innerHTML!='OK'){
	//document.form1.phoneNo.value='';
	document.getElementById('fEmailfield').innerHTML='*Please fill in';
	myObj=document.getElementById("fEmailfield");
	myObj.style.color = "red";
	error++;
}
 if(div6.innerHTML!='OK'){
	//document.form1.phoneNo.value='';
	document.getElementById('postfield').innerHTML='*Please fill in';
	myObj=document.getElementById("postfield");
	myObj.style.color = "red";
	error++;
}
  if(div7.innerHTML!='OK'){
	//document.form1.email.value='';
	document.getElementById('classfield').innerHTML='*Please select';
	myObj=document.getElementById("classfield");
	myObj.style.color = "red";
	error++;
}
 if(div8.innerHTML!='OK'){
	//document.form1.email.value='';
	document.getElementById('countryfield').innerHTML='*Please select';
	myObj=document.getElementById("countryfield");
	myObj.style.color = "red";
	error++;
}
 /*if(div8.innerHTML!='OK'){
	document.form1.file.value='';
	document.getElementById('filefield').innerHTML='*Please fill in';
	
	error++;
} */


if(error>0){
	alert('Please make sure all fields are properly completed.');
	return false;
}
else return true;
}
</script>


</body>
</html>