$(document).ready(function(){
	$('#locationsContainer a').each( function(){
		if( typeof $(this).attr('city') == 'undefined' ){
			$(this).attr('city', $(this).html());
		}
	});
	
	$('#citySelector option').each( function(){
		if( typeof $(this).attr('city') == 'undefined' ){
			$(this).attr('city', $(this).html());
		}
	});
	
	$('#locationsContainer a').click( function(){
		postJobOppCityFiler( $(this).attr('city'), $(this).attr('country') );
		return false;
	});
});

function postJobOppCityFilerBySelect(){
	var intSelected = $('#citySelector')[0].selectedIndex;
	var eleSelected;
	
	if( intSelected == 0 ){
		
	}
	else{
		eleSelected = $('#citySelector option:selected');
		postJobOppCityFiler( eleSelected.attr('city'), eleSelected.attr('country') );
	}
}

function postJobOppCityFiler( city, country ){
	var eleForm = $('#' + nameSpace.globalInfo.formId);
	
	eleForm.attr('action', nameSpace.globalInfo.URLJobOpsSearch);
	eleForm.attr('method', 'post');
	
	$('#cboCity').val(city);
	$('#cboCountry').val(country);

	eleForm.submit();
}