<!--
//Pop-it menu- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

////No need to edit beyond here
var opera = navigator.userAgent.indexOf('Opera')>=0 ? true : false;
var ie4 = document.all;
var ns6 = document.getElementById&&!document.all;
var ns4 = document.layers&&!document.getElementById;

var on = '#9DD5D4', off = '#548EB7', grey='#808080'; 
var theWindow, theFrames, theDocument, menuWindow, menuobj;

function getFrames(){
  	// get the correct window/document in which to display menu
	theWindow = window.parent;
	//if (theWindow.parent) theWindow = theWindow.parent;
	theFrames = (theWindow == window) ? false : true ;
	theDocument = theFrames ? theWindow.frames['mainframe'].document : window.document;
	menuWindow = theFrames ? theWindow.frames['mainframe'].window : window;
}

function showmenu(e, menuno, cols){
  	//if (opera) return;
  	getFrames();  
  	// get the menu content
  	var divobj= ie4? eval('document.all.menu'+menuno) : ns6? document.getElementById("menu"+menuno) : ns4? eval('document.menu'+menuno) : "";
  	var which = divobj.innerHTML;
 
  	var posleft = new Array(0, 70, 160, 250, 350, 460, 560, 620);
  	var widths = new Array(70, 90, 120, 120, 120, 120, 120, 120);  
  
	if (!theDocument.all&&!theDocument.getElementById&&!theDocument.layers)
	return;

	clearhidemenu();
	
	// find the menu object
	menuobj=ie4? theDocument.all.popmenu : ns6 ? theDocument.getElementById("popmenu") : ns4? theDocument.popmenu : "";
	//alert(menuobj.id+' '+theDocument.title);
	menuobj.thestyle=(ie4||ns6)? menuobj.style : menuobj;
	if (menuobj == null) return;
	if (ie4||ns6)		
		menuobj.innerHTML=which;
	else{
		menuobj.write('<layer name=gui bgColor='+off+' onmouseover="clearhidemenu()" onmouseout="hidemenu()">'+which+'</layer>');
		menuobj.close();
	}

	menuobj.contentwidth=(ie4||ns6)? menuobj.offsetWidth : menuobj.document.gui.document.width;
	menuobj.contentheight=(ie4||ns6)? menuobj.offsetHeight : menuobj.document.gui.document.height;

	if (theFrames) {
	 	menuobj.thestyle.top = ie4 ? menuWindow.document.body.scrollTop + 10 : ns6 ? menuWindow.pageYOffset + 10 + 'px' :  10 ;
	}
	else {
		menuobj.thestyle.top =  140;// e.pageY+10;
	}
	
	menuobj.thestyle.left = ie4 ? (document.body.clientWidth - 780)/2 + posleft[menuno-1] + 10 : (window.innerWidth - 780)/2 +posleft[menuno-1] - 10;
	menuobj.thestyle.width = ns6 ? widths[menuno-1] + 'px' : widths[menuno-1];
	menuobj.contentwidth = ns6 ? widths[menuno-1] + 'px' : widths[menuno-1];
	menuobj.thestyle.visibility="visible";
	return false
}

function contains_ns6(a, b) {
	//Determines if 1 element in contained in another- by Brainjar.com
	while (b && b.parentNode)
		if ((b = b.parentNode) == a)	return true;
	return false;
}

function hidemenu(){
	menuobj=ie4? theDocument.all.popmenu : ns6? theDocument.getElementById("popmenu") : ns4? theDocument.popmenu : "";
	if (menuobj == null) return;
	menuobj.thestyle=(ie4||ns6)? menuobj.style : menuobj;
	if (menuobj)
		menuobj.thestyle.visibility=(ie4||ns6)? "hidden" : "hide";
}

function dynamichide(e){
	//return;
	menuobj=ie4? theDocument.all.popmenu : ns6? theDocument.getElementById("popmenu") : ns4? theDocument.popmenu : "";
	menuobj.thestyle=(ie4||ns6)? menuobj.style : menuobj;
	if (ie4&&!menuobj.contains(e.toElement))
		 hidemenu();
	else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
	  	hidemenu();
}

function delayhidemenu(){
	if (ie4||ns6||ns4||opera)
		delayhide=setTimeout("hidemenu()",200);
}

function clearhidemenu(){
	if (theWindow.delayhide)
		clearTimeout(delayhide);
}

function highlightmenu(e,state){
	if (ie4){
		source_el=e.srcElement;
		source_el.style.background=eval(state);
 	}
	else if (ns6) {
		source_el=e.target;
		source_el.background=eval(state);
	}
	if (source_el.className=="menuitems" || source_el.className=="menubar"){
		source_el.style.background=eval(state);
		//source_el.id=(state=="on")? "mouseoverstyle" : "mouseoutstyle";
	}
	else{
		while(source_el.id != "popmenu"){
			source_el=theDocument.getElementById? source_el.parentNode : source_el.parentElement
			if (source_el.className=="menuitems" || source_el.className=="menubar"){
				source_el.style.background=eval(state);
				//source_el.id=(state=="on")? "mouseoverstyle" : "mouseoutstyle";
			}
		}
	}
	if (state == 'off') clearhidemenu();
}


getFrames();
if (ie4||ns6||opera)
theDocument.onclick=hidemenu;
//menuobj=ie4? theDocument.all.popmenu : ns6 ? theDocument.getElementById("popmenu") : ns4? theDocument.popmenu : "";
	
function start(page) {
if(navigator.appVersion < "3.0") return; 	
	if (self != parent.frames[1]) 
	{
		window.location = page;
	 }
	
}

function switchweek(z, on, off){
	var i,j,val; // checks or unchecks a whole week
    	var btype = (navigator.appName == 'Netscape')? 'NS':'IE';
	if (btype == 'IE') {
	  if (document.all['Cweek'+z].checked==true) {
		document.all['Bweek'+z].style.background= on;
		for (i=0; i<7; i++) {
			j = z*7 + i;
			if (document.all['Cday'+j]) document.all['Cday'+j].checked = true;
			if (document.all['Bday'+j]) document.all['Bday'+j].style.background= on;

		}
	  }
	  else {
		document.all['Bweek'+z].style.background= off;
		for (i=0; i<7; i++) {
			j = z*7 + i;
			if (document.all['Cday'+j]) document.all['Cday'+j].checked = false;
			if (document.all['Bday'+j]) document.all['Bday'+j].style.background= off;
		}

	  } 
        }
	else {
	  if (document.forms['update'].elements['Cweek'+z].checked == true){
		val = document.getElementById('Bweek'+z);
         	val.style.background=on;
		for (i=0; i<7; i++) {
			j = z*7 + i;
			if (document.forms['update'].elements['Cday'+j]) document.forms['update'].elements['Cday'+j].checked = true;
			val=document.getElementById('Bday'+j);
			if (val) val.style.background=on;
		}

	  }
	  else {
		val = document.getElementById('Bweek'+z);
         	val.style.background=off;
		for (i=0; i<7; i++) {
			j = z*7 + i;
			if (document.forms['update'].elements['Cday'+j]) document.forms['update'].elements['Cday'+j].checked = false;
			val=document.getElementById('Bday'+j);
			if (val) val.style.background=off;
		}
	  } 
	}

}

function scswitch(d, on, off) {
	var w, val, c, i; // the week
    	var btype = (navigator.appName == 'Netscape')? 'NS':'IE';
	if (btype == 'IE') {
	  if (document.all['Cday'+d].checked==true) {
		document.all['Bday'+d].style.background=on;   // on
		w = (d - (d%7));
		c = 1;
		for (i=w; i < w+7; i++) {
			if (document.all['Cday'+i] && document.all['Cday'+i].checked==false) c = 0;
		}
		w = w / 7;
		if (c == 1) {
			document.all['Cweek'+w].checked = true;
			document.all['Bweek'+w].style.background=on;
		}		
	  }
	  else {
		w = (d - (d%7)) / 7;
		document.all['Bday'+d].style.background=off;	// off
		document.all['Bweek'+w].style.background=off;
		document.all['Cweek'+w].checked = false;
	  }
	}
	else {
	  if (document.forms['update'].elements['Cday'+d].checked==true) {
		val=document.getElementById('Bday'+d);
		val.style.background=on;
		w = (d - (d%7));
		c = 1;
		for (i=w; i < w+7; i++) {
			if (document.forms['update'].elements['Cday'+i] && document.forms['update'].elements['Cday'+i].checked==false) c=0;
		}
		w = w / 7;
		if (c == 1) {
			document.forms['update'].elements['Cweek'+w].checked = true;
			val=document.getElementById('Bweek'+w);
			val.style.background=on;
		}

	  }
	  else {
		w = (d - (d%7)) / 7;
		val=document.getElementById('Bday'+d);
		val.style.background=off;
		document.forms['update'].elements['Cweek'+w].checked=false;
		val=document.getElementById('Bweek'+w);
		val.style.background=off;
	  }
	}		
}

function bbswitch(d, r, on, off) {
	var j=d, val, check, box; // the week
	var offset = 5; // number of elements at start of 'update' form - before calendar itself
    	var btype = (navigator.appName == 'Netscape')? 'NS':'IE';
	if (btype == 'IE') {
	  if (document.all['Cday'+d+'room'+r].checked==true) {
		document.all['Bday'+d+'room'+r].style.background=on;   // on
	  }
	  else {
		document.all['Bday'+d+'room'+r].style.background=off;	// off
	  }
	}
	else {
	  if (document.forms['update'].elements['Cday'+d+'room'+r].checked==true) {
		val=document.getElementById('Bday'+d+'room'+r);
		val.style.background=on;
	  }
	  else {
		val=document.getElementById('Bday'+d+'room'+r);
		val.style.background=off;
	  }
	}		
}

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];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_nbGroup(event, grpName) { //v3.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : args[i+1];
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    if ((nbArr = document[grpName]) != null)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = args[i+1];
      nbArr[nbArr.length] = img;
  } }
}


function popup(myUrl) {
   var topBars= 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no,dependent=yes';
   var myOptions = 'scrollbars=yes,width=750,height=500,resizeable=yes,top=0,left=0';
   var myFeatures = topBars+','+myOptions;
   var newWin = open(myUrl,'',myFeatures);
   //newWin.document.close();
   newWin.focus();
}

function swapImg() { //
  var i,j=0,objStr,obj,swapArray=new Array,oldArray=document.swapImgData;
  for (i=0; i < (swapImg.arguments.length-2); i+=3) {
    objStr = swapImg.arguments[(navigator.appName == 'Netscape')?i:i+1];
    if ((objStr.indexOf('document.layers[')==0 && document.layers==null) ||
        (objStr.indexOf('document.all[')   ==0 && document.all   ==null))
      objStr = 'document'+objStr.substring(objStr.lastIndexOf('.'),objStr.length);
    obj = eval(objStr);
    if (obj != null) {
      swapArray[j++] = obj;
      swapArray[j++] = (oldArray==null || oldArray[j-1]!=obj)?obj.src:oldArray[j];
      obj.src = swapImg.arguments[i+2];
  } }
  document.swapImgData = swapArray; //used for restore
}

function restoreImg() { //v1.2
  if (document.swapImgData != null)
    for (var i=0; i<(document.swapImgData.length-1); i+=2)
      document.swapImgData[i].src = document.swapImgData[i+1];
}

function locationmap() {
	window.open('location.htm','location','directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no,scrollbars=no,width=300,height=500');
}

function slideshow(n) {
	var b, f, v;
	b = ie4 ? document.all.slideshow : document.getElementById('slideshow');
	//f = ie4 ? document.all.farming : document.getElementById('farming');
	//v = ie4 ? document.all.views : document.getElementById('views');
	var p;
	if (document.position) p = document.position;
	else p = 0;
	p++;
	if (p > n) p = 0;
	b.src = 'slideshow/slide_'+p+'.jpg';
	//f.src = 'slideshow/farming/img_'+p+'.jpg';
	//v.src = 'slideshow/views/img_'+p+'.jpg';
 	document.position = p;
}


//-->

