var ROOTURL="http://www.ctlnetworks.co.uk/";

function roll_over(image_id,change_to) {
   var this_img=document.getElementById(image_id);
   this_img.src=ROOTURL+change_to;
}
function post_form($form_id){document.getElementById($form_id).submit();}
function add_event($object,$type,$fn){ 
   if($object.attachEvent){ 
      $object['e'+$type+$fn] = $fn; 
      $object[$type+$fn] = function(){$object['e'+$type+$fn]( window.event );} 
      $object.attachEvent( 'on'+$type, $object[$type+$fn] ); 
   }else{
      $object.addEventListener($type,$fn,false); 
   }
}
function remove_event($object,$type,$fn){
   if($object.detachEvent){
      $object.detachEvent('on'+$type,$object[$type+$fn]);
      $object[$type+$fn]=null;
   }else{
      $object.removeEventListener($type,$fn,false);
   }
} 
function elements_with_class($elem,$tag_name,$class_name){
   var $arr_elems=($tag_name=="*" && document.all)? document.all : $elem.getElementsByTagName($tag_name);
   var $found = new Array();
   for($i=0;$i<$arr_elems.length;$i++){  
      if($arr_elems[$i].className==$class_name) $found.push($arr_elems[$i]);
   }
   return ($found);
}
function http_location($filename){
   window.location=$filename;
}
function confirm_action($message,$url) {
	var $answer=confirm($message);
	if($answer)window.location($url);
}
function picture_window($url,$width,$height,$window) {
   window.open($url+'&width='+$width+'&height='+$height,$window,"width="+$width+",height="+$height+",scrollbars=no,left=100,top=100");
}
function external_links(){
   if (!document.getElementsByTagName) return;
   var anchors = document.getElementsByTagName("a");
   for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")anchor.target = "_blank";
   }
}

function load_map($map_id) {
   $elem=document.getElementById($map_id);
	 if (GBrowserIsCompatible()) {
      var $map = new GMap2($elem);
      $point=new GLatLng(53.78293,-1.7164);
      $map.setCenter($point,13);
      var $marker = new GMarker($point);
      $map.addOverlay($marker);
      $map.setZoom(14);
      $marker.openInfoWindowHtml('Communication Technologies<br />Computer Network Cabling in Bradford');
      $map.addControl(new GLargeMapControl());
   }
	 return true;
}

function show_product_text($id){
   $hidden=elements_with_class(document,"*",'productdetails');
	 for($i=0;$i<$hidden.length;$i++){
	    $hidden[$i].style.display='none';
	 }
	 document.getElementById('productdetails'+$id).style.display='block';
   document.getElementById('productdetails'+$id).style.fontWeight='bold';
   document.getElementById('productdetails'+$id).style.color='#666666';
}

function preload_menu(){
   $pic1=new Image(126,56);$pic1.src=ROOTURL+'img/home2.gif';
   $pic2=new Image(155,56);$pic2.src=ROOTURL+'img/company2.gif';
   $pic3=new Image(148,56);$pic3.src=ROOTURL+'img/services2.gif';
   $pic4=new Image(152,56);$pic4.src=ROOTURL+'img/products2.gif';
   $pic5=new Image(141,56);$pic5.src=ROOTURL+'img/contact2.gif';
}

window.onload=preload_menu;