
var routes = new Array(10);
var transparents = new Array(10);
//var backgrounds = new Array(10);
var toggles = new Array(10);
var prefixes = new Array(10);

function newRouteMap( id, 
				          image_prefix ) {
// first do the prefixes and toggles
	prefixes[ id ] = image_prefix;
	toggles[ id ] = 'on';
	
// first preload the images
	if ( document.images ) {
		transparents[ id ] = new Image();
		transparents[ id ].src = prefixes[ id ] + "-transparent.gif";
		routes[ id ] = new Image();
		routes[ id ].src = prefixes[ id ] + "-routes.gif";
//		backgrounds[ id ] = new Image();
//		backgrounds[ id ].src = prefixes[ id ] + ".jpg";
	}

}

function toggleRouteMap( id ) {


   if (document.layers) {
      if ( toggles[ id ] == 'off' ) {
			toggles[ id ] = 'on';
         document.images[ id ].src= routes[ id ].src;
//         document.layers[ id + "-bg" ].background.src = backgrounds[ id ].src;
      } else {
			toggles[ id ] = 'off';
         document.images[ id ].src= tranparents[ id ].src;
//         document.layers[ id + "-bg" ].background.src = backgrounds[ id ].src;
      }
   }
   else if (document.all) {
		if ( toggles[ id ] == 'off' ) {
			toggles[ id ] = 'on';
			window.document.all[ id ].src = routes[ id ].src;
	   } else {
			toggles[ id ] = 'off';
			window.document.all[ id ].src = transparents[ id ].src;
	   }
	}
}

function toggle(bk_id,
					 bk_img,
                fg_id,
                fg_img,
                tr_img) 
{ 
   if (document.layers) {
      if ( document.images[fg_id].toggle == 'off' ) {
         document.images[fg_id].toggle='on';
         document.images[fg_id].src=fg_img;
         document.layers[bk_id].background.src = bk_img;
      } else {
         document.images[fg_id].toggle='off';
         document.images[fg_id].src=tr_img;
         document.layers[bk_id].background.src = bk_img;
      }
   }
   else if (document.all) {
      if ( window.document.all[fg_id].toggle == 'off' ) {
         window.document.all[fg_id].toggle='on';
         window.document.all[fg_id].src=fg_img;
      } else {
         window.document.all[fg_id].toggle='off';
         window.document.all[fg_id].src=tr_img;
      }
   }
 } 

function preload(img)
{ 
   image1 = new Image();
   image1.src = img;
}

function statusOn(){
	window.status='Click to toggle routes';
	return true;
}

function statusOff(){
	window.status='';
	return true;
}



