// Menus

function mnuschoolshow()
{ document.getElementById("mnuschool").style.visibility="visible"; }
function mnuschoolhide()
{ document.getElementById("mnuschool").style.visibility="hidden"; }

function mnunurseryshow()
{ document.getElementById("mnunursery").style.visibility="visible"; }
function mnunurseryhide()
{ document.getElementById("mnunursery").style.visibility="hidden"; }

function mnuparentsshow()
{ document.getElementById("mnuparents").style.visibility="visible"; }
function mnuparentshide()
{ document.getElementById("mnuparents").style.visibility="hidden"; }

function mnukidzshow()
{ document.getElementById("mnukidz").style.visibility="visible"; }
function mnukidzhide()
{ document.getElementById("mnukidz").style.visibility="hidden"; }

function mnustaffshow()
{ document.getElementById("mnustaff").style.visibility="visible"; }
function mnustaffhide()
{ document.getElementById("mnustaff").style.visibility="hidden"; }

function mnusearchshow()
{ document.getElementById("mnusearch").style.visibility="visible"; }
function mnusearchhide()
{ document.getElementById("mnusearch").style.visibility="hidden"; }





// Diary Dates Popups
function launchcategory(url){
	window.name = 'opener'; 
	remote = open(url, "", "resizable,status,scrollbars,width=500,height=400,left=300,top=100");
} 
function launchevent(url){
	self.name = "opener"; 
	remote = open(url, "", "resizable,scrollbars,width=500,height=400,left=300,top=100");
} 
function launchlog(url){
	window.name = 'opener'; 
	remote = open(url, "", "resizable,status,scrollbars,width=500,height=400,left=300,top=100");
} 
function launchlogin(url){
	window.name = 'opener'; 
	remote = open(url, "", "resizable,status,scrollbars,width=500,height=400,left=300,top=100");
} 
function launchuser(url){
	window.name = 'opener'; 
	remote = open(url, "", "resizable,status,scrollbars,width=500,height=400,left=300,top=100");
}





// Button HTML Links
function FP_goToURL(url) {//v1.0
 window.location=url;
}





// Small Window Popup
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}





// Image Rollover
if (document.getElementsByTagName && document.getElementById) {
if (window.addEventListener) window.addEventListener('load', setImageSwaps, false);
else if (window.attachEvent) window.attachEvent('onload', setImageSwaps);
}
function setImageSwaps() {
prepareImageSwap('example2',true,true,true,true);
prepareImageSwap('example3',true,false,true,false);
prepareImageSwap(document.body);
}
function prepareImageSwap(elem,mouseOver,mouseOutRestore,mouseDown,mouseUpRestore,mouseOut,mouseUp) {
//Do not delete these comments.
//Non-Obtrusive Image Swap Script by Hesido.com
//V1.1
//Attribution required on all accounts
	if (typeof(elem) == 'string') elem = document.getElementById(elem);
	if (elem == null) return;
	var regg = /(.*)(_nm\.)([^\.]{3,4})$/
	var prel = new Array(), img, imgList, imgsrc, mtchd;
	imgList = elem.getElementsByTagName('img');

	for (var i=0; img = imgList[i]; i++) {
		if (!img.rolloverSet && img.src.match(regg)) {
			mtchd = img.src.match(regg);
			img.hoverSRC = mtchd[1]+'_hv.'+ mtchd[3];
			img.outSRC = img.src;
			if (typeof(mouseOver) != 'undefined') {
				img.hoverSRC = (mouseOver) ? mtchd[1]+'_hv.'+ mtchd[3] : false;
				img.outSRC = (mouseOut) ? mtchd[1]+'_ou.'+ mtchd[3] : (mouseOver && mouseOutRestore) ? img.src : false;
				img.mdownSRC = (mouseDown) ? mtchd[1]+'_md.' + mtchd[3] : false;
				img.mupSRC = (mouseUp) ? mtchd[1]+'_mu.' + mtchd[3] : (mouseOver && mouseDown && mouseUpRestore) ? img.hoverSRC : (mouseDown && mouseUpRestore) ? img.src : false;
				}
			if (img.hoverSRC) {preLoadImg(img.hoverSRC); img.onmouseover = imgHoverSwap;}
			if (img.outSRC) {preLoadImg(img.outSRC); img.onmouseout = imgOutSwap;}
			if (img.mdownSRC) {preLoadImg(img.mdownSRC); img.onmousedown = imgMouseDownSwap;}
			if (img.mupSRC) {preLoadImg(img.mupSRC); img.onmouseup = imgMouseUpSwap;}
			img.rolloverSet = true;
		}
	}
	function preLoadImg(imgSrc) {
		prel[prel.length] = new Image(); prel[prel.length-1].src = imgSrc;
	}
}
function imgHoverSwap() {this.src = this.hoverSRC;}
function imgOutSwap() {this.src = this.outSRC;}
function imgMouseDownSwap() {this.src = this.mdownSRC;}
function imgMouseUpSwap() {this.src = this.mupSRC;}





// Lightboxes
function tour(pic) {
	var p = document.getElementById('page');
	var newElement = document.createElement('div');
	newElement.setAttribute('id', 'lightbox');
	newElement.innerHTML = '<div id="overlay"></div>' +
	                       '<div id="lightcont" style="width:500px; height:400px; margin:-200px 0 0 -250px;">' + 
						   '<img src="/images/parents/tour/lrg/' + pic + '.jpg" alt="" width="500" height="375" />' + 
						   '<div id="close" style="top:375px;"><a href="#" onclick="javascript:remove(); return false;">' + 
						   '<img src="/images/popup/close.png" alt="Close" width="21" height="21"</a></div></div>';
	p.appendChild(newElement);
	
	if (document.all && !window.opera && !window.XMLHttpRequest) {
		var width = document.body.clientWidth + 20;
		var height = document.body.clientHeight + 20;
		var fromtop = document.documentElement.scrollTop + (document.documentElement.clientHeight / 2);
		document.getElementById("overlay").style.width  = width + 'px';
		document.getElementById("overlay").style.height = height + 'px';
		document.getElementById("lightcont").style.top = fromtop + 'px';
	}
}

function gallery(ID, subID, no) {
	var p = document.getElementById('page');
	var newElement = document.createElement('div');
	newElement.setAttribute('id', 'lightbox');
	newElement.innerHTML = '<div id="overlay"></div>' +
	                       '<div id="lightcont" style="width:500px; height:400px; margin:-200px 0 0 -250px;">' + 
						   '<img src="/images/gallery/' + ID + '/' + subID + '/lrg/' + no + '.jpg" alt="" width="500" height="375" />' + 
						   '<div id="close" style="top:375px;"><a href="#" onclick="javascript:remove(); return false;">' + 
						   '<img src="/images/popup/close.png" alt="Close" width="21" height="21"</a></div></div>';
	p.appendChild(newElement);
	
	if (document.all && !window.opera && !window.XMLHttpRequest) {
		var width = document.body.clientWidth + 20;
		var height = document.body.clientHeight + 20;
		var fromtop = document.documentElement.scrollTop + (document.documentElement.clientHeight / 2);
		document.getElementById("overlay").style.width  = width + 'px';
		document.getElementById("overlay").style.height = height + 'px';
		document.getElementById("lightcont").style.top = fromtop + 'px';
	}
}

function games(game) {
	var p = document.getElementById('page');
	var newElement = document.createElement('div');
	newElement.setAttribute('id', 'lightbox');
	newElement.innerHTML = '<div id="overlay"></div>' +
						   '<div id="lightcont" style="width:600px; height:425px; margin:-212px 0 0 -300px;">' +
						   '<object type="application/x-shockwave-flash" data="http://www.novelgames.com/flashgames/game.swf?id=' + game + '&siteid=3805" ' +
						   'width="600" height="400">' +
						   '<param name="movie" value="http://www.novelgames.com/flashgames/game.swf?id=' + game + '&siteid=3805" /></object>' +
						   '<div id="close" style="top:400px"><a href="#" onclick="javascript:remove(); return false;">' + 
						   '<img src="/images/popup/close.png" alt="Close" width="21" height="21"</a></div></div>';
	p.appendChild(newElement);
	
	if (document.all && !window.opera && !window.XMLHttpRequest) {
		var width = document.body.clientWidth + 20;
		var height = document.body.clientHeight + 20;
		var fromtop = document.documentElement.scrollTop + (document.documentElement.clientHeight / 2);
		document.getElementById("overlay").style.width  = width + 'px';
		document.getElementById("overlay").style.height = height + 'px';
		document.getElementById("lightcont").style.top = fromtop + 'px';
	}
}

function locs(x, y) {
	var p = document.getElementById('page');
	var newElement = document.createElement('div');
	newElement.setAttribute('id', 'lightbox');
	newElement.innerHTML = '<div id="overlay"></div>' +
	                       '<div id="lightcont" style="width:720px; height:500px; margin:-250px 0 0 -360px;">' + 
						   '<img src="/images/staff/locations/map.gif" alt="" width="720" height="475" />' + 
						   '<div style="left:' + x + 'px; top:' + y + 'px" id="dot">' + 
						   '<img src="/images/staff/locations/dot.gif" alt="*" width="10" height="10" /></div>' +
						   '<div id="close" style="top:475px;"><a href="#" onclick="javascript:remove(); return false;">' + 
						   '<img src="/images/popup/close.png" alt="Close" width="21" height="21"</a></div></div>';
	p.appendChild(newElement);
	
	if (document.all && !window.opera && !window.XMLHttpRequest) {
		var width = document.body.clientWidth + 20;
		var height = document.body.clientHeight + 20;
		var fromtop = document.documentElement.scrollTop + (document.documentElement.clientHeight / 2);
		document.getElementById("overlay").style.width  = width + 'px';
		document.getElementById("overlay").style.height = height + 'px';
		document.getElementById("lightcont").style.top = fromtop + 'px';
	}
}
 
function remove() {
	var element = document.getElementById('lightbox');
	element.parentNode.removeChild(element);
	window.scrollBy(0,1);
	window.scrollBy(0,-1);
}