var current_cs;


function addLoadEvent(func)
{
	var oldonload = window.onload;
	
	if ( typeof window.onload != "function" )
	{
		window.onload = func;
	}
	else
	{
		window.onload = function()
		{
			oldonload();
			func();
		}
	}
}

//	unobtrusive
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}
window.onload=startList;

function initRollovers() {
	if (!document.getElementById) return
	
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == 'rollover') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_over'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_over'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}



function casestudy(obj,show)	{

	//	reset background image and text colour of previous rollover
	if(current_cs)	{
	
		$(current_cs).style.color = 'white';
	
		switch(current_cs)	{
	
			case "ms":
			  $(current_cs).style.background = 'url(images/ms-thumb-roll.gif) 0 0 no-repeat';
			  $('ms_casestudy').style.display = 'none';
			  break;  
			case "charter":
			  $(current_cs).style.background = 'url(images/charterhouse-thumb-roll.gif) 0 0 no-repeat';
			  $('charter_casestudy').style.display = 'none';
			  break;  
			case "chevron":
			  $(current_cs).style.background = 'url(images/chevron-thumb-roll.gif) 0 0 no-repeat';
			  $('chevron_casestudy').style.display = 'none';
			  break;  	
			case "scottish":
			  $(current_cs).style.background = 'url(images/scottish-thumb-roll.gif) 0 0 no-repeat';
			  $('scottish_casestudy').style.display = 'none';
			  break;
			case "doncaster":
			  $(current_cs).style.background = 'url(images/doncaster-thumb-roll.gif) 0 0 no-repeat';
			  $('doncaster_casestudy').style.display = 'none';
			  break;

		}
	
	}
	
	//	set rollover state bgimage and text colour
	$(obj).style.color = '#003f8a';
	
	switch(obj)	{
	
		case "ms":
		  $(obj).style.background = 'url(images/ms-thumb-rollover.gif) 0 0 no-repeat';
		  current_cs = "ms";
		  break;  
		case "charter":
		  $(obj).style.background = 'url(images/charterhouse-thumb-rollover.gif) 0 0 no-repeat';
		  current_cs = "charter";
		  break;  
		case "chevron":
		  $(obj).style.background = 'url(images/chevron-thumb-rollover.gif) 0 0 no-repeat';
		  current_cs = "chevron";
		  break;  
		case "scottish":
		  $(obj).style.background = 'url(images/scottish-thumb-rollover.gif) 0 0 no-repeat';
		  current_cs = "scottish";
		  break; 
		case "doncaster":
		  $(obj).style.background = 'url(images/doncaster-thumb-rollover.gif) 0 0 no-repeat';
		  current_cs = "doncaster";
		  break; 
	}
	
	toggle(show)

}

function swapcopy(copy)		{
	
	
	var newcopy = copy;	
	
	
	switch(newcopy)	{
	
		case "charterone":
		  $('rollover-text').innerHTML = '<p>Retrofit of all heating, cooling and ventilation controls.  Priva controllers provide a simple, direct replacement of all HVAC controls promoting greater energy efficiency and system management.</p>';
		  break;  
		case "chartertwo":
		  $('rollover-text').innerHTML = '<p>Utilizes existing cabling - zero damage to buildings.  Because the Priva system does not require screened cabling, it can utilize the existing BMS cabling thereby safeguarding the fabric of historical buildings.</p>';
		  break;  
		case "charterthree":
		  $('rollover-text').innerHTML = '<p>System mimics existing BMS while future-proofing entire site.  Priva&#8217;s control philosophy of providing in-built multi-lingual communications as standard enables both a direct replacement of an older BMS while accommodating future developments in building control.</p>';
		  break;  
		case "charterfour":
		  $('rollover-text').innerHTML = '<p>Integrates with DALI lighting system.  With its built-in BACnet over IP capabilities, the Priva controller can communicate direct with the DALI protocol.</p>';
		  break;  
		case "charterfive":
		  $('rollover-text').innerHTML = '<p>Capital cost savings made by using existing BMS infrastructure.  Priva controllers support an extensive range of sensors and peripheral equipment as standard, generating savings in capital cost and installation time.</p>';
		  break;  
		case "charterhousedefault":
		  $('rollover-text').innerHTML = '<p><strong>Priva proves backward compatibility and future-proof controls</strong><br />P A Collacott & Company&#8217;s recommendation to install a building management system from Priva Building Intelligence at the famous Charterhouse school, is demonstrating the ease with which it can attain backward compatibility and integration with other manufacturers&#8217; systems, plus provide a platform for future-proof building control.</p>';
		  break; 
		  
		  
		case "chevronone":
		  $('rollover-text').innerHTML = '<p>Critical alarms alerted to security personnel wherever they are.  Using SMS (Short Messaging Service), the Priva BMS can contact security staff, via their mobile phones, to advise of critical alarms while they patrol the site.  </p>';
		  break;  
		case "chevrontwo":
		  $('rollover-text').innerHTML = '<p>Full air conditioning centrally monitored and controlled.  Including dedicated air conditioning systems serving the two IT suites and interfaced with the Priva BMS via a Modbus connection. </p>';
		  break;  
		case "chevronthree":
		  $('rollover-text').innerHTML = '<p>Facilities Manager automatically informed of building status.  Change-of-state and alarm reporting automatically sent to the FM&#8217;s PC and when the premises are vacant the alarm reporting is switched to the security staff.</p>';
		  break;  
		case "chevronfour":
		  $('rollover-text').innerHTML = '<p>Combining up-to-the-minute office design with state-of-the-art BMS.  Whatever the building type, be it a high specification, modern office or an historical building, Priva controllers provide the management capabilities to ensure an optimum working environment.</p>';
		  break;  
		case "chevronfive":
		  $('rollover-text').innerHTML = '<p>Intelligent boiler control with energy-saving routines.  Proven energy management routines, such as optimum start/stop and weather compensation, ensure occupancy comfort while reducing the building&#8217;s carbon footprint.</p>';
		  break;  
		case "chevrondefault":
		  $('rollover-text').innerHTML = '<p>At the heart of the new building management system (BMS) installed at Chevron&#8217;s new European headquarters in Aberdeen, is its ability to contact security staff, no matter where they are on site, to immediately advise of any critical alarms.  The BMS, supplied by Priva Intelligent Buildings and installed by Campbell Control Services Ltd, uses SMS (Short Messaging Service) to contact security staff, via their mobile phones, while they patrol the site.</p>';
		  break; 
		  
		 case "mandsone":
		  $('rollover-text').innerHTML = '<p>Energy savings reduce carbon footprint.  A building&#8217;s energy consumption can be dramatically reduced through the precise control of the HVAC services, thereby helping to reduce its overall carbon footprint.</p>';
		  break;  
		case "mandstwo":
		  $('rollover-text').innerHTML = '<p>Remotely controlled from one, central location using XML.  With an eye to the future, Priva has embraced TCP/IP networks and its associated languages.  For facilities and energy managers this means monitoring and controlling every building in their company&#8217;s portfolio, no matter where it is located.</p>';
		  break;  
		case "mandsthree":
		  $('rollover-text').innerHTML = '<p>Communicates with in-built chiller controls via Modbus.  Priva controllers come complete with an extensive range of protocols as standard, enabling direct communication with a vast array of HVAC plant and equipment, plus other manufacturers&#8217; control systems.</p>';
		  break;  
		case "mandsfour":
		  $('rollover-text').innerHTML = '<p>Retrofit of BMS retaining existing cabling and sensors.  Priva believes that waste in every area should be discouraged.  That&#8217;s why its building controls have been configured to interface with other manufacturers&#8217; sensors and cabling systems.  The result is a faster, less disruptive, more secure, and more cost effective installation.</p>';
		  break;  
		case "mandsfive":
		  $('rollover-text').innerHTML = '<p>Improved control strategy for energy efficiency and comfort.  By matching energy consumption with actual demand, the Priva BMS encourages staff efficiency by creating optimum comfort conditions, providing a welcoming environment for shoppers, and by working in tandem with refrigeration equipment it helps maintain the best possible conditions for the food hall.</p>';
		  break;  
		 case "mandsdefault":
		  $('rollover-text').innerHTML = '<p>Marks & Spencer is undertaking a programme of remodelling, and in thirteen of its stores the company has contracted Matrix Control Solutions to upgrade the various building management systems (BMS) with controllers from Priva Building Intelligence.  </p>';
		  break; 
	}
	
	
}


function toggle(showthis) {
	var el = $(showthis);
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';
		
	}
	else {
		el.style.display = 'block';
	}
}

function $() {
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1)
			return element;
		elements.push(element);
	}
	return elements;
}


function showhide(showthis) {
	var el = $(showthis);
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';
		
	}
	else {
		el.style.display = 'block';
	}
}


