String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

function post1()
{
	tooltip("Enter Name Of Position","txtPost","130");
}

function jobprofile1()
{
	tooltip("Enter Job Profile","txtJobprofile","170");
}
function jobaddinfo()
{
	tooltip("Enter Additional Info For Job","txtaddinfo","170");
}
function dworkexp1()
{
	tooltip("Enter Desired Work Experience","txtworkexp","170");
}

function funcchoice2(disp)
{

	if(disp=="show")
	{
		document.getElementById("location2").style.display="";
		document.getElementById("choice2show").style.display="none";
		document.getElementById("choice2hide").style.display="";
	}
	else
	{		

		document.getElementById("location2").style.display="none";
		document.getElementById("choice2show").style.display="";
		document.getElementById("choice2hide").style.display="none";

		document.getElementById("city2").selectedIndex=0;
		document.getElementById("ddlVacancies2").selectedIndex=0;
	}
}

function funcchoice3(disp)
{

	if(disp=="show")
	{
		document.getElementById("location3").style.display="";
		document.getElementById("choice3show").style.display="none";
		document.getElementById("choice3hide").style.display="";
	}
	else
	{		

		document.getElementById("location3").style.display="none";
		document.getElementById("choice3show").style.display="";
		document.getElementById("choice3hide").style.display="none";

		document.getElementById("city3").selectedIndex=0;
		document.getElementById("ddlVacancies3").selectedIndex=0;
	}
}

function funcchoice4(disp)
{

	if(disp=="show")
	{
		document.getElementById("location4").style.display="";
		document.getElementById("choice4show").style.display="none";
		document.getElementById("choice4hide").style.display="";
	}
	else
	{		
		document.getElementById("location4").style.display="none";
		document.getElementById("choice4show").style.display="";
		document.getElementById("choice4hide").style.display="none";
		document.getElementById("city4").selectedIndex=0;
		document.getElementById("ddlVacancies4").selectedIndex=0;
	}
}

function funcchoice5(disp)
{

	if(disp=="show")
	{
		document.getElementById("location5").style.display="";
		document.getElementById("choice5show").style.display="none";
		document.getElementById("choice5hide").style.display="";
	}
	else
	{		
		document.getElementById("location5").style.display="none";
		document.getElementById("choice5show").style.display="";
		document.getElementById("choice5hide").style.display="none";
		document.getElementById("city5").selectedIndex=0;
		document.getElementById("ddlVacancies5").selectedIndex=0;
	}
}

function postd()
{
	if(document.getElementById("txtPost").value.trim()=="")
	{
		document.getElementById("error_post").innerHTML="<font color='white'>Please Enter Name Of Position</font>";
		document.getElementById("error_post").style.backgroundColor="red";
		return false;
	}else
	{
		document.getElementById("error_post").innerHTML="<font color='red'></font>";
		document.getElementById("error_post").style.backgroundColor="";
		return true;	
	}
		hidetip();		

}

function dWorkExp()
{	
//	alert(document.getElementById("txtworkexp").value.trim());
	if(document.getElementById("txtworkexp").value.trim()=="")
	{
		document.getElementById("error_workexp").innerHTML="<font color='white'>Please enter Desired Work Experience</font>";
		document.getElementById("error_workexp").style.backgroundColor="red";
		return false;
	}else
	{
		document.getElementById("error_workexp").innerHTML="";
		document.getElementById("error_workexp").style.backgroundColor="";

	return true;
	}
	hidetip();
}
function frmExpd()
{
	if(document.getElementById("frmExp").value=="0")
	{

		document.getElementById("error_exp").innerHTML="<font color='white'>Please Select From Experience</font>";
		document.getElementById("error_exp").style.backgroundColor="red";
		return false;
	}else
	{
		document.getElementById("error_exp").innerHTML="<font color='red'></font>";
		document.getElementById("error_exp").style.backgroundColor="";
		return true;	
	}
		hidetip();
}
function toExpd()
{
	if (document.getElementById("toExp").value=="0")
	{
		
		document.getElementById("error_exp").innerHTML="<font color='white'>Please Select To Experience</font>";
		document.getElementById("error_exp").style.backgroundColor="red";
		return false;
	}
	else if(document.getElementById("toExp").value=="0" && frmExpd()==false)
	{
		document.getElementById("error_exp").innerHTML="<font color='white'>Please Select From & To Experience</font>";
		document.getElementById("error_exp").style.backgroundColor="red";
		return false;
	}else
	{
		document.getElementById("error_exp").innerHTML="<font color='red'></font>";
		document.getElementById("error_exp").style.backgroundColor="";
		return true;	
	}
		hidetip();
}

function frmExp1()
{
	var x=document.getElementById("frmExp");
	var y=document.getElementById("toExp");
	y.options.length=0;
	var r=x.value;
	while (r<=35)
	{
		y.options[y.options.length] = new Option(r, r);
		r++;
	}
	document.getElementById("toExp").disabled=false;
}
function frmAged()
{
	if(document.getElementById("frmAge").value=="0")
	{
		document.getElementById("error_age").innerHTML="<font color='white'>Please Select From Age</font>";
		document.getElementById("error_age").style.backgroundColor="red";
		return false;
	}else
	{
		document.getElementById("error_age").innerHTML="<font color='red'></font>";
		document.getElementById("error_age").style.backgroundColor="";
		return true;	
	}
		hidetip();
}
function toAged()
{
	if (document.getElementById("toAge").value=="0")
	{
		
		document.getElementById("error_age").innerHTML="<font color='white'>Please Select To Age</font>";
		document.getElementById("error_age").style.backgroundColor="red";
		return false;
	}
	else if(document.getElementById("toAge").value=="0" && frmAged()==false)
	{
		document.getElementById("error_age").innerHTML="<font color='white'>Please Select From & To Age</font>";
		document.getElementById("error_age").style.backgroundColor="red";
		return false;
	}else
	{
		document.getElementById("error_age").innerHTML="<font color='red'></font>";
		document.getElementById("error_age").style.backgroundColor="";
		return true;	
	}
		hidetip();
}

function frmAge1()
{
	var x=document.getElementById("frmAge");
	var y=document.getElementById("toAge");
	y.options.length=0;
	var r=x.value;
	while (r<=50)
	{
		y.options[y.options.length] = new Option(r, r);
		r++;
	}
	document.getElementById("toAge").disabled=false;
}
function vacanciesd()
{
	if(document.getElementById("ddlVacancies").value=="0")
	{
		document.getElementById("error_vacancies").innerHTML="<font color='white'>Select No. Of Vacancies</font>";
		document.getElementById("error_vacancies").style.backgroundColor="red";
		return false;
	}else
	{
		document.getElementById("error_vacancies").innerHTML="<font color='red'></font>";
		document.getElementById("error_vacancies").style.backgroundColor="";
		return true;	
	}
		hidetip();		
}


function jobprofiled()
{
	if(document.getElementById("txtJobprofile").value=="")
	{
		document.getElementById("error_jobprofile").innerHTML="<font color='white'>Enter Job Profile</font>";
		document.getElementById("error_jobprofile").style.backgroundColor="red";
		return false;
	}else
	{
		document.getElementById("error_jobprofile").innerHTML="<font color='red'></font>";
		document.getElementById("error_jobprofile").style.backgroundColor="";
		return true;	
	}
		hidetip();		
}

function serviced()
{
	if(document.contactForm.ddlService.value=="")
	{
		document.getElementById("error_service").innerHTML="<font color='white'>Please select service</font>";
		document.getElementById("error_service").style.backgroundColor="red";
		return false;
	}else
	{
		document.getElementById("error_service").innerHTML="<font color='red'></font>";
		document.getElementById("error_service").style.backgroundColor="";
		return true;	
	}
		hidetip();		

}
function city1change()
{
	var w=document.getElementById("city1").selectedIndex;
	document.getElementById("ocity").value=document.getElementById("city1").options[w].text;
}
function jcity1change()
{
	var w=document.getElementById("jcity1").selectedIndex;
	document.getElementById("jhcity1").value=document.getElementById("jcity1").options[w].text;
}
function jcity2change()
{
	var w=document.getElementById("jcity2").selectedIndex;
	document.getElementById("jhcity2").value=document.getElementById("jcity2").options[w].text;
}
function jcity3change()
{
	var w=document.getElementById("jcity3").selectedIndex;
	document.getElementById("jhcity3").value=document.getElementById("jcity3").options[w].text;
}
function jcity4change()
{
	var w=document.getElementById("jcity4").selectedIndex;
	document.getElementById("jhcity4").value=document.getElementById("jcity4").options[w].text;
}
function jcity5change()
{
	var w=document.getElementById("jcity5").selectedIndex;
	document.getElementById("jhcity5").value=document.getElementById("jcity5").options[w].text;
}

function category()
{
	var w=document.getElementById("ddlJobCategory").selectedIndex;
	document.getElementById("txtfc1").value=document.getElementById("ddlJobCategory").options[w].text;
	var w1=document.getElementById("ddlJobsubcategory").selectedIndex;
	document.getElementById("txtrole1").value=document.getElementById("ddlJobsubcategory").options[w1].text;

}
function subcategory()
{
	var w=document.getElementById("ddlJobsubcategory").selectedIndex;
	document.getElementById("txtrole1").value=document.getElementById("ddlJobsubcategory").options[w].text;
}
function vacancy()
{
	var w=document.getElementById("ddlVacancies").selectedIndex;
	document.getElementById("txtvacancy").value=document.getElementById("ddlVacancies").options[w].text;
}
function level()
{
	var w=document.getElementById("ddlLevel").selectedIndex;
	document.getElementById("txtlevel").value=document.getElementById("ddlLevel").options[w].text;
}
function jlocation()
{
	var w=document.getElementById("jcity1").selectedIndex;
	document.getElementById("jcity").value=document.getElementById("jcity1").options[w].text;
}

function ug1()
{
	var w=document.getElementById("ugcourse").selectedIndex;
	document.getElementById("ugcourse1").value=document.getElementById("ugcourse").options[w].text;
	var w1=document.getElementById("ugspec").selectedIndex;
	document.getElementById("ougspec").value=document.getElementById("ugspec").options[w1].text;

}
function ugspec1()
{
	var w=document.getElementById("ugspec").selectedIndex;
	document.getElementById("ougspec").value=document.getElementById("ugspec").options[w].text;
}
function pg1()
{
	var w=document.getElementById("pgcourse").selectedIndex;
	document.getElementById("pgcourse1").value=document.getElementById("pgcourse").options[w].text;
	var w1=document.getElementById("pgspec").selectedIndex;
	document.getElementById("pgspec1").value=document.getElementById("pgspec").options[w1].text;

}

function pgspec1()
{
	var w=document.getElementById("pgspec").selectedIndex;
	document.getElementById("pgspec1").value=document.getElementById("pgspec").options[w].text;
}


function validateContactInformationForm()
{	var sCounter = 0;
	bStatus = true;
	if (companynamed() == false)
	{
		sCounter = parseInt(sCounter) + 1; 
	}
	if (named() == false)
	{
		sCounter = parseInt(sCounter) + 1; 
	}
	if (ValidateEmail()==false)
	{
		sCounter = parseInt(sCounter) + 1; 
	}
	if (companyaddressd()==false)
	{
		sCounter = parseInt(sCounter) + 1; 
	}
	
	/*if(city1check()==false)
	{
		sCounter = parseInt(sCounter) + 1; 
	}*/
	if (Validatemobile()==false)
	{
		sCounter = parseInt(sCounter) + 1; 
	}
	if (validatelandline()==false)
	{
		sCounter = parseInt(sCounter) + 1; 
	}
	
	if(jcity1check()==false)
	{
		sCounter = parseInt(sCounter) + 1; 
	}
	if (JobCategory()==false)
	{
		sCounter = parseInt(sCounter) + 1; 			
	} 
	if (JobsubCategory()==false && document.getElementById("role1").style.display=="")
	{
		sCounter = parseInt(sCounter) + 1; 			
	} 
	if (vacancy1check()==false)
	{
		sCounter = parseInt(sCounter) + 1; 			
	} 
	if (jobprofile1()==false)
	{
		sCounter = parseInt(sCounter) + 1; 			
	} 
	if (annualctc1d()==false)	
	{
		sCounter = parseInt(sCounter) + 1; 
	}
	
	if (postd()==false)	
	{
		sCounter = parseInt(sCounter) + 1; 
	}
	/*if (undgrad()==false)	
	{
		sCounter = parseInt(sCounter) + 1; 
	}
	if (undgradspec()==false && document.getElementById("spec1").style.display=="")	
	{
		sCounter = parseInt(sCounter) + 1; 
	}*/
	if (frmAged()==false)	
	{
		sCounter = parseInt(sCounter) + 1; 
	}
	if (frmExpd()==false)	
	{
		sCounter = parseInt(sCounter) + 1; 
	}
	/*if (dWorkExp()==false)	
	{
		sCounter = parseInt(sCounter) + 1; 
	}*/
	bStatus = false;

	if(parseInt(sCounter) > 0)
	{
		alert("There are some empty fields. Please complete the fields marked in red");
		return false;
	}else
	{
		document.fgfrm.action="emppost.asp";		
		alert("Form is Complete");

		document.fgfrm.submit();
		return true;
	}
}
