function cloth_gateway(action,range) {
var url;

switch (action) {
case 'search':
document.getElementById("main_search").innerHTML = "processing";
//alert('search');
	 url="cloth.php?start_range=1&action=search";
	 break;
case 'move': 

document.getElementById("cloth_search_result").innerHTML = "processing";
url="cloth.php?start_range="+range+"&action=move&location1="+document.getElementById('search_city').value+"&name="+document.getElementById('search_name').value;
	 break;

case 'filtered_search': 
document.getElementById("cloth_search_result").innerHTML = "processing";
  url="cloth.php?start_range=1&action=filtered_search&location1="+document.getElementById('search_city').value+"&name="+document.getElementById('search_name').value;
	 break;

case 'refresh_checklist_cloth_result':
	document.getElementById("checklist_cloth_result").innerHTML = "processing";
	url="refresh_divs.php?choice=cloth";
	 break;
default: result = 'unknown';
}

var xmlHttp=null;
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 

    xmlHttp.open('GET', url, true);

    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

    xmlHttp.onreadystatechange = function() {

        if (xmlHttp.readyState == 4) {

switch (action) {
case 'search':
	 cloth_updatepage("main_search",xmlHttp.responseText);
	 break;
case 'move': 
	 cloth_updatepage("cloth_search_result",xmlHttp.responseText);
	 break;
case 'filtered_search': 	
	 cloth_updatepage("cloth_search_result",xmlHttp.responseText);
	 break;
case 'refresh_checklist_cloth_result':
	 cloth_updatepage("checklist_cloth_result",xmlHttp.responseText);
	 break;
default: result = 'unknown';
}


        }

    }

    xmlHttp.send(url);

        }
        

        function cloth_updatepage(area,matter){
	document.getElementById(area).innerHTML = matter;

        }
