/* @Revision $Revision: 2318 $
  * @Author $Author: rahul $
  * @Date $Date: 2009-08-27 13:40:01 +0530 (Thu, 27 Aug 2009) $
 */

// JavaScript Document
function showPopup(div1,div2){
	document.getElementById('art1').innerHTML=document.getElementById(div1).innerHTML;
	document.getElementById(div2).style.display='block';
}
function closeSignin(){
	document.getElementById('goin').style.display='none';
	//document.getElementById('goin2').style.display='none';
}
function openSignin(){

	document.getElementById('goin').style.display='block';

	//document.getElementById('goin2').style.display='block';

}
function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,'');
}


function trim1(stringToTrim)
{

return stringToTrim.replace(/^\s*|\s*$/g,'');


}





function echeck(email){
	if(email=="" || email=="* Name"){
		alert('Please enter email -id');
		return false;
	}
	else{
		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		if(reg.test(email) == false) {
			alert('Invalid email address..');
			return false;
		}
	}
}

function validateRegister(frm){
	if(echeck(trim(frm.email_reg.value))==false){
		frm.email_reg.focus();
		document.getElementById('createmy').style.display='block';
		return false;
	}
	var pwd1 =trim(frm.pwd_reg.value);
	if(pwd1.length <6){
		alert("Password must be atleast 6 characters long");
		frm.pwd_reg.focus();
		document.getElementById('createmy').style.display='block';
		return false;
	}
	var pwd2 = trim(frm.pwd2_reg.value);
	if(pwd1 != pwd2){
		alert("Both passwords are not matching each other")	;
		frm.pwd_reg.focus();
		document.getElementById('createmy').style.display='block';
		return false;
	}
	if(trim(frm.firstname.value)==""){
		alert("Name field must not be blank");
		frm.firstname.focus();
		document.getElementById('createmy').style.display='block';
		return false;

	}
	if((trim(frm.firstname.value).length)<4){
		alert("First name field must be atleast 3 characters long");
		frm.firstname.focus();
		document.getElementById('createmy').style.display='block';
		return false;

	}
	if(trim(frm.lastname.value)==''){
		alert("Last name must not be blank");
		frm.lastname.focus();
		document.getElementById('createmy').style.display='block';
		return false;
	}

if(trim(frm.mobile_reg.value)==''){
		alert("Please enter your mobile number");
		frm.mobile_reg.focus();
		document.getElementById('createmy').style.display='block';
		return false;
	}
var l1=frm.mobile_reg.value
if (l1.length<10)
{
	alert("Phone number must be 10 digit number.")
	frm.mobile_reg.value="";
	frm.mobile_reg.focus();
	document.getElementById('createmy').style.display='block';
	return false
	}


	if(frm.gender_reg.value ==''){
		alert("Please select your gender");
		frm.gender_reg.focus();
		document.getElementById('createmy').style.display='block';
		return false;
	}
	if(trim(frm.currently_reg.value)==''){
		alert("Please enter currently field");
		frm.currently_reg.focus();
		document.getElementById('createmy').style.display='block';
		return false;
	}
	if(trim(frm.secImg_reg.value)==''){
		alert("Please enter picture code");
		frm.secImg_reg.focus();
		document.getElementById('createmy').style.display='block';
		return false;
	}
	return true;
}

function toggleDiv(divid)
{

    if(document.getElementById(divid).style.display == 'none')
	{
      document.getElementById(divid).style.display = 'block';
      if (divid == 'appmain') {	window.location.href = '#appmain';	  }
	  else { 	window.location.href = '#';	 }
    }else
	{
      document.getElementById(divid).style.display = 'none';
    }

}


function toggleDiv11(divid)
{
  if(document.getElementById(divid).style.display == 'none')
	{
      document.getElementById(divid).style.display = 'block';
    }else
	{
      document.getElementById(divid).style.display = 'none';
    }
}

function chkpayment(){

	var rlusrid =document.getElementById('rlusrid').value;
	//alert(rlusrid);//alert(document.frm_pay.payType[0].value);
	//return false;
	if(document.frm_pay.payType[0].checked){
		document.frm_pay.action="card_submit.php?"+rlusrid;
		document.frm_pay.submit();
	}
	else{
		document.frm_pay.action="pay_chk.php?"+rlusrid;
		document.frm_pay.submit();
	}
}

function Validateauthform(a){if(trim(a.email.value)==""){alert("Please enter the email");a.email.focus();return false}if(echeck(a.email.value)==false){a.email.value="";a.email.focus();return false}if(trim(a.pass.value)==""||trim(a.pass.value)==0){alert("Please enter the password");a.pass.focus();return false}return true}

function validatereg_1(frm){

	if(trim(frm.educity.value)==-1){
		alert('Please select the city of your university/college ');
		frm.educity.focus();
		return false;
	}
	if(trim(frm.educity.value)==''&& trim(frm.citi_other.value)=='other city'){
		alert("Please select the city of your university/college");
		frm.citi_other.focus();
		return false;
	}
	if(trim(frm.insti_name.value)==''){
		alert("Please enter your institute name")	;
		frm.insti_name.focus();
		return false;

	}
	if(trim(frm.course.value)==-1){
		alert("Please select the course you did");
		frm.course.focus();
		return false;
	}
	if(trim(frm.course.value)=="" && trim(frm.cors_other.value)=='Other course'){
		alert("Please select the course you did");
		frm.cors_other.focus();
		return false;
	}
	if(trim(frm.spec.value)==-1){
		alert("Please select your specialization");
		frm.spec.focus();
		return false;
	}
	if(trim(frm.spec.value)=="" && trim(frm.other_spec.value)=='Other specialization'){
		alert("Please select your specialization");
		frm.other_spec.focus();
		return false;
	}
	if(trim(frm.yop_mnth.value)==-1){
		alert("Please select the month of passing");
		frm.yop_mnth.focus();
		return false;
	}
	if(trim(frm.yop_yr.value)==-1){
		alert("Please select the year of passing");
		frm.yop_yr.focus();
		return false;
	}
	if(trim(frm.scoreType.value)==-1){
		alert("Please select your grading system");
		frm.scoreType.focus();
		return false;
	}
	if(trim(frm.scoreType.value)=="" && trim(frm.other_scor.value)=='Other'){
		alert("Please select your grading system");
		frm.other_scor.focus();
		return false;
	}
	if(trim(frm.marks_sec.value)==''){
		alert("Please enter the marks you secured");
		frm.marks_sec.focus();
		return false;
	}
	if(trim(frm.board12.value)==-1){
		alert("Please select the board of your 12th classes");
		frm.board12.focus();
		return false;
	}
	if(trim(frm.marks12.value)==''){
		alert("Please enter the marks of your 12th classes");
		frm.marks12.focus();
		return false;
	}

		if (trim(frm.marks12.value)!='')
       {
          var fname=frm.marks12.value;
		  var re = /^[0-9.]+$/;
		  if (re.test(fname)==false)
          {
          alert("Only numbers and . is allowed");
		  frm.marks12.focus();
          return false;
          }
      }

	if(trim(frm.marks12.value)>100){
		alert("Please enter less than or equal to 100 for 12th class marks");
		frm.marks12.focus();
		return false;
	}
	if(trim(frm.yop12.value)==-1){
		alert("Please select  your year of passing (12th)");
		frm.yop12.focus();
		return false;
	}
	if(trim(frm.medium12.value)==-1){
		alert("Please select  your medium (12th)");
		frm.medium12.focus();
		return false;
	}
	if(trim(frm.school12.value)==""){
		alert("Please enter your college/school name for 12th class");
		frm.school12.focus();
		return false;
	}
	if(trim(frm.board10.value)==-1){
		alert("Please select the board of your 10th classes");
		frm.board10.focus();
		return false;
	}
		if(trim(frm.marks10.value)==''){
		alert("Please enter the marks of your 10th classes");
		frm.marks10.focus();
		return false;
	}
	if(trim(frm.marks10.value)>100){
		alert("Please enter less than or equal to 100 for 10th class marks");
		frm.marks10.focus();
		return false;
	}
	if (trim(frm.marks10.value)!='')
       {
          var fname=frm.marks10.value;
		  var re = /^[0-9.]+$/;
		  if (re.test(fname)==false)
          {
          alert("Only numbers and . is allowed");
		  frm.marks10.focus();
          return false;
          }
      }
	if(trim(frm.yop10.value)==""){
		alert("Please select  your year of passing (10th)");
		frm.yop10.focus();
		return false;
	}
	if(trim(frm.medium10.value)==-1){
		alert("Please select  your medium (10th)");
		frm.medium10.focus();
		return false;
	}
	if(trim(frm.school10.value)==""){
		alert("Please enter your college/school name for 10th class");
		frm.school10.focus();
		return false;
	}
	if(trim(frm.dob_d.value)==-1){
		alert("Please select  your date of birth");
		frm.dob_d.focus();
		return false;
	}
	if(trim(frm.dob_m.value)==-1){
		alert("Please select  your month of birth");
		frm.dob_m.focus();
		return false;
	}
	if(trim(frm.dob_y.value)==-1){
		alert("Please select  your year of birth");
		frm.dob_y.focus();
		return false;
	}
		if(trim(frm.fathername.value)==""){
		alert("Please enter your father's name");
		frm.fathername.focus();
		return false;
	}
		if(trim(frm.lknown.value)==""){
		alert("Please enter the language known");
		frm.lknown.focus();
		return false;
	}
	if(trim(frm.mobilenum.value)==""){
		if(trim(frm.phonenum_1.value)=="" || trim(frm.phonenum_1.value)=="STD"){
			alert("Please enter either your mobile number or phone number");
			frm.mobilenum.focus();
			return false;
		}
		if(trim(frm.phonenum_2.value)=="" || trim(frm.phonenum_2.value)=="Number"){
			alert("Please enter  phone number ");
			frm.phonenum_2.focus();
			return false;
		}

	}
	if(trim(frm.city_curr.value)==-1){
		alert("Please select your current city of residence");
		frm.city_curr.focus();
		return false;
	}
	if(trim(frm.city_curr.value)=="" && trim(frm.citi_curr1.value)=='other city'){
		alert("Please select your current city of residence");
		frm.citi_curr1.focus();
		return false;
	}
	if(trim(frm.citi_per.value)==-1){
		alert("Please select your permanant city of residence");
		frm.citi_per.focus();
		return false;
	}
	if(trim(frm.citi_per.value)=="" && trim(frm.citi_per1.value)=='other city'){
		alert("Please select your permanant city of residence");
		frm.citi_per1.focus();
		return false;
	}
	if(trim(frm.permaddr.value)==""){
		alert("Please enter permanent address");
		frm.permaddr.focus();
		return false;
	}
	//alert(frm.educationType.value);
	if(frm.educationType.value=='masters')
	{
		if(trim(frm.posteducity.value)==-1){
		alert('Please select the city of your university/college ');
		frm.posteducity.focus();
		return false;
	}
	if(trim(frm.postinsti_name.value)==''){
		alert("Please enter your institute name")	;
		frm.postinsti_name.focus();
		return false;

	}
	if(trim(frm.postcourse.value)==-1){
		alert("Please select the course you did");
		frm.postcourse.focus();
		return false;
	}
	if(trim(frm.postcourse.value)=="" && trim(frm.postcors_other.value)=='Other course'){
		alert("Please select the course you did");
		frm.postcors_other.focus();
		return false;
	}

   oSelect = document.getElementById ('postspec');
    var iNumSelected = 0;
    for (var iCount=0; oSelect.options[iCount]; iCount++) {
        if (oSelect.options[iCount].selected == true) {
            iNumSelected ++;
        }
    }
    if (iNumSelected > 2) {
        alert ('Select at most two options for post gratuation specialization');
        document.getElementById ('postspec').focus();
        return false;
    }
    if(iNumSelected=="1" && trim(frm.postother_spec.value)=='Other specialization'){
		alert("Please select specialization for post graduation");
		frm.postother_spec.focus();
		return false;
	}
	if(trim(frm.postyop_mnth.value)==-1){
		alert("Please select the month of passing");
		frm.postyop_mnth.focus();
		return false;
	}
	if(trim(frm.postyop_yr.value)==-1){
		alert("Please select the year of passing");
		frm.postyop_yr.focus();
		return false;
	}
	if(trim(frm.postscoreType.value)==-1){
		alert("Please select your grading system");
		frm.postscoreType.focus();
		return false;
	}
	if(trim(frm.postmarks_sec.value)==''){
		alert("Please enter the marks you secured");
		frm.postmarks_sec.focus();
		return false;
	}
	}
	return true;
}


function textCounter(field,cntfield,maxlimit)
 {// alert("hi in textcounter");
   if (field.value.length > maxlimit) // if too long...trim it!
   field.value = field.value.substring(0, maxlimit);
   // otherwise, update 'characters left' counter
   else
   cntfield.value = maxlimit - field.value.length;
 }
function pwdvalidate(frm){

	var pwd1 =trim(frm.pwd_reg.value);
	if(pwd1.length <6){
		alert("Password must be atleast 6 characters long");
		frm.pwd_reg.focus();
		//alert('hi');
		//return ;
	}
	else{
	var pwd2 = trim(frm.pwd2_reg.value);
	if(pwd1 != pwd2){
		alert("Both passwords are not matching each other")	;
		frm.pwd_reg.focus();

	}
	}
	//return ;
}
/*function show()
{
		if(document.topheadsearch.tsearch.value =='Keyword(Eg:Sales,Java..)' || document.topheadsearch.tsearch.value == '')
		{
			document.getElementById('tsearch').value = "Keyword(Eg:Sales,Java..)";
		}
}
*/



/*function hide()
{
	if(document.topheadsearch.tsearch.value =='Keyword(Eg:Sales,Java..)' || document.topheadsearch.tsearch.value == '')
		{
		document.getElementById('tsearch').value = "";
		}
}
*/

function valid()
{
//alert("kumar");
//alert(document.topheadsearch.tsearch.value);
var keyword=trim(document.topheadsearch22.tsearch.value)
var locations=trim(document.topheadsearch22.locations.value)
//alert(keyword);

if(keyword =='Eg:Sales,Java..' && locations =='Job location')
	{
		alert("Enter Keyword or Job Location");
		document.topheadsearch22.tsearch.focus();
		return false;
	}
	 if(keyword =='Eg:Sales,Java..')
	{
	document.topheadsearch22.tsearch.value='';

	}

	 if(locations =='Job location')
	{
		document.topheadsearch22.locations.value='';

	}

	if(keyword =='' && locations=='')
	{
		alert("Enter Keyword or Job Location");
		document.topheadsearch22.tsearch.focus();
		return false;
	}

	else if(keyword =='' && locations=='Job location')
	{
		alert("Enter Keyword or Job Location");
		document.topheadsearch22.tsearch.focus();
		return false;
	}
	else if(keyword =='Eg:Sales,Java..' && locations=='')
	{
		alert("Enter Keyword or Job Location");
		document.topheadsearch22.tsearch.focus();
		return false;
	}

return true;

}


function valid11()
{
//alert("kumar");
//alert(document.topheadsearch.tsearch.value);
var keyword=trim(document.topheadsearch33.tsearch.value)
var locations=trim(document.topheadsearch33.locations.value)
//alert(keyword);

if(keyword =='Eg:Sales,Java..' && locations =='Job location')
	{
		alert("Enter Keyword or Job Location");
		document.topheadsearch33.tsearch.focus();
		return false;
	}
	 if(keyword =='Eg:Sales,Java..')
	{
	document.topheadsearch33.tsearch.value='';

	}

	 if(locations =='Job location')
	{
		document.topheadsearch33.locations.value='';

	}

	if(keyword =='' && locations=='')
	{
		alert("Enter Keyword or Job Location");
		document.topheadsearch33.tsearch.focus();
		return false;
	}
	else if(keyword =='' && locations=='Job location')
	{
		alert("Enter Keyword or Job Location");
		document.topheadsearch33.tsearch.focus();
		return false;
	}
	else if(keyword =='Eg:Sales,Java..' && locations=='')
	{
		alert("Enter Keyword or Job Location");
		document.topheadsearch33.tsearch.focus();
		return false;
	}


return true;

}



/*function validm()
{
//alert(document.topheadsearch.tsearch.value);
if(document.topheadsearch.tsearch.value =='Keyword(Eg:Sales,Java..)' || document.topheadsearch.tsearch.value == '')
	{
		alert("Please the search string");
		document.topheadsearch.tsearch.value='';
		document.topheadsearch.tsearch.focus();
		return false;
	}
document.topheadsearch.submit();
}*/




$(document).ready(function()
{
    //alert("hello");
   var el1=document.getElementById('locations').value;
   //alert(el1);
	if (!el1) return;
	var matches = el1.match(el1);
	//alert(matches)

	 if (!matches) return;
	 //var terms = unescape(matches[1].replace(/\+/g, ' '));
	 var terms = matches;
	 var re = new RegExp().compile('(' + terms + ')', 'i');
	 $("#candidatemain *").each(function()
	  { if ($(this).children().size() > 0) return;
	 if ($(this).is("xmp, pre")) return; var html = $(this).html();
	 var newhtml = html.replace(re, '<span class="qterm">$1</span>');
	 //alert(newhtml);
	 $(this).html(newhtml);
	  });
	   });
$(document).ready(function()
{
   var el1=document.getElementById('tsearch').value
  //alert(el1);
	if (!el1) return;
	var matches = el1.match(el1);
	//alert(matches)

	 if (!matches) return;
	 //var terms = unescape(matches[1].replace(/\+/g, ' '));
	 var terms = matches;
	 var re = new RegExp().compile('(' + terms + ')', 'i');
	 $("#candidatemain *").each(function()
	  { if ($(this).children().size() > 0) return;
	 if ($(this).is("xmp, pre")) return; var html = $(this).html();
	 var newhtml = html.replace(re, '<span class="qterm">$1</span>');
	 //alert(newhtml);
	 $(this).html(newhtml);
	  });
	   });



$(document).ready(function()
{
   var el1=document.getElementById('locations').value
  //alert(el1);
	if (!el1) return;
	var matches = el1.match(el1);
	//alert(matches)

	 if (!matches) return;
	 //var terms = unescape(matches[1].replace(/\+/g, ' '));
	 var terms = matches;
	 var re = new RegExp().compile('(' + terms + ')', 'i');
	 $("#coverguidance *").each(function()
	  { if ($(this).children().size() > 0) return;
	 if ($(this).is("xmp, pre")) return; var html = $(this).html();
	 var newhtml = html.replace(re, '<span class="qterm">$1</span>');
	 //alert(newhtml);
	 $(this).html(newhtml);
	  });
	   });


$(document).ready(function()
{
   var el1=document.getElementById('tsearch').value
  //alert(el1);
	if (!el1) return;
	var matches = el1.match(el1);
	//alert(matches)

	 if (!matches) return;
	 //var terms = unescape(matches[1].replace(/\+/g, ' '));
	 var terms = matches;
	 var re = new RegExp().compile('(' + terms + ')', 'i');
	 $("#coverguidance *").each(function()
	  { if ($(this).children().size() > 0) return;
	 if ($(this).is("xmp, pre")) return; var html = $(this).html();
	 var newhtml = html.replace(re, '<span class="qterm">$1</span>');
	 //alert(newhtml);
	 $(this).html(newhtml);
	  });
	   });

function textCounter1(field,cntfield,maxlimit)
 {
 // if too long...trim it!

   if (field.value.length > maxlimit)
   {

   field.value = field.value.substring(0, maxlimit);
   //alert(field.value.length);
   }
   else
   {
   cntfield.value = maxlimit - field.value.length;
   //alert(cntfield.value);
   }
 }

