// JavaScript Document

function selOpt(OptionListName, ListVal)
{	
	for (i=0; i < OptionListName.length; i++)
	{
		if (OptionListName.options[i].value == ListVal)
		{
			OptionListName.selectedIndex = i;
			break;
		}
	}
}

var popUpWin=0;
function puWin(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
	  if (!popUpWin.closed)
	        //alert('');
	    popUpWin.close();
  }
 	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function fillFields()
{
	
  if($('#su_fname').val()=='')
   $('#su_fname').val('First Name');     
  if($('#su_lname').val()=='')
   $('#su_lname').val('Last Name');  
  if($('#su_cityCodeHomePhone').val()=='')
   $('#su_cityCodeHomePhone').val('Code');   
  if($('#su_jobAlertkeyword') && $('#su_jobAlertkeyword').val()=='')
   $('#su_jobAlertkeyword').val('Enter Keywords');
  if($('#su_cityCodeOfficePhone').val()=='')
   $('#su_cityCodeOfficePhone').val('Code');  
  if($('#su_officePhoneExt').val()=='')
   $('#su_officePhoneExt').val('Ext If Any'); 
  if($('#su_pcityCodeOfficePhone').val()=='')
   $('#su_pcityCodeOfficePhone').val('Code');  
  if($('#su_pofficePhoneExt').val()=='')
   $('#su_pofficePhoneExt').val('Ext If Any');  
   
}
function showBlank(fieldName,fieldValue)
{
//alert(fieldName+fieldValue);
 if(fieldName=='su_fname' && fieldValue=='First Name')
    $('#su_fname').val('');  
  else if(fieldName=='su_lname' && fieldValue=='Last Name')
   $('#su_lname').val('');
  else if(fieldName=='su_cityCodeHomePhone' && fieldValue=='Code')
   $('#su_cityCodeHomePhone').val('');
   else if(fieldName=='su_jobAlertkeyword' && fieldValue=='Enter Keywords')
   $('#su_jobAlertkeyword').val('');
   else if(fieldName=='su_cityCodeOfficePhone' && fieldValue=='Code')
   $('#su_cityCodeOfficePhone').val('');
   else if(fieldName=='su_officePhoneExt' && fieldValue=='Ext If Any')
   $('#su_officePhoneExt').val('');
   else if(fieldName=='su_pcityCodeOfficePhone' && fieldValue=='Code')
   $('#su_pcityCodeOfficePhone').val('');
   else if(fieldName=='su_pofficePhoneExt' && fieldValue=='Ext If Any')
   $('#su_pofficePhoneExt').val('');
  
}


function chCntry(countryName){

  if(countryName != 'Pakistan') {
   $('#pkH').hide();
   $('#nonPkH').show();
   $('#pkM').hide();
   $('#nonPkM').show();
   $('#pkOff').hide();
   $('#nonPkOff').show();
   
   $('#su_mobilePhone1').val('');
   $('#su_officePhone1').val('');
  }
  else
  {
   $('#pkH').show();
   $('#nonPkH').hide();
   $('#pkM').show();
   $('#nonPkM').hide();
   $('#pkOff').show();
   $('#nonPkOff').hide();
  
   $('#su_mobilePhone').val('');
   $('#su_officePhone').val('');
  }
	if(countryName == 'USA')
   $('#su_CitiSpan').html('<input id="su_city" type="text" maxlength="40" size="30" value="" name="su_city"/>');     
  else if(countryName == '')
   $('#su_CitiSpan').html('<select name="su_city" id="su_city"><option value="">- Select City -</option></select>');     
 else
	  	$('#su_CitiSpan').load("jx/register.php?country="+countryName);
  
}

function checkUniv(obj,spanID)
{
	if (obj.value == "Other")
	 $('#spOthUniv').show();
	else
	 $('#spOthUniv').hide();
}

/*///////////////////////////////////////
   Function Name: loadCities(countryName)
   Purpose : load cities w.r.t country
   Created By : Naveed saleem
*////////////////////////////////////////
function loadCities(countryName){
  
  if(countryName != 'Pakistan') {
   $('#ppkOff').hide();
   $('#pnonPkOff').show();
  }
  else
  {
   $('#ppkOff').show();
   $('#pnonPkOff').hide();
  }
  
  if(countryName == 'USA')
   $('#su_pCitiSpan').html('<input id="su_pcity" type="text" maxlength="40" size="30" value="" name="su_pcity"/>');     
  else if(countryName == '')
   $('#su_pCitiSpan').html('<select name="su_pcity" id="su_pcity"><option value="">- Select City -</option></select>');     
 else
	  	$('#su_pCitiSpan').load("jx/register.php?country="+countryName);
}




function showHideLyrs(){

	if($('#su_fresh1').attr("checked")==true){
		$('#profInd').html( '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').html('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 checkSelectIndustry(){		
		if ($('#su_industry').val()=="0") 
		$('#otherIndustry').show();
		else 
		$('#otherIndustry').hide();
}
function checkSelectIndustry(){		
		if ($('#su_industry').val() == "0") 
		$('#otherIndustry').show();
		else 
		$('#otherIndustry').hide();
}

function checkMonthStatus(index){
	if ($('#su_toMonth').val() == "present")	
	$('#su_toYear').hide();
	else 
	$('#su_toYear').show();

}

function chgPartnerType(partnerType)
{
	$('#pname_tr').show();
	$('#pceo_tr').show();
	$('#pdesignation_tr').show();
	
	if(partnerType == 'freelance trainer')
	{
		$('#su_partnerName').val('');
		$('#su_ceo').val('');
		$('#su_designation').val('');
		
		$('#pname_tr').hide();
		$('#pceo_tr').hide();
		$('#pdesignation_tr').hide();
	}
	
}

//Added By Naveed Saleem
var newwindow=0;

function popitup(url,windowName,width,height)
{
	var left = (screen.width/2)-(width/2);
	var top = (screen.height/2)-(height/2);
	
    if(newwindow)
    {
	  if (!newwindow.closed)
			newwindow.close();
    }
	newwindow = window.open(url,windowName,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top);
	if(window.focus)
		newwindow.focus();
	
}
//End