 
var doc = null;
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
	var clientVer = parseInt(navigator.appVersion); // Get browser version
	var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
	var is_op = ( (clientPC.indexOf("opera") != -1));
	var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('firefox')!=-1));

function ajax() {
	// Make a new XMLHttp object
	if (typeof window.ActiveXObject != 'undefined' ) doc = new ActiveXObject("Microsoft.XMLHTTP");
	else doc = new XMLHttpRequest();
}
var destination3 = null;
var destination4 = null;
function SelectCountry(section, destination){destination.innerHTML = "Loading data...";
    	ajax(); 	
	    if (doc){
	       destination.innerHTML = "Loading data..."; 
	       doc.open("GET", "http://"+location.hostname+"/js/location.php?sec=" + section + "&sel=country", false);
	       doc.send(null);
     	
	       destination.innerHTML = doc.responseText;
	    }
	    else{
	      
	       destination.innerHTML = 'Browser unable to create XMLHttp Object';
	    }        
}



function SelectRegion(section, id_country, destination, destination2, str){
    
    if (id_country != '') {
    	destination3 = destination;
    	destination.innerHTML = "Loading data...";	
		ajax();
	    if (doc){
	    	function load1() {
				if (doc.readyState == 4) {
				if (doc.status == 200) {
					if (doc.responseText!='') destination3.innerHTML = doc.responseText;

				}}
			}
			
	       destination.innerHTML = "Loading data...";
		   
	       doc.open("GET", "http://"+location.hostname+"/js/location.php?sec=" + section + "&sel=region&id_country=" + id_country);
	       doc.onreadystatechange = load1;
	       doc.send("");
	    }
	    else{
	       destination.innerHTML = 'Browser unable to create XMLHttp Object';
	    }        
    }
    else {
    	destination.innerHTML = "Country is not selected";
    }
    if(section=='ip') {widths = 'width:160px'; }else widths = '';
    
    destination2.innerHTML = '<select name="city" disabled class="reg_user_login" style="display:inline;' + widths + '">' +
						'<option value="0"> '+ str +' </option>' +
					'</select>';
}




function SelectCity(section, id_region, destination){
    if (id_region != '') {destination.innerHTML = "Loading data...";
		ajax();
		
	    if (doc){
	       destination.innerHTML = "Loading data...";	
	       destination4 = destination;
	       doc.onreadystatechange = load2;
	       doc.open("GET", "http://"+location.hostname+"/js/location.php?sec=" + section + "&sel=city&id_region=" + id_region);
		   doc.send(null);

	    }
	    else{
	      
	       destination.innerHTML = 'Browser unable to create XMLHttp Object';
	    }        
    }
    else {
    	destination.innerHTML = "Region is not selected";
    }
	    
}
 
function load2() {
        if (doc.readyState == 4) {
        if (doc.status == 200) {
                if (doc.responseText!='') destination4.innerHTML = doc.responseText;
//				alert(destination3.innerHTML);
        }}
}


