﻿// JScript File
function onServiceChanged(elem) {
	sel = elem.selectedIndex-1;
	flag = 0;
	
	document.getElementById("serv_all").style.display = "none";
	for(var x = 0;x<13;++x) {
		if(x == sel) {
			document.getElementById("serv_"+x).style.display = "inline";
			flag=1;
			
		}
		else {
			document.getElementById("serv_"+x).style.display = "none";
		}
	}
	if(flag == 1)
		document.getElementById("serv_all").style.display = "none";
	else
		document.getElementById("serv_all").style.display = "inline";
	
}

function onCompanyChanged(elem) {
	sel = elem.selectedIndex;
	
	if(sel == 0)
		return;
	
	pageid = elem.options[sel].value;
	
	document.location="http://www.turner.co.uk/content.php?pid="+pageid;
}

matchHeight=function(){
     var divs,contDivs,maxHeight,divHeight,d;
     // get all <div> elements in the document
     divs=document.getElementsByTagName('div');
     contDivs=[];

     // initialize maximum height value
     maxHeight=0;

     // iterate over all <div> elements in the document
     for(var i=0;i<divs.length;i++){

          // make collection with <div> elements with class attribute 'container'

          if(/\bcontainer\b/.test(divs[i].className)){

                d=divs[i];

                contDivs[contDivs.length]=d;

                // determine height for <div> element

                if(d.offsetHeight){

                     divHeight=d.offsetHeight;

                }

                else if(d.style.pixelHeight){

                     divHeight=d.style.pixelHeight;

                }

                // calculate maximum height

                maxHeight=Math.max(maxHeight,divHeight);

          }

     }

    // assign maximum height value to all of container <div> elements
    if (contDivs.length > 0 && maxHeight > 600) {
     
        //alert(navigator.userAgent)
        
        //document.getElementById('Menu_Vertical').style.height = (maxHeight + 52) + 'px';
        //document.getElementById('BodyContainer').style.height = (maxHeight - 70) + 'px';
        //document.getElementById('RightContainer').style.height = maxHeight + 'px';
    }
     

}

// execute function when page loads
window.onload=function(){

     if(document.getElementsByTagName){

          matchHeight();

     }

}