var disappeardelay=500  //menu disappear speed onMouseout (in miliseconds)
var enableanchorlink=0 //Enable or disable the anchor link when clicked on? (1=e, 0=d)
var hidemenu_onclick=1 //hide menu when user clicks within menu? (1=yes, 0=no)
var dropmenuobj;

/////No further editting needed

var ie5=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function showhide(obj, e, visible, hidden){
if (ie5||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover" || e.type=="focus")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
if (e.type=="blur" && obj.visibility==visible)
obj.visibility=visible
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie5 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function dropdownmenu(obj, e, dropmenuID){
	
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
if (typeof dropmenuobj!="undefined") //hide previous menu
dropmenuobj.style.visibility="hidden"
clearhidemenu()
if (ie5||ns6){
obj.onmouseout=delayhidemenu
obj.onblur=delayhidemenu
dropmenuobj=document.getElementById(dropmenuID)
if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'}
dropmenuobj.onmouseover=clearhidemenu
dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
dropmenuobj.onfocus=clearhidemenu
dropmenuobj.onblur=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
showhide(dropmenuobj.style, e, "visible", "hidden")
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()

}

function clickreturnvalue(){
if ((ie5||ns6) && !enableanchorlink) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie5&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function delayhidemenu() {
	if(dropmenuobj) {
		delayhide=setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay);
	} else {
		
	}
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

// Sorts out margin in right column

var alreadyrunflag=0 //flag to indicate whether target function has already been run

if (document.addEventListener)
  document.addEventListener("DOMContentLoaded", function(){alreadyrunflag=1; accessLink();galleryLinks()}, false)
else if (document.all && !window.opera){
  document.write('<script id="contentloadtag" defer="defer" src="javascript:void(0)"><\/script>')
  var contentloadtag=document.getElementById("contentloadtag")
  contentloadtag.onreadystatechange=function(){
    if (this.readyState=="complete"){
      alreadyrunflag=1
      accessLink();galleryLinks();
    }
  }
}

window.onload=function(){
  setTimeout("if (!alreadyrunflag) accessLink();galleryLinks();", 0)
}

$(document).ready(function() {
    $("#first").css({ margin: "0 0 17px 10px" });
    $("#left h1:first").css({ marginTop: "-8px" });
    $("#right img:last").css({ marginBottom: "0" });
    $("#left h2").not("#botBox h2").css({ margin: "17px 0" });
});	


function openPictureWindow_Fever(imageType,imageName,imageWidth,imageHeight,alt,posLeft,posTop,num) {  // v4.01
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=no,left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><head>');
	newWindow.document.write('<link rel=\"stylesheet\" type=\"text/css\" href=\"styles/global.css\" />');
	newWindow.document.write('<title>'+alt+'</title>');
	newWindow.document.write('</head>');
	newWindow.document.write('<body>');
	if (imageType == "swf"){
	newWindow.document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('<param name=movie value=\"'+imageName+'\"><param name=quality value=high>');
	newWindow.document.write('<embed src=\"'+imageName+'\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('</embed></object>');	}
	else {
	newWindow.document.write('<div id=\"popupBox\">');
	newWindow.document.write('<div id=\"popup'+num+'\">');
	newWindow.document.write('<div class=\"close\" onclick=\"self.close()\"><img src=\"img/x.gif\" alt=\"close\" title=\"close\" />close window</div>');
	newWindow.document.write('<img src=\"'+imageName+'\"  title=\"'+alt+'\" alt=\"'+alt+'\" />');
	newWindow.document.write('<div class=\"caption\">'+alt+'</div>');
	newWindow.document.write('</div>');
	}
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function accessLink() {
var topnav = document.getElementById('topnav');
var links = topnav.getElementsByTagName('a');
	if(topnav) {
		links[1].setAttribute('href', "javascript:void(0);");
		links[7].setAttribute('href', "javascript:void(0);");
	}
}

function galleryLinks() {
	var gallery = document.getElementById('gallery');
	if(gallery) {
		var galLinks = gallery.getElementsByTagName('a');
		for(var i = 0;i<galLinks.length;i++) {
			galLinks[i].setAttribute('href', "javascript:void(0);");
		}
	}
}

