// JavaScript Document

// Preloads the maps
map1 = new Image();
map1.src = "pic-map-area.jpg";

map2 = new Image();
map2.src = "pic-map-inset.jpg";

function open_window(file) {
	
	var win2 = window.open(file,"print",'width=750,height=550,scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes');
	win2.focus();
	
}

function slideshow(ran_number) {
  document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="270" height="310" id="slideshow_front" align="middle">');
  document.writeln('<param name="allowScriptAccess" value="sameDomain" />');
  document.writeln('<param name="movie" value="slideshow_front_pt' + ran_number + '.swf" />');
  document.writeln('<param name="quality" value="high" />');
  document.writeln('<param name="bgcolor" value="#ffffff" />');
  document.writeln('<embed src="slideshow_front_pt' + ran_number + '.swf" quality="high" bgcolor="#ffffff" width="270" height="310" name="slideshow_front" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
  document.write('</object>');
}

var old_map = "inset";
function moveArrow(x,y,map) {
   
   if(map != "" && map != old_map) {
		toggleMaps(map);
		old_map = map;
   }
   
   document.map_holder.focus();
   
   // first get the object's stylesheet
    var styleObject = getStyleObject("arrow");
	    // then if we find a stylesheet, set its visibility
    // as requested
    //
    if (styleObject) {
		styleObject.visibility= "visible";
		styleObject.left = x + "px";
		styleObject.top = y + "px";
		return true;
    } else {
		return false;
    }
}

function toggleMaps(map) {
	var img_src = "pic-map-" + map + ".jpg";
	document['map_holder'].src=img_src;
	
}

function toggleMaps() {
	
	var styleObject = getStyleObject("arrow");
	if (styleObject) {
		styleObject.visibility= "hidden";
    }
	
	if (old_map == "area") {
		document['map_holder'].src="pic-map-inset.jpg";
		old_map = "inset"
	} else {
		document['map_holder'].src="pic-map-area.jpg";
		old_map = "area"
	}
	
}

function getStyleObject(objectId) {
  // checkW3C DOM, then MSIE 4, then NN 4.
  //
  if(document.getElementById && document.getElementById(objectId)) {
	return document.getElementById(objectId).style;
   }
   else if (document.all && document.all(objectId)) {  
	return document.all(objectId).style;
   } 
   else if (document.layers && document.layers[objectId]) { 
	return document.layers[objectId];
   } else {
	return false;
   }
}
