//routine from styleswitcher.js

var but_col_hover = "#F1F083";

	function clickit(destination) {
		//alert('click'+destination);
		//if (id != page_name) {
			window.location = destination;
		//}
	}
	
	function mouseoverbutton(elem) {
		//alert("mo"+elem.id +" page_name= "+page_name);
		var mysty = elem.style;
		mysty.backgroundColor=but_col_hover;
	}
	function mouseoutbutton(elem) {
		var mysty = elem.style;
		mysty.backgroundColor="";
	}

	/* navigation buttons - navbutt */
	function navbutt_hover(elem) {
		//alert("over id="+id+" page_name="+page_name);
		var mysty = elem.style;
		mysty.backgroundColor=but_col_hover;
	}
	function navbutt_out(elem) {
		//alert("over");
		var mysty = elem.style;
		mysty.backgroundColor="";
	}
/* generalised hover etc buttons	*/
function replace_image(caller, image) {
    caller.src = image;
}
function gen_hover(caller, image) {
	caller.src = image;
}
function gen_down(caller, image) {
	caller.src = image;
}
function gen_out(caller, image) {
	caller.src = image;
}

function close_window() {
	//alert("window name = "+window.name);
	window.close();
}

/* open a new window to display the contents */
function open_contents(filename) {
	//alert ("open_contents");
	window.open(filename, "contents","width=500,height=500,scrollbars=yes,dependent=yes,resizable=yes,alwaysRaised=true");
}

function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return myWidth;
}

/* get the value of a cookie of the given name
@parm the name of the cookie
returns the value of the cookie or an empty string
*/
function get_cookie(name) {
  if(document.cookie == "") {
    return "";
  } else {
    cookieArray=document.cookie.split("; ");
        for (i=0; i < cookieArray.length; i++) {
    	    var parts = cookieArray[i].split("=");
    	    if (parts[0] == name) {
               return parts[1];
	    }
    }
  }
  return "";
}
/* set the value for a cookie for next 6 months
@parm cookie name
@parm value
*/
function set_cookie(name, value) {
  var expireDate = new Date;
  expireDate.setMonth(expireDate.getMonth()+6);
  if(document.cookie == "") {
    document.cookie=name+"="+value;
  } else {
    deleteCookie(name);
    document.cookie = name+'='+value+';expires='+expireDate.toGMTString();
  }
}
/* remove the named cookie */
function deleteCookie(name) {
  var expireDate = new Date;
  expireDate.setDate(expireDate.getDate()-1);
  if(document.cookie == "") {
    return;
  } else {
    cookieArray=document.cookie.split("; ");
    for (i=0; i < cookieArray.length; i++) {
    	var parts = cookieArray[i].split("=");
    	if (parts[0] != name) {
          document.cookie = name+'=;expires='+expireDate.toGMTString();
	}
    }
  }
}
