 //##################################################################################################################################################
//##  Function takes restaurant id and displays to the right a google map and the restaurants info
//##
//#################################################################################################################################################
	
	//Display Function
	function DisplaySelectRestaurant(content_status_in)	//receives the reply from Ajax and PHP file runquery.php and displays

      {

        document.getElementById("restaurantinfodiv").innerHTML = content_status_in; 	 
		//var accleft = new Spry.Widget.Accordion("keyfeatbox", { useFixedPanelHeights: false, defaultPanel: -1});	  
		
		 //document.getElementById("status").innerHTML = content_status_in;

      }	   	
	  
	
	//Processing/Pass function  
	  	 function ProcessSelectRestaurantRequest()	//grabs all values from drop downs etc and creates the Ajax command
      
      {		
	  
	  	
		 var poststr = "rid=" + (document.getElementById("rest_names").value);
		
        

	
	postDataReturnText('modules/displayrestaurantdetails.php', poststr, DisplaySelectRestaurant);	
	 


      }	  
//#################################################################################################################################################

	  
	 
	 
	 
	 
//##################################################################################################################################################
//##  Function takes the type of wine and creats a list, wine can me white, red ,all ,other
//##
//#################################################################################################################################################
	
	//Display Function
	function DisplayWineList(content_status_in)	//receives the reply from Ajax and PHP file runquery.php and displays

      {

        document.getElementById("winelistlinkdiv").innerHTML = content_status_in; 	 
		//var accleft = new Spry.Widget.Accordion("keyfeatbox", { useFixedPanelHeights: false, defaultPanel: -1});	  
		
		 //document.getElementById("status").innerHTML = content_status_in;

      }	   	
	  
	
	//Processing/Pass function  
	  	 function ProcessWineListRequest(mode)	//grabs all values from drop downs etc and creates the Ajax command
      
      {		
	  
	  	
		 var poststr = "type=" + mode;
		
        

	
	postDataReturnText('modules/displaywinelist.php', poststr, DisplayWineList);	
	 


      }	  
//#################################################################################################################################################



 
//##################################################################################################################################################
//##  Function takes the id and shows a specific wines details
//##
//#################################################################################################################################################
	
	//Display Function
	function DisplayWineDetails(content_status_in)	//receives the reply from Ajax and PHP file runquery.php and displays

      {

        document.getElementById("winedetailsdiv").innerHTML = content_status_in; 	 
		//var accleft = new Spry.Widget.Accordion("keyfeatbox", { useFixedPanelHeights: false, defaultPanel: -1});	  
		
		 //document.getElementById("status").innerHTML = content_status_in;

      }	   	
	  
	
	//Processing/Pass function  
	  	 function ProcessWineDetailsRequest(id)	//grabs all values from drop downs etc and creates the Ajax command
      
      {		
	  
	  	
		 var poststr = "wid=" + id;
		
        

	
	postDataReturnText('modules/displaywinedetails.php', poststr, DisplayWineDetails);	
	 


      }	  
//#################################################################################################################################################





 
//##################################################################################################################################################
//##  Function takes the id and session id and deletes all instances of an item from the temp shop cart
//##
//#################################################################################################################################################
	
	//Display Function
	function ReturnFromDelete(content_status_in)	//receives the reply from Ajax and PHP file runquery.php and displays

      {

       // document.getElementById("winedetailsdiv").innerHTML = content_status_in; 	 
		//var accleft = new Spry.Widget.Accordion("keyfeatbox", { useFixedPanelHeights: false, defaultPanel: -1});	  
		window.location.reload();
		//alert(content_status_in);

      }	   	
	  
	
	//Processing/Pass function  
	  	 function DeleteItemFromCart(userid,itemid)	//grabs all values from drop downs etc and creates the Ajax command
      
      {		
	  
	    var poststr="";
		 poststr+="&user_id=" + userid;
		 poststr+="&item_id=" + itemid;
		 

	
	postDataReturnText('modules/deletefromcart.php', poststr, ReturnFromDelete);	
	 


      }	  
//#################################################################################################################################################








//##################################################################################################################################################
//## Ajax function
//##
//#################################################################################################################################################


function postDataReturnText(url, data, callback)
{ 
  var XMLHttpRequestObject = false; 

  if (window.XMLHttpRequest) {
    XMLHttpRequestObject = new XMLHttpRequest();
  } 
  
  
    if (XMLHttpRequestObject.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            XMLHttpRequestObject.overrideMimeType('text/html');
         }
  
  else if (window.ActiveXObject) {
    XMLHttpRequestObject = new 
     ActiveXObject("Microsoft.XMLHTTP");
  }

  if(XMLHttpRequestObject) {
    XMLHttpRequestObject.open("POST", url); 
    XMLHttpRequestObject.setRequestHeader('Content-Type', 
      'application/x-www-form-urlencoded'); 
	
    XMLHttpRequestObject.onreadystatechange = function() 
    { 
      if (XMLHttpRequestObject.readyState == 4 && 
        XMLHttpRequestObject.status == 200) {			
		
		//document.getElementById("status").innerHTML ="";
          callback(XMLHttpRequestObject.responseText); 
          delete XMLHttpRequestObject;
          XMLHttpRequestObject = null;
      }  else{
	  
	// document.getElementById("status").innerHTML = '<b>Please Wait</b>..&nbsp;&nbsp;<img src="img/ajax-loader.gif" border="0" width="32" height="32" alt="LOAD">';
	  }
    }

    XMLHttpRequestObject.send(data); 
  }
}

//#################################################################################################################################################

		//ROLLOVER FUNCTION

function roll(img,state) {
 if (state == 'on') { document.images[img].src = eval(img + "_on.src"); ;} 
 else { document.images[img].src = eval(img + "_off.src"); }
}

function preload(imgObj) {
	if (document.images) {
		eval(imgObj+'_off = new Image()');
		imgSrc = ('images/' + imgObj + '_off.gif');			
		eval(imgObj+'_off.src = "'+imgSrc+'"');
		eval(imgObj+'_on = new Image()');
		imgSrc = ('images/' + imgObj + '_on.gif');			
		eval(imgObj+'_on.src = "'+imgSrc+'"');		
	}
}

preload('wine_red');
preload('wine_white');


function imgToggle(img,state) { 
 if (state == 'on') { document.images[img].src = eval(img + "_on.src");state = 'off'; }
 else { document.images[img].src = eval(img + "_off.src");state='on'; }
}
	   
	   
imageStay = "";
prev = "";
check = true;

function stayImage(name,path,nextclick){
	if (check == true){
	document[name].src = path;
	if (imageStay != name){
		if (imageStay != ""){
			document[imageStay].src = prev;
		}
	}
	imageStay = name;
	prev = nextclick;
	if (check == true){
	 check = false;
	} else {
	 check = true;
	}
	}
}	  




