
 //jQuery.noConflict();

var xmlhttp;

function showCities(str)
{	

xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
 // var target = "http://grafixtreme.com/ocm/system/application/admin/views/"
  //var target = "http://mech59/clientmanagement/system/application/admin/views/"
 var action= "http://www.bayrozgar.com/get_city.php";
//var url=target + "message.php";
	//alert(url);
	//die();
	var img = '<img src=http://www.bayrozgar.com/images/loading.gif>';
		document.getElementById('div_city_list').innerHTML=img;
url=action+"?q="+str;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=cityChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function cityChanged()
{
if (xmlhttp.readyState==4)
{
document.getElementById("div_city_list").innerHTML=xmlhttp.responseText;
}
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}


 //jQuery.noConflict();

var xmlhttp;

function check()
{	

		email = document.getElementById("email").value;				
		
		//alert(email);
		 var url="http://www.bayrozgar.com/email_check.php?email="+email;				  
		  var img = '<img src=http://www.bayrozgar.com/images/loading.gif>';
		 document.getElementById('div_user_email').innerHTML=img;
		  if (window.XMLHttpRequest)
		  
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  
		  xmlhttp=new XMLHttpRequest();
		  
		  }
		  
		  else
		  
		  {// code for IE6, IE5
		  
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  
		  }
		  
		 xmlhttp.open("GET",url,false);
		  
		 xmlhttp.send();
		  
		 document.getElementById('div_user_email').innerHTML=xmlhttp.responseText;
		 
		 
}

function setProfessionalInformation(str){
	
	if(str == 1){
		$("#div_professional_information").show();	
	}
	else if(str == 0){
		$("#div_professional_information").hide();
	}
}

function getSelectedRadioValue(buttonGroup) {
   // returns the value of the selected radio button or "" if no button is selected
   var i = getSelectedRadio(buttonGroup);
   if (i == -1) {
      return "";
   } else {
      if (buttonGroup[i]) { // Make sure the button group is an array (not just one button)
         return buttonGroup[i].value;
      } else { // The button group is just the one button, and it is checked
         return buttonGroup.value;
      }
   }
} // Ends the "getSelectedRadioValue" function

function valForm()
{
		
$("#div_user_email").text("");
$("#div_pass").text("");
$("#div_repass").text("");
$("#div_first_name").text("");
$("#div_gender").text("");
$("#div_country").text("");
$("#div_mobile1").text("");
$("#div_degree_level").text("");
$("#div_total_experience").text("");
//$("#div_future").text("");
$("#wasim").text("");
$("#div_dob").text("");

$("#div_personal_information").text("");
$("#div_exp_status").text("");
$("#div_passing_year").text("");
$("#div_academic_information").text("");
$("#div_professional_industry").text("");
/*$("#div_latest_job").text("");
$("#div_duration").text("");
$("#div_company").text("");*/
$("#div_private").text("");


if(document.hello.email.value == "")
{
 $("#div_user_email").text("please Enter email address");

}

   
	else if(document.hello.pass.value.length<6){
	$("#div_pass").text("please enter passowrd 6 character long");
	
}
else if(document.hello.repass.value != document.hello.pass.value){
	$("#div_repass").text("Passwords are not same");
	
}
else if(document.hello.firstname.value == ""){
	$("#div_first_name").text("please enter First Name");

}
/*else if(document.hello.lastname.value == ""){
	$("#div_last_name").text("please enter last name");

}*/
else if(document.hello.gender.value == ""){
	$("#div_gender").text("please Select Gender");
	
}

else if(document.hello.month.value == "" || document.hello.day.value == "" || document.hello.year.value == ""){
	$("#div_date").text("please Select a Date");
	
}
else if(document.hello.country.value == ""){
	$("#div_country").text("please Select Country");
	
}

else if(document.hello.phone_code2.value == "" || document.hello.phone_ext2.value == "" || document.hello.phone_no2.value == ""){
	$("#div_mobile").text("please Enter Mobile No.");
	
}

else if(document.hello.degree_level.value == ""){
	$("#div_degree_level").text("Please Select Degree Level");
	
}



else if(document.hello.professional_summary.value == ""){
	$("#div_future").text("Please Enter your objectives");
	
}



else if(document.hello.address1.value == ""){
	$("#div_personal_information").text("Please Enter Address");
}

else if(document.hello.year_of_passing.value == ""){
	$("#div_passing_year").text("Please Select year of passing");
	
}

else if(document.hello.institution.value == ""){
	$("#div_academic_information").text("Please Enter Institute Name");
}

else if (document.forms['hello'].exp_status[0].checked ==false && document.forms['hello'].exp_status[1].checked ==false ){
	$("#div_exp_status").text("Please Select One Option");
	
}


else if(document.hello.totalexperience.value == ""){
	$("#div_total_experience").text("Please Select Experience");
	
}

else if(document.hello.industry.value == ""){
	$("#div_professional_industry").text("Please select Professional Industry");
}

/*else if(document.hello.latest_job_title.value == ""){
	$("#div_latest_job").text("Please Enter Job Title");
}

if(document.hello.company.value == ""){
	$("#div_company").text("Please Enter Company Name");
	
}

if(document.hello.fromMonth.value == ""){
	$("#div_duration").text("Select duration");
}

if(document.hello.fromYear.value == ""){
	$("#div_duration").text("Select duration");
}

if(document.hello.toMonth.value == ""){
	$("#div_duration").text("Select duration");
}

if(document.hello.toYear.value == ""){
	$("#div_duration").text("Select duration");
}
*/
else if (document.forms['hello'].private[0].checked ==false && document.forms['hello'].private[1].checked ==false ){

	$("#div_private").text("Select One Option");
}


var email = document.hello.email.value;
	  var pass = document.hello.pass.value;
	  var firstname = document.hello.firstname.value;
	  //var lastname = document.hello.lastname.value;
	  var gender = document.hello.gender.value;
	  var country = document.hello.country.value;
	  var city = document.hello.city.value;
	  var degree =  document.hello.degree_level.value;
	  
	  var summary = document.hello.professional_summary.value;
	  var code = document.hello.security_code.value;
	  var month = document.hello.month.value;
	  var day = document.hello.day.value;
	  var year = document.hello.year.value;
	  var repass = document.hello.repass.value;
	  
	  
	  
	var address = document.hello.address1.value;
	
	//var address2 = document.hello.address2.value;
	
	var passingyear = document.hello.year_of_passing.value;
	
	var institution = document.hello.institution.value;
	
	var totalexperience = document.hello.totalexperience.value;
	
	var industry = document.hello.industry.value;
	
	var jobtitle = document.hello.latest_job_title.value;
	
	var company = document.hello.company.value;
	
	var fromMonth = document.hello.fromMonth.value;
	
	var fromYear = document.hello.fromYear.value;
	
	var toMonth = document.hello.toMonth.value;
	
	var toYear = document.hello.toYear.value;
	
	var phonecode1 = document.hello.phone_code1.value;
	
	var phoneext1 = document.hello.phone_ext1.value;
	
	var phoneno1 = document.hello.phone_no1.value;
	
	var phonecode2 = document.hello.phone_code2.value;
	
	var phoneext2 = document.hello.phone_ext2.value;
	
	var phoneno2 = document.hello.phone_no2.value;
	
	var type = document.hello.type.value;
	
	//var cvstatus= document.hello.private.value;
	
 	//var stat= document.forms['hello'].private.value;
	var stat=document.getElementById('private').checked;
	
	if (stat==false){
		
		cvstatus="1";
	}else{
	 
	 	cvstatus="2"	
	}
	
	var expstatus = document.getElementById('exp_status');
	if(expstatus.checked == true){
	var expire = "1";
	}
	
if(expstatus.checked == false){
	var totalexperience = "1";
	
	var industry = "1";
	
	var jobtitle = "1";
	
	var company = "1";
	
	var fromMonth = "1";
	
	var fromYear = "1";
	
	var toMonth = "1";
	
	var toYear = "1";
	
	var expire = "0";
	
}
/*alert(totalexperience);
alert(industry);
alert(jobtitle);
alert(company);
alert(fromMonth);
alert(fromYear);
alert(toMonth);
alert(toYear);*/

	if(document.hello.email.value == "" || document.hello.pass.value.length<6 || document.hello.firstname.value == "" || document.hello.gender.value == "" || document.hello.country.value == "" || document.hello.degree_level.value == "" || totalexperience == "" || document.hello.professional_summary.value == "" || document.hello.security_code.value == "" || document.hello.repass.value != document.hello.pass.value || document.hello.address1.value == "" || document.hello.year_of_passing.value == "" || document.hello.institution.value == "" || industry == "" || jobtitle == "" || company == "" || fromMonth == "" || fromYear == "" || toMonth == "" || toYear == "" || cvstatus == "")
								{
									
								 return false;
								}


 if(document.hello.email.value != "")
		{
			var address = document.hello.email.value;
			var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
			if(reg.test(address) == false) {
			  $("#div_user_email").text("please Enter Valid email address");
			  return false;
  	  						 }
		}

	
	    if(document.hello.email.value != "" && document.hello.pass.value.length>=6 && document.hello.firstname.value != "" && document.hello.gender.value != "" && document.hello.country.value != "" && document.hello.degree_level.value != "" && totalexperience != "" && document.hello.professional_summary.value != "" && document.hello.security_code.value != "" && document.hello.repass.value == document.hello.pass.value && document.hello.address1.value != "" && document.hello.year_of_passing.value != "" && document.hello.institution.value != "" && industry != "" && jobtitle != "" && company != "" && fromMonth != "" && fromYear != "" && toMonth != "" && toYear != "" && cvstatus != "")
	{
		/*alert('wasim');
		return false;*/
	 
	   
	  
	  //alert(email);
	  var url="http://www.bayrozgar.com/index_signup_process.php?email="+email+"&pass="+pass+"&firstname="+firstname+"&gender="+gender+"&country="+country+"&city="+city+"&degree="+degree+"&totalexperience="+totalexperience+"&summary="+summary+"&code="+code+"&month="+month+"&day="+day+"&year="+year+"&repass="+repass+"&address="+address+"&passingyear="+passingyear+"&institution="+institution+"&industry="+industry+"&jobtitle="+jobtitle+"&company="+company+"&fromMonth="+fromMonth+"&fromYear="+fromYear+"&toMonth="+toMonth+"&toYear="+toYear+"&phonecode1="+phonecode1+"&phoneext1="+phoneext1+"&phoneno1="+phoneno1+"&phonecode2="+phonecode2+"&phoneext2="+phoneext2+"&phoneno2="+phoneno2+"&expstatus="+expire+"&type="+type+"&cv_status="+cvstatus;
			// alert(url);
			var img = '<img src=http://www.bayrozgar.com/images/loading.gif>';
			document.getElementById('message').innerHTML=img;
			  if (window.XMLHttpRequest)
			  
			  {// code for IE7+, Firefox, Chrome, Opera, Safari
			  
				 xmlhttp=new XMLHttpRequest();
			  
			  }
			  
			  else
			  
			  {// code for IE6, IE5
			  
			  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			  
			  }
			  
			 xmlhttp.open("GET",url,false);
			  
			 xmlhttp.send();
			 var response_id=xmlhttp.responseText;
			
			 
				if(response_id == "3")
					{
						
						 var newURL = "http://www.bayrozgar.com/signup_messege.php?height=200&width=680&model=true";
						 
						 tb_show("Registration Successfull", newURL);
					}
					 if(response_id != "3")
						 {
						  document.getElementById('message').innerHTML=xmlhttp.responseText;
						 }
						  
			 
	  return false;
	}

	
	


} // --- function end ---------------
// --------------------------------------------------------------------------------------------






