// JScript File

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_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) var a;//alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function setCheckBoxOnOff(val){
	var a=document.getElementsByName('chkList[]');
	for(i=0;i<a.length;i++){
		if (val){
			a[i].checked = true;
		}else{
			a[i].checked = false;
		}
	}
}

function validateMultiSelect(val,objName,limit){
	//alert(val + "\n" + objName + "\n" + limit);
	obj = document.getElementById(objName);
	cnt = 0;
	for (i = 0; i<obj.length; i++ ){
		//alert(obj.options[i]);
		if(obj.options[i].value!=""){
			if ( (obj.options[i].selected)){
				if(limit==0) return true;
				cnt++;
			}
		}
	}
	if(cnt>limit){
		return " - You can select maximum " + limit + " values";
	}
	return " - Select atleast one value";
}

function checkCharacters(strVal){
	j_maj = strVal.length;
	validChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.+,<>#;?- @1234567890"\'&!=_-:/()';
	//+, £, &
	for(i_maj=0; i_maj<j_maj; i_maj++){
		if (validChars.indexOf(strVal.charAt(i_maj))<0){
			i_maj=99;
			return true;
		}
	}	
	return false;	
}

function limitText(objName, limitNum) {
	objTE = $MAJ(objName);
	if (objTE.value.length > limitNum) {
		objTE.value = objTE.value.substring(0, limitNum);
	}
	$MAJ("span_"+objName).innerHTML = parseInt(limitNum) - parseInt(objTE.value.length);
}

function YY_checkform() { //v4.71
//copyright (c)1998,2002 Yaromat.com
  var a=YY_checkform.arguments,oo=true,v='',s='',err=false,r,o,at,o1,t,i,j,ma,rx,cd,cm,cy,dte,at;
  for (i=1; i<a.length;i=i+4){
    if (a[i+1].charAt(0)=='#'){r=true; a[i+1]=a[i+1].substring(1);}else{r=false}
	//alert(a[i]);
    o=MM_findObj(a[i].replace(/\[\d+\]/ig,""));
    o1=MM_findObj(a[i+1].replace(/\[\d+\]/ig,""));
	//alert(a[i] + "\n" + a[i+1] + "\n" + o.type);
    v=o.value;t=a[i+2];
    validChar=false;
    if ((o.type=='text'||o.type=='password'||o.type=='hidden') &&(t!=8)){
      if (r&&v.length==0){err=true}
	 // alert(o.id);
	  if(o.id == 'vacancy_title' || o.id == 'vacancy_temp_title'){
	  }else {
		  if(checkCharacters(v)){
			  err=true;	
			  validChar=true;
		  }
	  }
      if (v.length>0)
      if (t==1){ //fromto
        ma=a[i+1].split('_');if(isNaN(v)||v<ma[0]/1||v > ma[1]/1){err=true}
      } else if (t==2){
        rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-zA-Z]{2,4}$");if(!rx.test(v))err=true;
      } else if (t==3){ // date
        ma=a[i+1].split("#");at=v.match(ma[0]);
        if(at){
          cd=(at[ma[1]])?at[ma[1]]:1;cm=at[ma[2]]-1;cy=at[ma[3]];
          dte=new Date(cy,cm,cd);
          if(dte.getFullYear()!=cy||dte.getDate()!=cd||dte.getMonth()!=cm){err=true};
        }else{err=true}
      } else if (t==4){ // time
        ma=a[i+1].split("#");at=v.match(ma[0]);if(!at){err=true}
      } else if (t==5){ // check this 2
            if(o1.length)o1=o1[a[i+1].replace(/(.*\[)|(\].*)/ig,"")];
            if(!o1.checked){err=true}
      } else if (t==6){ // the same
            if(v!=MM_findObj(a[i+1]).value){err=true}
      } else if(t==7){ // Execute function with object's value as a parameter
	  	var arrFunc = a[i+1].split('#');
	  	//alert(a[i+1] + "-" + arrFunc);
	  	if(arrFunc[1]!=""){
			eval("var resDynamicCall = "+arrFunc[1]+"('"+v+"')");
			//alert(resDynamicCall);
			if(resDynamicCall.length>0){ err=true;a[i+3]=resDynamicCall; }else{ }
		}
	  }
    } 
	else if (!o.type&&o.length>0&&o[0].type=='radio'){
          at = a[i].match(/(.*)\[(\d+)\].*/i);
          o2=(o.length>1)?o[at[2]]:o;
      if (t==1&&o2&&o2.checked&&o1&&o1.value.length/1==0){err=true}
      else if (t==2){
        oo=false;
        for(j=0;j<o.length;j++){oo=oo||o[j].checked}
        if(!oo){s+='* '+a[i+3]+'\n'}
      }
	  else if(t==7){ // Execute function with object's value as a parameter
    	 
	  	var arrFunc = a[i+1].split('#');
	  	//alert(a[i+1] + "-" + arrFunc);
	  	if(arrFunc[1]!=""){
			eval("var resDynamicCall = "+arrFunc[1]+"('"+v+"')");
			//alert(resDynamicCall);
			if(resDynamicCall.length>0){ err=true;a[i+3]=resDynamicCall; }else{ }
		}
	  }
    } 
	else if (o.type=='checkbox'){
      if((t==1&&o.checked==false)||(t==2&&o.checked&&o1&&o1.value.length/1==0)){err=true}
	  else if(t==7){ // Execute function with object's value as a parameter
	  	var arrFunc = a[i+1].split('#');
	  	//alert(a[i+1] + "-" + arrFunc);
	  	if(arrFunc[1]!=""){
			eval("var resDynamicCall = "+arrFunc[1]+"("+o.checked+",'"+o.name+"','"+a[i+3]+"')");
			//alert(resDynamicCall);
			if(resDynamicCall.length>0){ err=true;a[i+3]=resDynamicCall; }else{ }
		}
	  }
    } 
	else if (o.type=='select-one'||o.type=='select-multiple'){
      if(t==1&&o.selectedIndex/1==0){err=true}
	  else if(t==7){ // Execute function with object's value as a parameter
    	  //alert(4);
	  	var arrFunc = a[i+1].split('#');
	  	//alert(a[i+1] + "-" + arrFunc);
		if(arrFunc[0]=="q" && o.selectedIndex/1==0){
			err=true;
		}else if(arrFunc[1]!=""){
			if(arrFunc[2]==undefined){
				eval("var resDynamicCall = "+arrFunc[1]+"('"+v+"','"+o.name+"',0)");
			}else{
				eval("var resDynamicCall = "+arrFunc[1]+"('"+v+"','"+o.name+"'," +arrFunc[2]+ ")");
			}
			//alert(resDynamicCall);
			if(resDynamicCall.length>0){ err=true;a[i+3]= resDynamicCall; }else{ }
		}
	  }
    }
	else if (o.type=='textarea'){
      if(v.length<a[i+1]){err=true}
    }
	else if (o.type=='file'){
		if(t==7){ // Execute function with object's value as a parameter
	  		var arrFunc = a[i+1].split('#');
	  		//alert(a[i+1] + " - " + arrFunc);
	  		if(arrFunc[1]!=""){
				eval("var resDynamicCall = "+arrFunc[1]+"('"+a[i]+"','"+a[i+3]+"')");
				if(resDynamicCall.length>0){ err=true;a[i+3]=resDynamicCall; }else{ }
			}
	  	}
	}
	else if (o.type==undefined){
      if(t==7){ // Execute function with object's value as a parameter
	  	var arrFunc = a[i+1].split('#');
	  	//alert(a[i+1] + " - " + arrFunc);
	  	if(arrFunc[1]!=""){
			eval("var resDynamicCall = "+arrFunc[1]+"('"+a[i]+"','"+a[i+3]+"')");
			//alert(resDynamicCall);
			if(resDynamicCall.length>0){ err=true;a[i+3]=resDynamicCall; }else{ }
		}
	  }
    } 
	else if (o.type=='hidden' && t==8){
		var oEditor = FCKeditorAPI.GetInstance(o.name) ;
		editorVal = oEditor.GetXHTML( false );
		if(editorVal!=""){
		}else{
			err=true;
		}
	}
    if (err){
		extra_s = '';
		if(validChar) extra_s=' '+'must be entered and valid.';
		s+='* '+a[i+3]+extra_s+'\n'; 
		err=false;
	}
  }
  if (s!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+s)}
  document.MM_returnValue = (s=='');
}

function validateZIP(field) 
{
    var valid = "0123456789-";
    var hyphencount = 0;

    if (field.length!=5 && field.length!=10) 
    {
        //alert("Please enter your 5 digit or 5 digit+4 zip code.");
        return false;
    }
    for (var i=0; i < field.length; i++) 
    {
        temp = "" + field.substring(i, i+1);
        if (temp == "-") hyphencount++;
        if (valid.indexOf(temp) == "-1") 
        {
            //alert("Invalid characters in your zip code.  Please try again.");
            return false;
        }
        if ((hyphencount > 1) || ((field.length==10) && ""+field.charAt(5)!="-")) 
        {
            //alert("The hyphen character should be used with a properly formatted 5 digit+four zip code, like '12345-6789'.   Please try again.");
            return false;
        }
    }
return true;
}

function CalcKeyCode(aChar) {
  var character = aChar.substring(0,1);
  var code = aChar.charCodeAt(0);
  return code;
}

function checkNumber(val)
{
  var strPass = val.value;
  var strLength = strPass.length;
  for(i=0;i<strLength;i++)
  {
      var lchar = val.value.charAt(i);
      var cCode = CalcKeyCode(lchar);
      if (cCode < 48 || cCode > 57 )
      {
        return false;
      }
  }
  return true;
}

// returns true if the string is a US phone number formatted as...
// (000)000-0000, (000) 000-0000, 000-000-0000, 000.000.0000, 000 000 0000, 0000000000
function isPhoneNumber(str)
{
  var re = /^\(?[2-9]\d{2}[\)\.-]?\s?\d{3}[\s\.-]?\d{4}$/
  return re.test(str);
}

function addLoadEvent(func) { 
  //alert("add");
  var oldonload = window.onload; 
  if (typeof window.onload != 'function') { 
    window.onload = func; 
  } else { 
    window.onload = function() { 
      if (oldonload) { 
        oldonload(); 
      } 
      func(); 
    } 
  } 
} 

function getSelectedRadio(bG) {
   buttonGroup = document.getElementsByName(bG); 
   // returns the array number of the selected radio button or -1 if no button is selected
   if (buttonGroup[0]) { // if the button group is an array (one button is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            return i
         }
      }
   } else {
      if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
   }
   // if we get to this point, no radio button is selected
   return -1;
} // Ends the "getSelectedRadio" function

function getSelectedRadioValue(bG) {
	buttonGroup = document.getElementsByName(bG); 
   // returns the value of the selected radio button or "" if no button is selected
   var i = getSelectedRadio(bG);
   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 gotoList(strURL){
	//alert(strURL);
	window.location.href=strURL+'#List';
	//FireAjaxRequest('type=list',strURL,'div_list','div_status','block','N','');
 }

 function delete_Verification(strURL,data,pkVar){
	 	//alert(strURL+'===='+data+'===='+pkVar);
	if(data == 0) {
		FireAjaxRequest("&type=Yesdelete&"+pkVar,strURL,"div_Edit","div_Edit");
	} else {
		FireAjaxRequest("&type=del_verify&data="+data+"&"+pkVar,strURL,"div_Edit","div_Edit");
	}
 }
 function searchJSF(frmname){
	 //alert('111');
	 valueString = getFormValues('frmJSF');
	 if(document.getElementById("divSearchResult")==undefined){
		  //alert('222');
		document.getElementById("frmJSFSB").method = "post"; 
	 	document.getElementById("frmJSFSB").action = "/jobs/search-result";
		document.getElementById("frmJSFSB").submit();
		return false;
	 }
	 valueStringSB = '';
	 try{
	 	valueStringSB = getFormValues('frmJSFSB');
	 }catch(e){
		 valueStringSB = $("#q_str").val();
	 }
	 valueString = valueString+"&"+valueStringSB
	 //alert(valueString);
	 try{//alert('333');
		 FireAjaxRequest(valueString+"&type=searchJSF", "queries.php","searchfilters","searchfilters");
	 }catch(e){
	 }
	 try{//alert('444');
	// alert(valueString);
		 FireAjaxRequest(valueString+"&type=searchJSFJS", "queries.php","divforPaging","divforPaging");
	 }catch(ee){
	 }
 }
 
 	function addtofev(vac_id,str) {
	 	/*if(str != ''){
			apply = '&apply='+str;
		} else {
			apply = '';
		}*/
		if(str != ''){
			FireAjaxRequest('type=Fev_vacancy&vac_id='+vac_id+'&apply='+str,'queries.php','add_fev_'+vac_id,'add_fev_'+vac_id,'block','N',"window.location='/my-grad-jobs/favourite-vacancies'","if(document.getElementsByName('chkmail[]').value == "+vac_id+"){ document.getElementsByName('chkmail[]').checked = 'checked'}");

		} else {			
			FireAjaxRequest('type=Fev_vacancy&vac_id='+vac_id,'queries.php','add_fev_'+vac_id,'add_fev_'+vac_id,'block','N',"document.getElementById('div_add_fev_"+vac_id+"').style.display='none'");
		}
		return false;
	}
	function addtofev_rec(rec_id) {
		FireAjaxRequest('type=Fev_Rec&rec_id='+rec_id,'queries.php','add_fev_'+rec_id,'add_fev_'+rec_id,'block','N',"document.getElementById('div_add_fev_"+rec_id+"').style.display='none'"); 
		return false;
	}
	function login(VacId) {
		//alert('Please Login First...');
		//document.getElementById('fev_vac_id').value = VacId;
		$("#fev_vac_id_popup").val(VacId);
		$.fancybox({
			'href'		   		: '#inline1',
			'titlePosition'		: 'inside',
			'transitionIn'		: 'none',
			'transitionOut'		: 'none'
		});
		
		/*if(VacId > 0){
			document.getElementById('fev_vac_id').value = VacId;
			document.fev_for_login.submit();
		} else {
		 	window.location = '/my-grad-jobs';
		}*/
		return false;
	}
	function chklist(i,frmname){
		str = '';
			if(document.getElementById('vacancy_title_'+i).value == ''){
				str += 'please enter a vacancy title\n';
			}
			if(document.getElementById('drpJobRole_'+i).value == ''){
				str += 'please select a job role \n';
			}
			if(document.getElementById('drp_Industry_'+i).value == ''){
				str += 'please select an industry sector \n';
			}
			if(document.getElementById('drpLocation_'+i).value == ''){
				str += 'please select a location \n';
			}
			if(document.getElementById('drpContract_'+i).value == ''){
				str += 'please select a contract type \n';
			}
			if(document.getElementById('drpHours_'+i).value == ''){
				str += 'please select hours  \n';
			}
			/*if(document.getElementById('jobdesc_'+i).value == ''){
				str += 'please enter Job description\n';
			}*/
			/*if(document.getElementById('application_dead_'+i).value == match('#^\([0-9][0-9]\)\\-\([0-9][0-9]\)\\-\([0-9]{4}\)$#1#2#3')){
			
				str += 'Application deadline is not valid\n';
			}*/
			if(str != ''){
				//alert(str);
				return false;
			}else{
				return true;
			}
			
		}
	function setorder(StrVal,q_str) {
		//alert(StrVal);
		//alert(q_str);
		document.getElementById('orderby').value = StrVal;
		document.getElementById('q_str').value = q_str;
		searchJSF();	//FireAjaxRequest('type=setorder&orderby='+StrVal,'queries.php','divSearchResult','divSearchResult','block');
		return false; 
	}
	function add_vacancy(PkVal,Status) {
		FireAjaxRequest('type=add_vacancy&PkVal='+PkVal+'&Status='+Status,'queries.php','add_vacancy','add_vacancy','block');
		return false; 
	}
	function set_paging(strVal,q_str) {
			document.getElementById('paging_1').value = strVal;
			document.getElementById('q_str').value = q_str;
			searchJSF();			//FireAjaxRequest('type=set_paging&Paging_val='+strVal,'queries.php','divSearchResult','divSearchResult','block');
		return false; 
	}
	function search_job (keyword,IS,LOC){
	 		document.getElementById('keywords_1').value = keyword;
			document.getElementById('industry_sector_1').value = IS;
			document.getElementById('location_1').value = LOC;
			searchJSF();
 	}
	function func_rec_contact(strHidden) {
			
		strID = '';
		var arrChk = document.getElementsByName("chkmail[]");
		for(i=0;i<arrChk.length;i++){
			if(arrChk[i].checked){
				strID += arrChk[i].value+',';//.join(',');
			}	
		}
		document.getElementById(strHidden).value = strID;
		
		//FireAjaxRequest('type=rec_contact&rec_id='+strID,'queries.php','fev_rec','fev_rec','block');

	}
	function deleteRec(strHidden){
		strID = document.getElementById(strHidden).value;
		if(strID==""){
			if(strHidden=="vac_id"){
				strMsg = "Please select at least one vacancy";
			}else{
				strMsg = "Please select at least one recruiter";
			}
			alert(strMsg);
			return false;
		}
	}
	function vac_contact() {
		strID = '';
		var arrChk = document.getElementsByName("chkmail[]");
		for(i=0;i<arrChk.length;i++){
			if(arrChk[i].checked){
				strID += arrChk[i].value+',';//.join(',');
			}	
		}
		FireAjaxRequest('type=vac_contact&vac_id='+strID,'queries.php','fev_vac','fev_vac','block');
		return false; 
	}
	function setCheckBoxOnOffALL(val){
		var a=document.getElementsByName('chkmail[]');
		for(i=0;i<a.length;i++){
			if (val){
				a[i].checked = true;
			}else{
				a[i].checked = false;
			}
		}
	}
	function regi_RF(Rf_id){
		FireAjaxRequest('type=RF_reg&Rf_id='+Rf_id,'queries.php','registrationStatus','registrationStatus','block','N','document.getElementById("registrationStatus").style.display="none"');		
		return false;
	}
	function SetDescHIDE(drpVal){
			//alert(drpVal);
		if(drpVal == 'No'){
			document.getElementById('fckdisplay').style.display = 'none';
		} else {
			document.getElementById('fckdisplay').style.display = 'block';	
		}
	}
	function chkvalidation(strJSFeature) {
		strJSFeature = strJSFeature.replace("\'","'");
		FJ = document.getElementById('chkfeture').value;
		
		//if(FJ == 'Yes'){
			strJSDesc = ",'jobdesc','#q','8','Please enter a job description'";
		//} else {
		//	strJSDesc = "";
		//}
		strValidation = "a  = YY_checkform('frmVac','vacancy_title','#q','0','Please enter a title.','drpJobRole[]','#q','1','Please select a job role.','drp_Industry[]','#q','1','Please select an industry.','drpLocation[]','#q','1','Please enter a location.','drpContract[]','#q','1','Please select a contract type.','drpHours','#q','1','Pelase select horus.','application_dead','#^\([0-9][0-9]\)/([0-9][0-9]\)/([0-9]{4}\)$#1#2#3','3','Application deadline date is not valid.'"+strJSFeature+strJSDesc+");";//
		eval(strValidation);
		return document.MM_returnValue;
	}
	function login2() {
		window.location="/my-grad-jobs";
		return false;
	}
	function chkUniOther(unival) {
		if(unival == -1) {
			document.getElementById('uniother').style.display = 'block';
		} else {
			document.getElementById('uniother').style.display = 'none';	
		}
		return false;
	}
	function chkUCASOther(UCASval) {
		if(UCASval == -1) {
			document.getElementById('UCASother').style.display = 'block';
		} else {
			document.getElementById('UCASother').style.display = 'none';	
		}
		return false;
	}
	function saveregistration() {
		YY_checkform('frm_reg_1','user_first_name','#q','0','Please enter a first name.','user_surname','#q','0','Please enter a surname.','user_email1','#S','2','Please enter a valid email address.','user_confirm_email','#user_email1','6','Please ensure your email addresses match.','user_password1','#q','0','Please enter a password.','user_confirm_password','#user_password1','6','Please ensure your passwords match.'); 
		if(document.MM_returnValue){
			//valueString = getFormValues('frm_reg_1');

//			$MAJ('.respond2').style.dispaly = 'block';
			//FireAjaxRequest(valueString+'type=saveregistration','queries.php','div_stage1','div_stage1','block');
		}
		return document.MM_returnValue;
	}
	function setotherAE(getval){
		if(getval == 'Other') {
			document.getElementById('potherae').style.display = 'block';
		} else {
			document.getElementById('potherae').style.display = 'none';	
		}
		return false;
	}
	function setotherlanguage(getval,id){
		otherckd = $MAJ(id).checked;
		
		if(getval == -1 && otherckd===true) {
			document.getElementById('otherlang').style.display = 'block';
		} else {
			if(id == 'user_Languages29') {
				document.getElementById('otherlang').style.display = 'none';	
			}
		}
		return false;
	}
	function setJRDrp(val) {
		if(val == true) {
			document.getElementById('pJH').style.display = 'none';
		} else {
			document.getElementById('pJH').style.display = 'block';
		}
		//return false;
	}
	function setHeardAbt(val,id) {
		//alert(id);
		other = $MAJ(id).checked;
		if(val == 'Other' && other==true ) {
			document.getElementById('heardabt').style.display = 'Block';
		} else {
			
			if(id =='user_heard_about_exhibition7'){
			 document.getElementById('heardabt').style.display = 'none';
			}
		}
	}
	function checkOtherValue(strVal, strName, dummyVal){
		//alert(strVal + "\n" + strName + "\n" + dummyVal);
		if(strName=="user_university"){
			if(strVal=="-1"){
				strOtherVal = document.getElementById("user_uni_other").value;
				if(strOtherVal!=""){
					return true;
				}else{
					return "Please enter a value for your University.";
				}
			}
		}
		return true;
	}
	function checkJH(boolChecked, strName){
		if(strName=="chkjh"){
			if(boolChecked==false){
				drpVal = document.getElementById("user_join_honours").value;
				if(drpVal!=""){
					return true;
				}else{
					return "Please select your join honour subject.";
				}
			}
		}else if(strName=="user_Languages[]"){
			if(boolChecked){
				
			}
		}
		return true;
	}
	function checkLang(val){
		boolChecked = document.getElementById("user_Languages29").checked;
		if(boolChecked){
			txtVal = document.getElementById("user_other_language").value;
			if(txtVal!=""){
				return true;
			}else{
				return "Please enter another language.";
			}
		}
		return true;
	}
	function checkRE(val){
		objMS = document.getElementById("user_hae_rbfriend[]");
		checkBool =false;
		for(i=0;i<objMS.length;i++){
			if((objMS[i].value=="Yes (please specify their name below)") && (objMS[i].selected)){
				checkBool =true;
			}
		}
		if(checkBool){
			txtVal = document.getElementById("user_hae_friend_name").value;
			if(txtVal!=""){
				return true;
			}else{
				return "Please provide Friends name.";
			}
		}
		return true;
	}
	
	function checkHear(val){
		checkBool =false;
		if(document.getElementById("optionsprint").checked){
			objMS = document.getElementById("user_hae_print[]");
			for(i=0;i<objMS.length;i++){
				if(objMS[i].selected){
					checkBool =true;
				}
			}
		}
		if(checkBool==false){
			if(document.getElementById("optionscampus").checked){
				objMS = document.getElementById("user_hae_oncampus[]");
				for(i=0;i<objMS.length;i++){
					if(objMS[i].selected){
						checkBool =true;
					}
				}
			}
		}
		if(checkBool==false){
			if(document.getElementById("optionsradio").checked){
				objMS = document.getElementById("user_hae_radio[]");
				for(i=0;i<objMS.length;i++){
					if(objMS[i].selected){
						checkBool =true;
					}
				}
			}
		}
		if(checkBool==false){
			if(document.getElementById("optionsemail").checked){
				objMS = document.getElementById("user_hae_email[]");
				for(i=0;i<objMS.length;i++){
					if(objMS[i].selected){
						checkBool =true;
					}
				}
			}
		}
		if(checkBool==false){
			if(document.getElementById("optionstext").checked){
				objMS = document.getElementById("user_hae_text[]");
				for(i=0;i<objMS.length;i++){
					if(objMS[i].selected){
						checkBool =true;
					}
				}
			}
		}
		if(checkBool==false){
			if(document.getElementById("optionsonline").checked){
				objMS = document.getElementById("user_hae_online[]");
				for(i=0;i<objMS.length;i++){
					if(objMS[i].selected){
						checkBool =true;
					}
				}
			}
		}
		if(checkBool==false){
			if(document.getElementById("optionsother").checked){
				objMS = document.getElementById("user_hae_rbfriend[]");
				for(i=0;i<objMS.length;i++){
					if(objMS[i].selected){
						checkBool =true;
					}
				}
			}
		}
		if(checkBool==false){
			return "Please select atleast one option for How did you hear about the exhibition(s)?";
		}else{
			return true;
		}
	}
	
	function validateCheckList(strName,strMsg){
		var a=document.getElementsByName(strName);
		for(i=0;i<a.length;i++){
			if (a[i].checked){
				return true;
			}
		}
		return strMsg;
	}
	function setapplyjob(rdval){
		//alert(rdval);
		FireAjaxRequest('type=setapplyjob&vac_id='+rdval,'queries.php','divsetapplyjob','divsetapplyjob','block','N');	
	}
	function addapplyforjob(vacancy,url){
		FireAjaxRequest('type=addapplyforjob&vac_id='+vacancy,'queries.php','divsetapplyjob','divsetapplyjob','block','N',openURL(url));	
	}
	function openURL(url){
		myRef = window.open(url);//,'applyURL'
	}
	function chkforcv(strVal, objName){
		var usercv = $MAJ(strVal).value;
		if(usercv==""){
			return "Upload your cv.";
		}
	}
	function chkforcvedit(){
		var usercv = $MAJ('user_cv').value;
		if(usercv!=""){
			return "You already one cv uploaded";
		} else {
			return true;
		}
	}
	function submitfirstfrm(){
		saveregistration();	
		document.frm_reg_1.submit();
	}
	
	function delCV(){
		FireAjaxRequest('type=delCV','queries.php','pCV','pCV','block','N',"$('#pCV').removeClass('viewcv');");	
		return false;
	}
	
	function popupLogindata() {
		YY_checkform('frm_user_login2','user_email2','#S','2','Your email is not valid','user_password2','#q','0','Please enter your password');
		if(document.MM_returnValue){
			valueString = getFormValues('frm_user_login2');
			FireAjaxRequest(valueString+'&type=popupLogindata','queries.php','popmsg','popmsg','block');
		}
		return document.MM_returnValue;
	}
	
	//************************ New Functions for Pharse 2 By RD ************************//
	function view_matched_member(vac_id){
			alert(vac_id);
			return false;
	}

	function downloadCV(user_id){
			FireAjaxRequest('type=downloadCV&user_id='+user_id,'queries.php','div_cv','div_cv');	
			return false;
	}
	
	function CVServices(val){
		if(val==true){
			$('#cv_matcher_form').show();
			$('#user_use_cv_match_services').val('Yes');
		}else{
			$('#cv_matcher_form').hide();
			$('#user_use_cv_match_services').val('No');
		}
		return true;
	}
