var ajxPath='';
if (ajxPath) ajxPath=ajxPath;
/*///////////////////////////////////////
   Function Name: checkEmail(email)
   Purpose : use for Email validation
   Created By : Tanveer saleem
*////////////////////////////////////////
function checkEmail(email)
{   
	if(email != '') {
	$('emailcheck').innerHTML = "<img src='"+ajxPath+"images/ajax-loader.gif'>";
	//new Ajax.Updater('emailcheck','inc/ajaxregister.php?email='+email+'',{asynchronous:true,evalScripts:true,parameters:''})
	new Ajax.Updater('emailcheck',ajxPath+'ajx/register.php',{method:'post',asynchronous:true,evalScripts:true,parameters:$('Register').serialize()})
	}
	
}
/*///////////////////////////////////////
   Function Name: showBlank(fieldName,fieldValue)
   Purpose : Blank some fields
   Created By : Tanveer saleem
*////////////////////////////////////////
function showBlank(fieldName,fieldValue)
{
  if(fieldName=='su_fname' && fieldValue=='First Name')
   $('su_fname').value = '';   
  else if(fieldName=='su_lname' && fieldValue=='Last Name')
   $('su_lname').value = '';  
  else if(fieldName=='su_cityCodeHomePhone' && fieldValue=='Code')
   $('su_cityCodeHomePhone').value = ''; 
   else if(fieldName=='su_jobAlertkeyword' && fieldValue=='Enter Keywords')
   $('su_jobAlertkeyword').value = '';  
  
}

/*///////////////////////////////////////
   Function Name: filledField(fieldName,fieldValue)
   Purpose : fill some fields with default values
   Created By : Tanveer saleem
*////////////////////////////////////////
function fillFields()
{
  if($('#su_fname').value=='')
   $('#su_fname').value = 'First Name';     
  if($('#su_lname').value=='')
   $('#su_lname').value = 'Last Name';  
  if($('#su_cityCodeHomePhone').value=='')
   $('#su_cityCodeHomePhone').value = 'Code';   
  if($('#su_jobAlertkeyword') && $('#su_jobAlertkeyword').value=='')
   $('#su_jobAlertkeyword').value = 'Enter Keywords';  
}
/*///////////////////////////////////////
   Function Name: addAcademicInfo()
   Purpose : To add another Academic panel
   Created By : Tanveer saleem
*////////////////////////////////////////
function addAcademicInfo()
{    
    oldContent = $('academicContent').innerHTML;
	counterAcad= $('su_counterAcademicInfo').value;		
	span = "spOthUniv"+counterAcad;		
	//$('spOthUniv').setAttribute('id','spOthUniv'+counterAcad);
	$('spOthUniv').setAttribute('id',span);
	$('su_institution').setAttribute('onchange',"checkUniv(this,'"+span+"')");
	$('su_institution').setAttribute('id','su_institution'+counterAcad);
	
	$('su_degree').setAttribute('id','su_degree'+counterAcad);	
	$('su_degreeCompletionYear').setAttribute('id','su_degreeCompletionYear'+counterAcad);	
	// for delete extra pannel
	$('acadLinkClose').setAttribute('onclick',"closeAcadInfoPannel('"+counterAcad+"')");
	
	$('acadLinkClose').setAttribute('id','acadLinkClose'+counterAcad);
	$('acadPannelAvailable').setAttribute('id','acadPannelAvailable'+counterAcad);
	$('acadInfoTB').setAttribute('id','acadInfoTB'+counterAcad);
		
	latestContent = $('academicContent').innerHTML;	
	//alert(oldContent);
	new Insertion.Bottom('academicInfoContainer', latestContent);		
	$('academicContent').innerHTML = oldContent;
	$('su_counterAcademicInfo').value = parseInt($('su_counterAcademicInfo').value)+parseInt(1);		

}
/*///////////////////////////////////////
   Function Name: addExperinceInfo()
   Purpose : To add another Experience panel
   Created By : Tanveer saleem
*////////////////////////////////////////
function addExperinceInfo()
{
  
	oldContent = $('ExpContent').innerHTML;
	counterExp = $('su_counterExpInfo').value;	
	$('su_toYear').setAttribute('id','su_toYear'+counterExp);
	$('su_toMonth').setAttribute('onchange',"checkMonthStatus("+counterExp+")");
	$('su_toMonth').setAttribute('id','su_toMonth'+counterExp);	
	$('su_fromMonth').setAttribute('id','su_fromMonth'+counterExp);
	$('su_fromYear').setAttribute('id','su_fromYear'+counterExp);
	// for delete extra pannel
	$('expLinkClose').setAttribute('onclick',"closeExpInfoPannel('"+counterExp+"')");
	$('expLinkClose').setAttribute('id','expLinkClose'+counterExp);
	$('expPannelAvailable').setAttribute('id','expPannelAvailable'+counterExp);
	$('expInfoTB').setAttribute('id','expInfoTB'+counterExp);
	
	latestContent = $('ExpContent').innerHTML;	
	new Insertion.Bottom('expInfoContainer', latestContent);	
	$('ExpContent').innerHTML = oldContent;
	$('su_counterExpInfo').value = parseInt($('su_counterExpInfo').value)+parseInt(1);	

}
/*///////////////////////////////////////
   Function Name: chCntry(countryName)
   Purpose : show and hide some fields w.r.t country
   Created By : Tanveer saleem
*////////////////////////////////////////
function chCntry(countryName){
  
  if(countryName != 'Pakistan') {
   $('pkH').hide();
   $('nonPkH').show();
   $('pkM').hide();
   $('nonPkM').show();
  }
  else
  {
   $('pkH').show();
   $('nonPkH').hide();
   $('pkM').show();
   $('nonPkM').hide();
  }
  if(countryName == 'USA')
   $('su_CitiSpan').innerHTML = '<input id="su_city" type="text" maxlength="40" size="30" value="" name="su_city"/>';     
  else if(countryName == '')
   $('su_CitiSpan').innerHTML = '<select name="su_city" id="su_city"><option value="">- Select City -</option></select>';     
  else
   new Ajax.Updater('su_CitiSpan',ajxPath+'ajx/register.php?country='+countryName+'',{asynchronous:true,evalScripts:true,parameters:''})
}
/*///////////////////////////////////////
   Function Name: checkUniv(obj,spanID)
   Purpose : To show textfield if user 
             select "other" option from drop down
   Created By : Tanveer saleem
*////////////////////////////////////////
function checkUniv(obj,spanID)
{
   //alert(spanID);
	if (obj.value == "Other")
	 $(spanID).show();
	else
	 $(spanID).hide();
}
/*///////////////////////////////////////
   Function Name: showHideLyrs()
   Purpose : To show experience pannel depend 
             on user selection
   Created By : Tanveer saleem
*////////////////////////////////////////
function showHideLyrs(){
	if($('su_fresh1').checked==true){
		$('profInd').innerHTML = 'Area of Interest';
	    $('su_industry').options[0].text = '-- Select Area of Interest --';		
		$('row1').hide(); $('row2').hide(); $('row3').hide(); 
	
		//$('row3').hide(); $('row4').hide(); $('row5').style.display='none'; $('row6').style.display='none';$('row7').style.display='none';
	}else{
		$('profInd').innerHTML = 'Professional Industry'; 
		$('su_industry').options[0].text = '-- Select Professional Industry --';
		$('row1').show(); $('row2').show(); $('row3').show(); 
		//$('row3').show(); $('row4').style.display=''; $('row5').style.display=''; $('row6').style.display='';$('row7').style.display='';
		
	}
}
/*///////////////////////////////////////
   Function Name: checkSelectIndustry()
   Purpose : To show textfield if user 
             select "other" option from drop down
   Created By : Tanveer saleem
*////////////////////////////////////////
function checkSelectIndustry(){		
		if ($('su_industry').value == "0") 
		$('otherIndustry').show();
		else 
		$('otherIndustry').hide();
}
function checkSelectCategory(){	

		if ($('su_category').value == "0") 
		{
			$('otherCategory').show();

		}
		else 
		$('otherCategory').hide();
}




/*///////////////////////////////////////
   Function Name: checkMonthStatus(index)
   Purpose : if user select present from 
             "job duration" drop down
   Created By : Tanveer saleem
*////////////////////////////////////////
function checkMonthStatus(index){
	if ($F('su_toMonth'+index) == "present")	
	$('su_toYear'+index).hide();
	else 
	$('su_toYear'+index).show();

}
function checkMonthPresent() 
{
	if ($F('su_toMonth') == "present")	
	$('su_toYear').hide();
	else 
	$('su_toYear').show();

}


/*///////////////////////////////////////
   Function Name: selectValues()
   Purpose : call on form submition
   Created By : Tanveer saleem
*////////////////////////////////////////
/*
function selectValues(){		
	$('cityName').value = $F('su_city');	
	$('cityCode').value=$F('su_cityCodeHomePhone');	
	//$('academicContent').innerHTML = '';
	return true;
}
*/
/*///////////////////////////////////////
   Function Name: closeAcadInfoPannel(index)
   Purpose : use for remove extra pannel
   Created By : Tanveer saleem
*////////////////////////////////////////
function closeAcadInfoPannel(index)
{
	$('acadInfoTB'+index).hide();
	$('acadPannelAvailable'+index).value = 'No';
	//alert($('acadPannelAvailable'+index).value);
}
/*///////////////////////////////////////
   Function Name: closeExpInfoPannel(index)
   Purpose : use for remove extra pannel
   Created By : Tanveer saleem
*////////////////////////////////////////
function closeExpInfoPannel(index)
{
	$('expInfoTB'+index).hide();
	$('expPannelAvailable'+index).value = 'No';
}
/*///////////////////////////////////////
   Function Name: jobAlertKeyword()
   Purpose : use to show and hide keyword field
   Created By : Tanveer saleem
*////////////////////////////////////////
function jobAlertKeyword()
{
   if($('jobAlertSubscribe').checked==true) 
   {
      $('keywordFieldSpan').show();
	  $('jobAlert').show();	  
   }
   else
   {
	  $('keywordFieldSpan').hide();
	  $('jobAlert').hide();	  
   }
}