function Change_List(selectName,selectValue){	
	var ret;
	if(selectName=="country"){ 
		var depSel=document.getElementById("ff446_s");
		ret=makeRequestAjax('/iface/adm_custom/get_lists.php?change=reg&val='+selectValue,'',false);		
		if(depSel != null && ret!=""){
			if(navigator.userAgent.indexOf("MSIE") != -1){
           		depSel.innerHTML="";			
				depSel.outerHTML=depSel.outerHTML.toString().replace("</SELECT>","")+ret+'</select>';           
         	}
         	else{
				depSel.innerHTML="";
        		depSel.innerHTML =ret;
        	 }	
		}
		ret="";
		var vilSel=document.getElementById("ff447_s");
		ret=makeRequestAjax('/iface/adm_custom/get_lists.php?change=cityRg&val='+selectValue,'',false);		
		if( vilSel != null && ret!=""){
			if(navigator.userAgent.indexOf("MSIE") != -1){
           		vilSel.innerHTML="";
				vilSel.outerHTML=vilSel.outerHTML.toString().replace("</SELECT>","")+ret+'</select>';
			 }
         	else{
				vilSel.innerHTML="";
       			vilSel.innerHTML =ret;
         	}
		}
	}
	if(selectName=="region"){ 
		var changePar="city";
		if(selectValue == "0"){
			var regSel=document.getElementById("ff446_s");
			if(regSel!=null){
				if(regSel.value != "0")	{
					selectValue=regSel.value;
					var changePar="cityRg";
				}
			}
		}
		ret=makeRequestAjax('/iface/adm_custom/get_lists.php?change='+changePar+'&val='+selectValue,'',false);
		var vilSel=document.getElementById("ff447_s");
		if( vilSel != null && ret!=""){
			if(navigator.userAgent.indexOf("MSIE") != -1){
           		vilSel.innerHTML="";
				vilSel.outerHTML=vilSel.outerHTML.toString().replace("</SELECT>","")+ret+'</select>';
         	}
			else{
				vilSel.innerHTML="";
       			vilSel.innerHTML =ret;
         	}
		}
	}
	
}

var http_request = false;

function makeRequestAjax(url,val,assinc) {
	http_request = false;		
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	if (!http_request) {
		alert('Giving up :( Cannot create an XMLHTTP instance');
		return false;
	}

	if(assinc)	http_request.onreadystatechange = alertContents;
	http_request.open('POST', url, assinc);
	http_request.send(val);

	if(!assinc){
		return http_request.responseText;
	}

}

function alertContents() {		
	if (http_request.readyState == 4) {	// COMPLETED
		if (http_request.status == 200) {	// HTTP STATUS			
			return http_request.responseText;

		} else {
			alert('There was a problem with the request.');
			return false;
		}
	}
}

