var xmlHttp;

function test()
{
	alert(document.form1.ctlSTATE3.value);
	//alert(document.form1.ctlCOMPANY_STATE.value + "testing");
	//alert('this is a testing mode');
}

//function test_state()
//{
//	alert("testing");
//}

function loadCountry(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 1)
		{
			document.getElementById('cboHolderCountry').innerHTML = '<img src='+baseUrl+'/images/indicator1.gif>';
		}
				
		if(ajaxRequest.readyState == 4)
		{
		
			document.getElementById("cboHolderCountry").innerHTML=ajaxRequest.responseText;
			document.getElementById('cboHolderCity').style.display='none';
			//document.myForm.txtMsg.value = ajaxRequest.responseText;								
		}
	}
	var url="";
		
	url=base_url+"location/loadCountries/"+document.form1.ctlSTATE.value;	
	ajaxRequest.open("GET", url, true);
	ajaxRequest.send(null);
}

function loadState(site_url){
	
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 1)
		{
			document.getElementById('cboHolderCountry').innerHTML = '<img src='+baseUrl+'/images/indicator1.gif>';
		}
				
		if(ajaxRequest.readyState == 4)
		{
		
			document.getElementById("cboHolderState").innerHTML=ajaxRequest.responseText;
			document.getElementById('cboHolderCity').style.display='none';
			//document.myForm.txtMsg.value = ajaxRequest.responseText;								
		}
	}
	var url="";
		
	url=site_url+"location/loadState/"+document.form.country_residences.value;	
	ajaxRequest.open("GET", url, true);
	ajaxRequest.send(null);
}


function loadCity(base_url){
	var ajaxRequestX;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequestX = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequestX = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequestX = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequestX.onreadystatechange = function(){
		
		if(ajaxRequestX.readyState == 1)
		{
			document.getElementById('cboHolderCity').innerHTML = '<img src='+baseUrl+'/images/indicator1.gif>';
		}
		
		if(ajaxRequestX.readyState == 4){
		document.getElementById('cboHolderCity').style.display='';
		document.getElementById("cboHolderCity").innerHTML=ajaxRequestX.responseText;		
			//document.myForm.txtMsg.value = ajaxRequest.responseText;
		}
	}
	
	var url="";
		
	url=base_url+"location/loadCities/"+document.form.state_region.value;	
	ajaxRequestX.open("GET", url, true);
	ajaxRequestX.send(null); 
}

function loadSubCat(base_url, id) {
	var ajaxRequestX;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequestX = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequestX = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequestX = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequestX.onreadystatechange = function(){
		
		if(ajaxRequestX.readyState == 1)
		{
			document.getElementById('cboHolderSubIndustry'+id).innerHTML = '<img src='+baseUrl+'/images/indicator1.gif>';
		}
		
		if(ajaxRequestX.readyState == 4){
		document.getElementById('cboHolderSubIndustry'+id).style.display='';
		document.getElementById("cboHolderSubIndustry"+id).innerHTML=ajaxRequestX.responseText;		
		}
	}
	
	var url="";
		
	url=base_url+"location/loadSubIndustry/"+document.form.industry_category.value+"/"+id;	
	ajaxRequestX.open("GET", url, true);
	ajaxRequestX.send(null); 
}

function loadSubCat2(base_url, id) {
	var ajaxRequestX;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequestX = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequestX = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequestX = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequestX.onreadystatechange = function(){
		
		if(ajaxRequestX.readyState == 1)
		{
			document.getElementById('cboHolderSubIndustry'+id).innerHTML = '<img src='+baseUrl+'/images/indicator1.gif>';
		}
		
		if(ajaxRequestX.readyState == 4){
		document.getElementById('cboHolderSubIndustry'+id).style.display='';
		document.getElementById("cboHolderSubIndustry"+id).innerHTML=ajaxRequestX.responseText;		
		}
	}
	
	var url="";
		
	url=base_url+"location/loadSubIndustry/"+document.form.industry_category_2.value+"/"+id;	
	ajaxRequestX.open("GET", url, true);
	ajaxRequestX.send(null); 
}
function loadSubCat3(base_url, id) {
	var ajaxRequestX;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequestX = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequestX = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequestX = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequestX.onreadystatechange = function(){
		
		if(ajaxRequestX.readyState == 1)
		{
			document.getElementById('cboHolderSubIndustry'+id).innerHTML = '<img src='+baseUrl+'/images/indicator1.gif>';
		}
		
		if(ajaxRequestX.readyState == 4){
		document.getElementById('cboHolderSubIndustry'+id).style.display='';
		document.getElementById("cboHolderSubIndustry"+id).innerHTML=ajaxRequestX.responseText;		
		}
	}
	
	var url="";
		
	url=base_url+"location/loadSubIndustry/"+document.form.industry_category_3.value+"/"+id;	
	ajaxRequestX.open("GET", url, true);
	ajaxRequestX.send(null); 
}



function loadSubCatJob(base_url) {
	var ajaxRequestX;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequestX = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequestX = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequestX = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequestX.onreadystatechange = function(){
		
		if(ajaxRequestX.readyState == 1)
		{
			document.getElementById('cboHolderJob').innerHTML = '<img src='+baseUrl+'/images/indicator1.gif>';
		}
		
		if(ajaxRequestX.readyState == 4){
		document.getElementById('cboHolderJob').style.display='';
		document.getElementById("cboHolderJob").innerHTML=ajaxRequestX.responseText;		
		}
	}
	
	var url="";
		
	url=base_url+"location/loadSubCatJob/"+document.form.job_category.value;	
	ajaxRequestX.open("GET", url, true);
	ajaxRequestX.send(null); 
}





