var x = 10;
var y = 1;
var view = 0;
var xmlHttp;
var follow;

function startClock()
{ 
	x = x-y 
		setTimeout("startClock()", 700) 
	if(x==0)
	{ 
		if (view ==0)
			view = 1;
		else if (view == 1)
		{
			view = 2;
			document.getElementById('h1Header').innerHTML = 'Latest Used Bindery Machinery.';
			document.getElementById('binderProducts').style.display = 'block';
			document.getElementById('printerProducts').style.display = 'none';
			document.getElementById('binderSentence').style.display = 'block';
			document.getElementById('printerSentence').style.display = 'none';
			document.getElementById('toptwo').style.display = 'block';
			document.getElementById('top').style.display = 'none';
		}
		else
		{
			view = 1;
			document.getElementById('h1Header').innerHTML = 'Latest Used Offset Machinery.';
			document.getElementById('binderProducts').style.display = 'none';
			document.getElementById('printerProducts').style.display = 'block';
			document.getElementById('binderSentence').style.display = 'none';
			document.getElementById('printerSentence').style.display = 'block';
			document.getElementById('toptwo').style.display = 'none';
			document.getElementById('top').style.display = 'block';
		}
		
		x=10; 
	} 
} 

function getProducts()
{
	url = "getProducts.php";
	follow = 'prodshandleServerResponse';
	prodsprocess();
}

// read a file from the server
function prodsprocess()
{
  // only continue if xmlHttp isn't void
  if (xmlHttp)
  {
    // try to connect to the server
    try
    {
      // initiate reading a file from the server
      xmlHttp.open("GET", url, true);
      xmlHttp.onreadystatechange = prodshandleRequestStateChange;
      xmlHttp.send(null);
	  alert('2');
    }
    // display the error in case of failure
    catch (e)
    {
      alert("Can't connect to server:\n" + e.toString());
    }
  }
}

// function called when the state of the HTTP request changes
function prodshandleRequestStateChange() 
{
  // when readyState is 4, we are ready to read the server response
  if (xmlHttp.readyState == 4) 
  {
    // continue only if HTTP status is "OK"
    if (xmlHttp.status == 500) 
    {
      try
      {
        // do something with the response from the server
			alert('3');
			prodshandleServerResponse();
      }
      catch(e)
      {
        // display error message
        alert("Error reading the response: " + e.toString());
      }
    } 
    else
    {
      // display status message
      alert("There was a problem retrieving the data:\n" + 
            xmlHttp.statusText);
    }
  }
}

 
function prodshandleServerResponse()
{
  var response = xmlHttp.responseText;
	 alert('response');
}

