function getJobCatId(cat_id,subcat_id){  
	new Ajax.Request('internal_request.php?action=subcatlist&cat_id='+cat_id+'&subcat_id='+subcat_id,
	{
		method:'get',
		 onSuccess: function(transport,json){
		  var response = transport.responseText;
		  $('div_subcat_list').update(response) ;
		},
		onFailure: function(){ alert('Something went wrong...') }
	  });
}//function
//----------------------------------------------------------------------------------
function getCountryList(country_id){
	new Ajax.Request('internal_request.php?action=countrylist&countryid='+country_id,
	{
		method:'get',
		 onSuccess: function(transport){
		  var response = transport.responseText;
		  $('div_country_list').update(response) ;
		},
		onFailure: function(){ alert('Something went wrong...') }
	  });
}
//----------------------------------------------------------------------------------
function getCountryId(country_id,city_id){ 
	if(city_id=="0"){
	 	$('div_city_list').update("<img src='images/loading.gif'>") ;
	}
 	new Ajax.Request('internal_request.php?action=citylist&country_id='+country_id+'&city_id='+city_id,
	{
		method:'get',
		 onSuccess: function(transport){
		  var response = transport.responseText; 
		  $('div_city_list').update(response) ;
		},
		onFailure: function(){ alert('Something went wrong...') }
	  });
}//function
//--------------------------------------------------------------------------------------
function getCityList(country_id,city_id,div){
	new Ajax.Request('internal_request.php?action=citylistdiv&country_id='+country_id+'&city_id='+city_id+'&div_no='+div,
	{
		method:'get',
		 onSuccess: function(transport){
		  var response = transport.responseText;
			  $('city'+div).update(response) ;
		},
		onFailure: function(){ alert('Something went wrong...') }
	  });
}//function
//---------------------------------------------------------------------------------------
function addToFavorite(job_id,div){
	 $('div_favorite_job_'+div).show();	
	new Ajax.Request('internal_request.php?action=favoritejob&job_id='+job_id,
	{
		method:'get',
		 onSuccess: function(transport){
		  var response = transport.responseText;
		  // alert(response)
			$('div_favorite_job_'+div).update(response).setStyle({ color: '#FF0000' });
			 setTimeout("document.getElementById('div_favorite_job_'+"+div+").innerHTML=''",2500);

		},
		onFailure: function(){ alert('Something went wrong...') }
	  });
}
//-------------------------------------
function getPostJobCountryId(country_id,city_id){ 
	if(city_id=="0"){
	 	$('div_city_list').update("<img src='images/loading.gif'>") ;
	}
 	new Ajax.Request('internal_request.php?action=postjobcitylist&country_id='+country_id+'&city_id='+city_id,
	{
	  	  method:'get',
		  onSuccess: function(transport){
		  var response = transport.responseText; 
 		  $('div_city_list').update(response) ;
		},
		onFailure: function(){ alert('Something went wrong...') }
	  });
}//getPostJobCountryId
//-------------------------------------
var max_counter = 0 ;
var first_counter = 0 ;
function maxCitySelection(city_id,already_selection){ 
 	if(document.getElementById("city"+city_id).checked){
		first_counter++;
		if(first_counter==1){ 
			max_counter = already_selection+1 ; 
		}else{
			max_counter++;
		}
 		if(max_counter>4){
			alert("Sorry! You can’t select more than 4 cities");
			document.getElementById("city"+city_id).checked=false;
			max_counter--;
			return false;
		}
	}else{ 
		max_counter--;	
	}
}//function maxCitySelection
//---------------------------------------
function setJobDuration(tomonth){
	if(tomonth=="present"){
		$('div_to_year_list').hide();	
	}else{
		$('div_to_year_list').show();	
	}
}//function setJobDuration
//------------------------------------------
function selectMultipleCity(){
	var location = $('location').value; 
	var cityId = $('cityId').value; 
	if(location>0){
		getPostJobCountryId(location,cityId) ;
		$('div_location').update("<a href='javascript:selectSingleCity();'>Select Single City</a>") ;
		$('div_city').show() ;
	}
}//function
//--------------------------------------
function selectSingleCity(){
	var location = $('location').value;
	var cityId = $('cityId').value; 
	if(location>0){
		getCountryId(location,cityId) ;
		$('div_location').update("<a href='javascript:selectMultipleCity();'>Select Multiple Cities</a>") ;
		$('div_city').hide() ;
	}
}//function 