function post_fetch(selected){
 
		xmlhttp = ajax_object();
		if(document.getElementById("radCountry").value != "" && document.getElementById("radCountry").value != null)
		{
			var url = 'ajaxHandler/getStates.php';
			var parameters = 'countryName=' + document.getElementById("radCountry").value;
		   
			xmlhttp.open("POST", url, parameters);
			   
			xmlhttp.onreadystatechange = function() 
			{
				if (xmlhttp.readyState == 4 || xmlhttp.readyState == "complete") 
				{
					//alert(xmlhttp.responseText);
					//alert('hi');
					removeOptions(document.getElementById("radState"));
					if(xmlhttp.responseText != "")
					{
						json = eval(xmlhttp.responseText);
						counter = 1;

						option = new Option("SELECT A STATE",0);
						document.getElementById("radState").options[0] = option;
						for(var i in json)
						{
							option = new Option(json[i],json[i]);
							document.getElementById("radState").options[counter] = option;
							if(selected == json[i])
							{
								document.getElementById("radState").options[counter].selected = "selected";
							}
							counter++;							
						}
					}
					else
					{
						option = new Option("SELECT A STATE",0);
						document.getElementById("radState").options[0] = option;
					}
				}
			}
		   
		   
			xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlhttp.setRequestHeader("Content-length", parameters.length);
			xmlhttp.setRequestHeader("Connection", "close");
		   
			xmlhttp.send(parameters);
		}
   
}

function storeJob(element){
 
		xmlhttp = ajax_object();
		if(element.checked == true)
		{
			checked = 1;
		}
		else
		{
			checked = 0;
		}
			var url = 'ajaxHandler/storeJob.php';
			var parameters = 'id=' + element.value + '&checked=' + checked;
		   
			xmlhttp.open("POST", url, parameters);
			   
			xmlhttp.onreadystatechange = function() 
			{
				if (xmlhttp.readyState == 4 || xmlhttp.readyState == "complete") 
				{
					//do nothing
				}
			}
		   
		   
			xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlhttp.setRequestHeader("Content-length", parameters.length);
			xmlhttp.setRequestHeader("Connection", "close");
		   
			xmlhttp.send(parameters);
		
   
}

function ajax_object() 
{
    var xmlhttp = null;
    if (window.XMLHttpRequest) 
	{
        xmlhttp = new XMLHttpRequest();
    } 
	else if (window.ActiveXObject) 
	{       
        //ProgIDs 5, 4 and below 3 are unstable
        var progids = new Array(
            'Msxml2.XMLHTTP.6.0', //newest and safest
            'Msxml2.XMLHTTP.3.0', //most common
            'Microsoft.XMLHTTP' //oldest fallback
        );
        for (var i = 0; i < progids.length && !xmlhttp; i++) 
		{
            try 
			{
                xmlhttp = new ActiveXObject(progids[i]);
            } 
			catch (e) 
			{
                //do nothing
            }
        }
    }
    return xmlhttp;
}


function removeOptions(element) {
	element.options.length = 0;
}

