function Show(op) {
  document.getElementById('retailers').style.display='none';
  document.getElementById('distributors').style.display='none'; 
  
  if (op == '1') {
    document.getElementById('retailers').style.display="block";
  }
  if (op == 2) {
    document.getElementById('distributors').style.display="block";
  } 
}

var handleFailure = function(){

};

var handleSuccessCityShop = function(o){
	YAHOO.util.Dom.get('city').innerHTML = o.responseText;	
};

var callbackCityShop = {success:handleSuccessCityShop, failure:handleFailure};

var showCity = function(){
	if(YAHOO.util.Dom.get('type').value == 0){
		YAHOO.util.Dom.setStyle('orange-shop', 'display', 'block');
		YAHOO.util.Dom.setStyle('retailer', 'display', 'none');
		
	}
	else{
		YAHOO.util.Dom.setStyle('orange-shop', 'display', 'none');
		YAHOO.util.Dom.setStyle('retailer', 'display', 'block');		
	}
	
};

var handleSuccessShop = function(o){
	YAHOO.util.Dom.get('results').innerHTML = o.responseText;
	
};

var callbackShop = {success:handleSuccessShop, failure:handleFailure};

var showShop = function(){	
		
	if(YAHOO.util.Dom.get('city_shop').value != ''){
		//alert(YAHOO.util.Dom.get('city_shop').value); 
		var request = YAHOO.util.Connect.asyncRequest('GET', 'getShop.php?city='+YAHOO.util.Dom.get('city_shop').value, callbackShop);
	}		
	
};


var populateCity = function(){
	var request = YAHOO.util.Connect.asyncRequest('GET', 'getCity.php?type=shop', callbackCityShop);
};

var displayinfoCity = function(){

	YAHOO.util.Dom.get('city').value = 'francistown';	
	//alert(YAHOO.util.Dom.get('city').value); 
	var request = YAHOO.util.Connect.asyncRequest('GET', 'getShop.php?city='+YAHOO.util.Dom.get('city').value, callbackShop);			
	
};

YAHOO.util.Event.addListener(window, 'load', populateCity);
YAHOO.util.Event.addListener('type', 'change', showCity);
YAHOO.util.Event.addListener('city_shop', 'change', showShop);
YAHOO.util.Event.addListener(window,'load',displayinfoCity);