window.addEvent('domready', setupPage);

// this will be run once the dom is ready and before the images have loaded
function setupPage()
{
  // setup the banners
  $("ITBanner").setStyle("opacity", "1.0");
  $("CablingBanner").setStyle("opacity", "0.0");
  $("BespokeBanner").setStyle("opacity", "0.0");
  $("TelephonyBanner").setStyle("opacity", "0.0");

  // set up the tab contents
  $("ITContent").setStyle("display", "block");
  $("CablingContent").setStyle("display", "none");
  $("BespokeContent").setStyle("display", "none");
  $("TelephonyContent").setStyle("display", "none");

  // add onclick for clicking the tabs
  $("ITTab").addEvent("click", function(e){ TabClick("ITContent"); e.stop(); });
  $("CablingTab").addEvent("click", function(e){ TabClick("CablingContent"); e.stop(); });
  $("BespokeTab").addEvent("click", function(e){ TabClick("BespokeContent"); e.stop(); });
  $("TelephonyTab").addEvent("click", function(e){ TabClick("TelephonyContent"); e.stop(); });

  $("telephone").addEvent("mouseover", function(e){ $("telephone").highlight("#8dcfff"); });

  // start the banners
  new BannerFade
  ({
    timeBetween: 8000,
    banners : ["ITBanner","CablingBanner","BespokeBanner","TelephonyBanner"]
  });

/*  var req = new Request.HTML
  ({
    url:'test.php',
		onSuccess: function(html)
    {
			//Clear the text currently inside the results div.
			$('testContent').set('text', '');
			//Inject the new DOM elements into the results div.
			$('testContent').adopt(html);
		},
		//Our request will most likely succeed, but just in case, we'll add an
		//onFailure method which will let the user know what happened.
		onFailure: function()
    {
			$('testContent').set('text', 'The request failed.');
		}
	});

	$('test').addEvent('mouseenter', function() {
		req.send();
	});
	$('test').addEvent('mouseleave', function() {
			$('testContent').set('text', 'left now');
	});
req.startTimer({test : "testing"});*/
}

// handle the main tabs being clicked
function TabClick(visibleTab)
{
  $("ITContent").setStyle("display", "none");
  $("CablingContent").setStyle("display", "none");
  $("BespokeContent").setStyle("display", "none");
  $("TelephonyContent").setStyle("display", "none");

  $(visibleTab).setStyle("display", "block");
}


