
function showdev(vid){ 
	myobj=document.getElementById("div_vacancy");                   
	if (document.getElementsByTagName)
		var x = myobj.getElementsByTagName('DIV');
	else if (document.all)
		var x = myobj.all.tags('DIV');
	for (var i=0; i < x.length; i++){
	if(x[i].id!=""){
		if(x[i].id.indexOf('div_')>-1){
			if(x[i].id==vid){
				if(document.getElementById(x[i].id).className=='answer-show'){
					document.getElementById(x[i].id).className='answer-hide';
				}else{
					document.getElementById(x[i].id).className='answer-show';
				}
			}else{
			document.getElementById(x[i].id).className='answer-hide';
				}	      
			}
		}
	
	}
}

function submit_form(pageno,pagestartno){
	
	document.frm_SearchResult.action="vacancy-search-result.php#paging";
	document.frm_SearchResult.pagestartno.value=pagestartno;
	document.frm_SearchResult.pageno.value=pageno;
	document.frm_SearchResult.submit();
	
}
function submit_form(pageno,pagestartno){
	
	document.frm_SearchResult.action="vacancy-search-result.php#paging";
	document.frm_SearchResult.pagestartno.value=pagestartno;
	document.frm_SearchResult.pageno.value=pageno;
	document.frm_SearchResult.submit();
	
}


function trimString (str){
  str = this != window? this : str;
  return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function search_result()
{
	if (trimString(document.frm.ddsector.value)=="0" && trimString(document.frm.ddsalary.value)=="0" && trimString(document.frm.ddindustrysector.value)=="0" && trimString(document.frm.ddlocation.value)=="0"){
		alert("Please select atleast one option.")
		document.frm.ddsector.focus();
		return false;
	}else{
		document.frm.submit();
	}
	
}


function validation_vacancy(id)
  {
   var flage=true;
   var numcon=0;
   
   if(document.getElementById('name_'+id).value=="")
   {
    flage=false;
    numcon=numcon+"^"+ "1";
   }
    if(document.getElementById('email_'+id).value=="")
   {
    flage=false;
    numcon=numcon+"^"+ "2";
   }
   if(document.getElementById('email_'+id).value!="")
   {
     if ((/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.getElementById('email_'+id).value)) == false){
      flage=false;
      numcon=numcon+"^"+ "3";
      }
   }
    if(document.getElementById('phone_'+id).value=="")
   	{
	  flage=false;
    	numcon=numcon+"^"+ "4";
	}   
   if(document.getElementById('phone_'+id).value!="")
   {
	   if(check_phonenumber(document.getElementById('phone_'+id))==false){
		 flage=false;
    	numcon=numcon+"^"+ "5";
		}
	}
	if(document.getElementById('fileCV_'+id).value=="")
   {
	   flage=false;
    	numcon=numcon+"^"+ "6";
		
	}	
   
            
  if(flage==true){
	  //return false;
	  	document.getElementById('msg_vacancy_'+id).style.display="";
		document.getElementById('msg_vacancy_'+id).innerHTML="Processing, please wait...";
     	document.getElementById('frm_vacancy_'+id).submit();
	}else{
    ShowMsgBox_contact(numcon);
    FocusOnControl_contact(numcon,id);
    return false;
    }
  }
  
function ShowMsgBox_contact(t)
{
var _StrMsg="";
	if(t.value!=0){
	    _StrMsg="_____Validation Summary_____" + "\n"+"\n";
		vmodelArr=t.split("^");
	  for(i=1;i<vmodelArr.length;i++)
	  {
		if(vmodelArr[i]=="1"){
	        _StrMsg=_StrMsg+"- Please Enter Name."+ "\n"; }
	   else if(vmodelArr[i]=="2"){
	        _StrMsg=_StrMsg+"- Please Enter Email."+ "\n"; }
	   else if(vmodelArr[i]=="3"){
	        _StrMsg=_StrMsg+"- Please Enter Valid Email."+ "\n"; }
		else if(vmodelArr[i]=="4"){
	        _StrMsg=_StrMsg+"- Please Enter Phone No.."+ "\n"; }
		else if(vmodelArr[i]=="5"){
	        _StrMsg=_StrMsg+"- Please Enter Valid Phone No.."+ "\n"; }
		else if(vmodelArr[i]=="6"){
	        _StrMsg=_StrMsg+"- Please Upload CV."+ "\n"; }
	  
	  }
	  _StrMsg=_StrMsg+"_________________________";
	  alert(_StrMsg);
  }
}

function FocusOnControl_contact(t,id)
{
    if(t.value!=0){
    vmodelArr=t.split("^");
	if(vmodelArr[1]=="1"){
        document.getElementById('name_'+id).focus(); 
    } else if(vmodelArr[1]=="2"){
		document.getElementById('email_'+id).focus();
        
    } else if(vmodelArr[1]=="3"){
      document.getElementById('email_'+id).focus();
	  document.getElementById('email_'+id).select();
	} else if(vmodelArr[1]=="4"){
		document.getElementById('phone_'+id).focus();
        
    } else if(vmodelArr[1]=="5"){        
        document.getElementById('phone_'+id).focus();
		document.getElementById('phone_'+id).select();       
    } else if(vmodelArr[1]=="6"){        
        document.getElementById('fileCV_'+id).focus();  
    }
	
		
   }
}
function check_phonenumber(phoneBox){
	var phoneVal = trimString(phoneBox.value.toString()); 
	phoneBox.value=trimString(phoneBox.value.toString());
	
	var valid;
	valid=true;
	var mstr=phoneVal.toString();
	var count=0;
	for (var i = 0;i < mstr.length;i++){
		var oc = mstr.charAt(i);
		if ((oc < "0" ||oc > "9")){
			count++;
		}
	}
	
	if(mstr.length>0){
		var oc = mstr.charAt(0);
		if ((oc < "0" ||oc > "9")&& oc!="+"){
			valid=false;
		}
	}
	for (var i = 1;i < mstr.length;i++){
		var oc = mstr.charAt(i);
		if ((oc < "0" ||oc > "9")&& oc!=" "&& oc!=","&& oc!="-"&& oc!="+" && oc!="(" && oc!=")"){
			valid=false;
		}
	}
	if (valid == false){		
		return(false);
	}
	return(true);
}

function createRequestObject() {
	  FORM_DATA = new Object();
		// The Object ("Array") where our data will be stored.
	  separator = ',';
		// The token used to separate data from multi-select inputs
	  query = '' + this.location;
	  qu = query
		// Get the current URL so we can parse out the data.
		// Adding a null-string '' forces an implicit type cast
		// from property to string, for NS2 compatibility.
	  query = query.substring((query.indexOf('?')) + 1);
		// Keep everything after the question mark '?'.
		
	  if (query.length < 1) { return false; }  // Perhaps we got some bad data?
	  keypairs = new Object();
	  numKP = 1;
		// Local vars used to store and keep track of name/value pairs
		// as we parse them back into a usable form.
	  while (query.indexOf('&') > -1) {
		keypairs[numKP] = query.substring(0,query.indexOf('&'));
		query = query.substring((query.indexOf('&')) + 1);
		numKP++;
		  // Split the query string at each '&', storing the left-hand side
		  // of the split in a new keypairs[] holder, and chopping the query
		  // so that it gets the value of the right-hand string.
	  }
	  //alert(numKP);
	  keypairs[numKP] = query;
		// Store what's left in the query string as the final keypairs[] data.<
	  for (i in keypairs) {
		keyName = keypairs[i].substring(0,keypairs[i].indexOf('='));
		  // Left of '=' is name.
		keyValue = keypairs[i].substring((keypairs[i].indexOf('=')) + 1);
		  // Right of '=' is value.
		while (keyValue.indexOf('+') > -1) {
		  keyValue = keyValue.substring(0,keyValue.indexOf('+')) + ' ' + keyValue.substring(keyValue.indexOf('+') + 1);
			// Replace each '+' in data string with a space.
		}
		keyValue = unescape(keyValue);
		  // Unescape non-alphanumerics
		if (FORM_DATA[keyName]) {
		  FORM_DATA[keyName] = FORM_DATA[keyName] + separator + keyValue;
			// Object already exists, it is probably a multi-select input,
			// and we need to generate a separator-delimited string
			// by appending to what we already have stored.
		} else {
		  FORM_DATA[keyName] = keyValue;
			// Normal case: name gets value.
		}
	  }
	  return FORM_DATA;
	}
	
function showblogdev(vid,aid,id){
	myobj=document.getElementById("left-panel");                   
	if (document.getElementsByTagName)
		var x = myobj.getElementsByTagName('DIV');
	else if (document.all)
		var x = myobj.all.tags('DIV');
	for (var i=0; i < x.length; i++){
	if(x[i].id!=""){
		if(x[i].id.indexOf('blog_')>-1){
			if(x[i].id==vid){				
				document.getElementById(x[i].id).className='answer-show';				
			}else{
				document.getElementById(x[i].id).className='answer-hide';
				}	      
			}
		}
	
	}
	
	if(id!='1'){
		document.getElementById('current_blog').className='rightside-btn';	
	}else{
		document.getElementById('current_blog').className='answer-hide';	
	}
	
	active_anchor(aid);
}

function active_anchor(aid){
	myobj=document.getElementById("right-panel");                   
	if (document.getElementsByTagName)
		var x = myobj.getElementsByTagName('a');
	else if (document.all)
		var x = myobj.all.tags('a');
	for (var i=0; i < x.length; i++){
	if(x[i].id!=""){
		if(x[i].id.indexOf('a_')>-1){
			if(x[i].id==aid){				
				document.getElementById(x[i].id).className='rightside-btn-active';				
			}else{
				document.getElementById(x[i].id).className='rightside-btn';
				}	      
			}
		}
	
	}
}