function showDiv(id) 
{
     if (document.getElementById)
     { // DOM3 = IE5, NS6
       if(document.getElementById(id).style.display == 'block')
       {document.getElementById(id).style.display = 'none';
	   document.getElementById(id).style.visibility= 'hidden';
	   }
       else
       {document.getElementById(id).style.display = 'block';
	   document.getElementById(id).style.visibility= 'visible';
	   }
     }
     else
     {
       if (document.layers)
       { // Netscape 4
         document.hideShow.display = 'block';
       }
       else 
       { // IE 4
           document.all.hideShow.style.display = 'block';
       }
     }
}

var formcheck = 'rad1';
       var url = "nav.php?cat=";
	   var url2 = "item.php?id=";
	  var url3 = "home.php?content=";
	    var url4 = "show_times.php?staff_time=";
	    var url5 = "cal2.php?day_time=";
		 var url6 = "booking_cal.php";
		 var url7 = "booking_cal.php?m=";		 
		 var url8 = "add_booking.php?time=";
		
		
       function handleHttpResponse() {   
	   //alert (http.readyState);
        if (http.readyState == 4) {
              if(http.status==200) {
              var results=http.responseText;
              document.getElementById('items').innerHTML = results;
              }
              }
        }
		
       function handleHttpResponse2() {   
        if (http.readyState == 4) {
              if(http.status==200) {
              var results=http.responseText;
              document.getElementById('right').innerHTML = results;
              }
              }
        }	
		
	       function handleHttpResponse3() {   
	        if (http.readyState == 4) {
	              if(http.status==200) {
	              var results=http.responseText;
	              document.getElementById('show_times').innerHTML = results;
	              }
	              }
	        }					
			
		function handleHttpResponse4() {   		
		//alert (div);		
	        if (http.readyState == 4) {
	              if(http.status==200) {
	              var results=http.responseText;				 
	              document.getElementById('test').innerHTML = results;
	              }
	              }
	        }			
       
       function new_nav(cat){
		http.open("GET", url + escape(cat) , true);
		http.onreadystatechange = handleHttpResponse;
		http.send(null);		
		}

       function new_item(id){
		http.open("GET", url2 + escape(id) , true);
		http.onreadystatechange = handleHttpResponse2;
		http.send(null);		
		}

		
		function content(content){
		http.open("GET", url3+ escape(content), true);
		http.onreadystatechange = handleHttpResponse2;
		http.send(null);		
		}
		
		function call_booking_cal(){
		  var grid=1;
		http.open("GET", "booking_cal.php", true);
		//alert (url6);
		http.onreadystatechange = handleHttpResponse;
		http.send(null);		
		}

       // function v_day('start','17:00:15', '1', '2007', '8')
		function v_day(when, time, grid, y, z, timestamp, m, other){
		http.open("GET", url5 + escape(time) + '&when='  + escape(when) + '&grid='  + escape(grid)  + '&y='  + escape(y) + '&z='  + escape(z)  + '&grid='  + escape(grid) + '&timestamp='  + escape(timestamp) + '&m='  + escape(m)  + '&other='  + escape(other)    , true);
		http.onreadystatechange = handleHttpResponse2;
		http.send(null);		
		}
		
		
		function show_day(m, y, timestamp, z, grid){
		http.open("GET", url3+ escape(m) + '&y='  + escape(y)  + '&timestamp='  + escape(timestamp)   + '&z='  + escape(z)    + '&grid='  + escape(grid), true);
		http.onreadystatechange = handleHttpResponse2;
		http.send(null);		
		}
		
		function show_day2(m, y, timestamp, z){
		http.open("GET", url7+ escape(m) + '&y='  + escape(y)  + '&timestamp='  + escape(timestamp)   + '&z='  + escape(z), true);
		http.onreadystatechange = handleHttpResponse2;
		http.send(null);		
		}
		
		function ch_staff(fid,grid){
	   var form    = document.forms[fid];
	   var h = form.h.value;
	   var m = form.m.value;
	   var day = form.day.value;
	   var grid = form.grid.value;
	   var when = form.when.value;
	   var new_time = h + ':' + m + ':00' ;
		http.open("GET", url4+ escape(new_time) + '&day='  + escape(day)  + '&staffid='  + escape(grid)  + '&when='  + escape(when) , true);
		http.onreadystatechange = handleHttpResponse3;
		http.send(null);		
		}
		
		

		
function getHTTPObject() {
  var xmlhttp;

  if(window.XMLHttpRequest){
    xmlhttp = new XMLHttpRequest();
  }
  else if (window.ActiveXObject){
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    if (!xmlhttp){
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
   
}
  return xmlhttp;

 
}

var http = getHTTPObject(); // We create the HTTP Object

