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(jQuery('#su_fname').val()=='')
   jQuery('#su_fname').val('First Name');
  if(jQuery('#su_lname').val()=='')
   jQuery('#su_lname').val('Last Name');  
  if(jQuery('#su_cityCodeHomePhone').val()=='')
   jQuery('#su_cityCodeHomePhone').val('Code');   
  if(jQuery('#su_jobAlertkeyword') && jQuery('#su_jobAlertkeyword').val()=='')
   jQuery('#su_jobAlertkeyword').val('Enter Keywords');  
}
/*///////////////////////////////////////
   Function Name: addAcademicInfo()
   Purpose : To add another Academic panel
   Created By : Tanveer saleem
*////////////////////////////////////////
function addAcademicInfo()
{   
	var oldContent = jQuery('#academicContent').html();
	var counterAcad= jQuery('#su_counterAcademicInfo').val();
	var span = "spOthUniv"+counterAcad;
	//jQuery('#spOthUniv').attr('id','spOthUniv'+counterAcad);
	jQuery('#spOthUniv').attr('id',span);
	jQuery('#su_institution').attr('onchange',"checkUniv(this,'"+span+"')");
	jQuery('#su_institution').attr('id','su_institution'+counterAcad);
	
	jQuery('#su_degree').attr('id','su_degree'+counterAcad);	
	jQuery('#su_degreeCompletionYear').attr('id','su_degreeCompletionYear'+counterAcad);	
	// for delete extra pannel
	
	jQuery('#acadLinkClose').attr('id','acadLinkClose'+counterAcad);
	jQuery('#acadLinkClose'+counterAcad).attr('onClick',"closeAcadInfoPannel('" + counterAcad + "')");
	
	jQuery('#acadPannelAvailable').attr('id','acadPannelAvailable'+counterAcad);
	jQuery('#acadInfoTB').attr('id','acadInfoTB'+counterAcad);
		
	latestContent = jQuery('#academicContent').html();	
	//alert(oldContent);
	jQuery('#academicInfoContainer').append(latestContent);
	jQuery('#academicContent').html(oldContent);
	
	jQuery('#su_counterAcademicInfo').val(parseInt(jQuery('#su_counterAcademicInfo').val())+parseInt(1));
	
	/*
    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)
{
	var data;  
  if(countryName != 'Pakistan') {
   _H('pkH');
   _S('nonPkH');
   _H('pkM');
   _S('nonPkM');
  }
  else
  {
   _S('pkH');
   _H('nonPkH');
   _S('pkM');
   _H('nonPkM');
  }
  
  if(countryName == 'USA')
   jQuery('#su_CitiSpan').html('<input id="su_city" type="text" maxlength="40" size="30" value="" name="su_city"/>');
  else if(countryName == '')
   jQuery('#su_CitiSpan').html('<select name="su_city" id="su_city"><option value="">- Select City -</option></select>');
  else
  {
	 data = {country:countryName}
	 _H('su_CitiSpan');
  	_ajx( 'ajx/register.php', data, function(d){jQuery('#su_CitiSpan').html(d);jQuery('#su_CitiSpan').show();}, 'sucp', '', 'string', 'get');
  }
}

/*
function chCntry(countryName){
  
  if(countryName != 'Pakistan') {
   _H('pkH');
   _S('nonPkH');
   _H('pkM');
   _S('nonPkM');
  }
  else
  {
   _S('pkH');
   _H('nonPkH');
   _S('pkM');
   _H('nonPkM');
  }
  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(); 
		if($('spRow'))
		 $('spRow').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(); 
		if($('spRow'))
		 $('spRow').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();	  
   }
}	 

