//var ROOTURL="http://localhost/COM/MAKE/davidake/";
var ROOTURL="http://www.davidake.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 load_map($map_id) {
   $elem=document.getElementById($map_id);
	 if (GBrowserIsCompatible()) {
      var $map = new GMap2($elem);

      $point=new GLatLng(53.79934,-1.55239);
      $map.setCenter($point,13);
      var $opts = new Object();
      $opts.title = "David Ake and Co";
      var $marker = new GMarker($point,$opts);
      $map.addOverlay($marker);
      $marker.openInfoWindowHtml('<strong>David Ake and Co</strong><br />Falk House, Westgate, Leeds, LS1 2RA<br /><a href="http://maps.google.com/maps?f=q&hl=en&geocode=&time=&date=&ttype=&q=LS1+2RA&ie=UTF8&z=16&iwloc=addr&om=1" target="_blank"><strong>Find us on Google Maps</strong></a>');

      var $blue = new GIcon(G_DEFAULT_ICON);
      $blue.image = "http://labs.google.com/ridefinder/images/mm_20_green.png";
      $blue.iconSize = new GSize(12, 20);
			$blue.shadowSize = new GSize(22, 20);
      $point=new GLatLng(53.79979,-1.55200);
      var $opts = new Object();
      $opts.title = "Leeds Magistrates Courts";
      $opts.icon = $blue;
      var $marker2 = new GMarker($point,$opts);
      $map.addOverlay($marker2);

			
      $map.setZoom(16);
      $map.addControl(new GLargeMapControl());
   }
	 return true;
}
function show_note(){
   $note=document.getElementById('importantnote');
   if($note.style.display=='none' || !$note.style.display){
	    $note.style.display='block';
	 }else{
	    $note.style.display='none';
	 }
}