
/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
  Copyright 2001-3 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

// onresize for ns4
var origWidth, origHeight;
if (document.layers) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

var cur_lyr;	// holds id of currently visible layer
function swapLayers(id) {
  if (cur_lyr) hideLayer(cur_lyr);
  showLayer(id);
  cur_lyr = id;
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "visible";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "hidden";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}


var d = document
var R = "<br />"
var loaded = 0



//***********************
// BROWSER STUFF
//***********************
var isMAC = ((navigator.userAgent.toLowerCase()).indexOf("mac")!=-1);
var isIE = false //(document.all)?true:false
var isNS = false //(document.layers)?true:false
if (navigator.appName == "Netscape") {
	isNS = true
} else {
	isIE = true
}

var ns4=(d.layers)? true:false
var ns6=(d.getElementById)? true:false
var ie4=(d.all)? true:false
var ie5=false
if (ie4) {
	if (navigator.userAgent.indexOf('MSIE 5')>0) {
		ie4=false
		ie5=true
	}
	if (ns6) ns6=false
}
var dom = document.getElementById ? true:false; //ie5 || ns6
// GET PAGE NAME
var pName = d.location.href
pName = pName.toString()
pName = pName.substring(pName.lastIndexOf("/")+1, pName.lastIndexOf("."))




//***********************
// Page Parameters
//***********************
function getPageParam() {
	temp = d.location.href
	temp = temp.toString()
	myQ = temp.lastIndexOf("?")
	if (myQ == -1) {
		return -1
	} else {
		temp = temp.substring(myQ+1,temp.length)
		return temp
	}
}




//***********************
// PRELOAD IMAGES
//***********************
function MM_preloadImages() { //v3.0
	var d=document
	if(d.images){
	  	if(!d.MM_p)
		d.MM_p=new Array()
	    var i,j=d.MM_p.length,a=MM_preloadImages.arguments
		for(i=0;i<a.length;i++)
	    if (a[i].indexOf("#")!=0){
			d.MM_p[j]=new Image
			d.MM_p[j++].src=a[i]
		}
	}
}



//***********************
// CHANGE IMAGES
//***********************
myImagesArray = new Array()

function showImages(myNo) {
	
	if (loaded != 1) return

	
	if (myNo == 5) {
		show('EntsLayer')
	} else {
		myImage = d.images["i" + myNo].src
		myImage = myImage.substring(0, myImage.lastIndexOf(".")-2)
		for (var i = 1; i < 5; i++) {
			if (i<10) {temp = ("0" + i) } else {temp = i.toString()}
			myImagesArray[i] = d.images["i" + i].src
			temp = myImage + temp + ".jpg"
			d.images["i" + i].src = temp
		}
	}
}

function revertImages() {
	if (loaded != 1) return
	
	for (var i = 1; i < myImagesArray.length; i++) {
		d.images["i" + i].src = myImagesArray[i]
	}
}




//***********************
// RELOAD PAGE
//***********************
function reloadPage() {
	if (isNS) window.top.location.href = window.top.location.href
}




//***********************
// INIT
//***********************

function init_home() {
	loaded = 1
	// PRELOAD
	for (var i = 1; i < 5; i++) {
		myImage = d.images["i" + i].src
		myImage = myImage.substring(0, myImage.lastIndexOf(".")-2)
		for (var j = 1; j < 5; j++) {
			if (i<10) {temp = ("0" + j) } else {temp = j.toString()}
			temp = myImage + temp + ".jpg"
			MM_preloadImages(temp)	
		}
	}
}


//***********************
// FOR MAIN MENU
//***********************

// init
hideMe = true;

disableHide = function(){
	hideMe = false;
}

enableHide = function(){
	hideMe = true;
	Menu.hide();
}


Menu = {timer : null, current : null};
Menu.getStyle = function(name){
	if(document.getElementById) return document.getElementById(name).style;
	else if(document.all) return document.all[name].style;
	else if(document.layers) return document.layers[name];
}
Menu.show = function(name){
	if(this.timer) clearTimeout(this.timer);
	this.getStyle(name).visibility = "visible";
	this.current = name;
}
Menu.hide = function(){
	if(hideMe == true){
		this.timer = setTimeout("Menu.doHide()",300);
	}
}
Menu.doHide = function(){
	if(this.current){
		this.getStyle(this.current).visibility = "hidden";
		this.current = null;
	}
}






        // THE ISSUE DROPDOWN
        
        function gopage(dropdown) {
            var URL = dropdown.options[dropdown.selectedIndex].value;
            if(URL != "") {
                location.href=URL;
            }
        }

