function getXMLHTTPRequest() 
{
	try 
    {
     	req = new XMLHttpRequest();
    } 
	catch(err1) 
	{
      	try 
		{
           req = new ActiveXObject("Msxml2.XMLHTTP");
        } 
		catch(err2) 
		{
           try 
		   {
              req = new ActiveXObject("Microsoft.XMLHTTP");
           }
		   catch (err3)
		   {
              req = false;
           }
        }
    }
	return req;
}
var http = getXMLHTTPRequest();
var id_pr;
var id_val;
var id_cou;					  


function useHttpResponseList()
{
	if (http.readyState == 4) 
	{
		document.getElementById('adv_box').innerHTML = '';
		removeAllOptions(document.getElementById('province_change1'));
		removeAllOptions(document.getElementById('city_change1'));
		addOption(document.getElementById('province_change1'),'', 'select')
	 	if(http.status == 200) 
		{
			
		    var response = http.responseText;
			var cities = response.split('|');
			for (i=1; i<cities.length; i++) {
				var sep = cities[i].split('~');
				addOption(document.getElementById('province_change1'),sep[0], sep[1])
		    }
		    
		    
		 }
		 
	}
	else
	{
 		document.getElementById('adv_box').innerHTML = '<img src="javascript/loading.gif" />';
	}
	
}



function fillCityList()
{
	if (http.readyState == 4) 
	{
		document.getElementById('adv_box1').innerHTML = '';
	 	if(http.status == 200) 
		{
		    var response = http.responseText;
			var cities = response.split('|');
			removeAllOptions(document.getElementById('city_change1'));
			
			for (i=1; i<cities.length; i++) {
				var sep = cities[i].split('~');
				addOption(document.getElementById('city_change1'),sep[0], sep[1])
		    }
		}
	}
	else
	{
 		document.getElementById('adv_box1').innerHTML = '<img src="javascript/loading.gif" />';
	}
	
}	

function fillCityList1()
{
	if (http.readyState == 4) 
	{
	//	document.getElementById('adv_box1').innerHTML = '';
	 	if(http.status == 200) 
		{
		    var response = http.responseText;
			var cities = response.split('|');
			removeAllOptions(document.getElementById('city_change1'));
			
			for (i=1; i<cities.length; i++) {
				var sep = cities[i].split('~');
				addOption(document.getElementById('city_change1'),sep[0], sep[1])
		    }
		}
	}
	else
	{
 	//	document.getElementById('adv_box1').innerHTML = '<img src="javascript/loading.gif" />';
	}
	
}

function loadSus()
{
	if (http.readyState == 4) 
	{
		document.getElementById('img_sus').innerHTML = '';
	 	if(http.status == 200) 
		{
		   
		    history.go(0);
		}
	}
	else
	{
 		document.getElementById('img_sus').innerHTML = '<img src="javascript/loading.gif" />';
	}
	
}
	
	
function useHttpResponseList1()
{
	if (http.readyState == 4) 
	{
	//	document.getElementById('adv_box').innerHTML = '';
	 	if(http.status == 200) 
		{
		    var response = http.responseText;
			var cities = response.split('|');
			removeAllOptions(document.getElementById('city_change1'));
			for (i=1; i<cities.length; i++) {
				var sep = cities[i].split('~');
				addOption(document.getElementById('city_change1'),sep[0], sep[1])
		    }
		    var selectBox= document.getElementById('city_change1');
   			for (var no = 0; no < selectBox.options.length; no++)
   			{
       			if (selectBox.options[no].value == id_val)
	   			{
            		selectBox.selectedIndex = no;
            		break;
       			}
   			}
   			
   			var selectBox= document.getElementById('province_change1');
   			for (var no = 0; no < selectBox.options.length; no++)
   			{
       			if (selectBox.options[no].value == id_pr)
	   			{
            		selectBox.selectedIndex = no;
            		break;
       			}
   			}
   		   		          
   		}
	}
	else
	{
 		//document.getElementById('box').innerHTML = '<img src="javascript/loading.gif" />';
	}
	
}		  


function changeProvinceList(id,value)
{
	var myurl = 'index2.php';
	var modurl = myurl+"?com_route=country&value="+value+"&id="+id;
	http.open("GET", modurl, true);
	http.onreadystatechange = useHttpResponseList;
	http.send(null); 
}

function changeCityList(id,value,country)
{
	var myurl = 'index2.php';
	var modurl = myurl+"?com_route=country&value="+value+"&city=1&id="+id+"&country="+country;
	http.open("GET", modurl, true);
	http.onreadystatechange = fillCityList;
	http.send(null); 
}


function changeProvinceList1(id,value,pr,val)
{
	var myurl = 'index2.php';
	var modurl = myurl+"?com_route=country&country="+value+"&city=1&id="+id+"&value="+pr;
	http.open("GET", modurl, true);
	id_pr = pr;
	id_val = val;
	id_cou = value;
	http.onreadystatechange = useHttpResponseList1;
	http.send(null); 
}

function suspend_lis(val,sel)
{
	
	var myurl = 'index2.php';
	var modurl = myurl+"?com_route=suspend_terminate&action=suspend&id="+val+"&select="+sel;
	http.open("GET", modurl, true);
	http.onreadystatechange = loadSus;
	http.send(null);
}
function recall_lis(val)
{
	var myurl = 'index2.php';
	var modurl = myurl+"?com_route=suspend_terminate&action=recall&id="+val;
	http.open("GET", modurl, true);
	http.onreadystatechange = loadSus;
	http.send(null);
}
