function showLegend(w){
	//var coords = getMouseXY(w);
	//alert(parts[1]);
	//var parts = coords.split(",");
	//var dropboxleft=parts[0] //set left position of box (in px)
	//var dropboxtop=parts[1] //set top position of box (in px)
	initboxv2();	
}

/*
function getMouseXY(e){
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY)
	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY)
	{
		posx = e.clientX + document.body.scrollLeft;
		posy = e.clientY + document.body.scrollTop;
	}
	// posx and posy contain the mouse position relative to the document
	// Do something with this information
	return(posx +","+ posy);
}*/

function hideWhite(pos){
document.forms['showhide_empty'].submit()
//setStyleByTag("P","color","red",1)
//document.setStyleByClass('', 'white', 'display', 'none')
}

/***********************************************
* Amazon style Drop-in content box- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
* Go to http://www.dynamicdrive.com/ for full source code
***********************************************/

var dropboxleft=860 //set left position of box (in px)
var dropboxtop=377 //set top position of box (in px)
var dropspeed=30 //set speed of drop animation (larger=faster)

//Specify display mode. 3 possible values are:
//1) "always"- This makes the fade-in box load each time the page is displayed
//2) "oncepersession"- This uses cookies to display the fade-in box only once per browser session
//3) integer (ie: 5)- Finally, you can specify an integer to display the box randomly via a frequency of 1/integer...
// For example, 2 would display the box about (1/2) 50% of the time the page loads.

var displaymode="always"

///Don't edit beyond here///////////

if (parseInt(displaymode)!=NaN)
var random_num=Math.floor(Math.random()*displaymode)
var ie=document.all
var dom=document.getElementById

function initboxv2(){
if (!dom&&!ie)
return
crossboxcover=(dom)?document.getElementById("dropinboxv2cover") : document.all.dropinboxv2cover
crossbox=(dom)?document.getElementById("dropinboxv2"): document.all.dropinboxv2
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
crossbox.height=crossbox.offsetHeight
crossboxcover.style.height=parseInt(crossbox.height)+"px"
crossbox.style.top=crossbox.height*(-1)+"px"
crossboxcover.style.left=dropboxleft+"px"
crossboxcover.style.top=dropboxtop+"px"
crossboxcover.style.visibility=(dom||ie)? "visible" : "show"
dropstart=setInterval("dropinv2()",50)
}

function dropinv2(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossbox.style.top)<0){
crossboxcover.style.top=scroll_top+dropboxtop+"px"
crossbox.style.top=parseInt(crossbox.style.top)+dropspeed+"px"
}
else{
clearInterval(dropstart)
crossbox.style.top=0
}
}

function dismissboxv2(){
if (window.dropstart) clearInterval(dropstart)
crossboxcover.style.visibility="hidden"
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = ""
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset)
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
/*
if (displaymode=="oncepersession" && get_cookie("droppedinv2")=="" || displaymode=="always" || parseInt(displaymode)!=NaN && random_num==0){
	if (window.addEventListener)
		window.addEventListener("load", initboxv2, false)
	else if (window.attachEvent)
		window.attachEvent("onload", initboxv2)
	else if (document.getElementById || document.all)
		window.onload=initboxv2
	if (displaymode=="oncepersession")
		document.cookie="droppedinv2=yes"
}
*/


//


function alertUserChoice(txtstr){
	//asks user for confirmation
	x = false
	x = confirm(txtstr);
	return x;
}

//------------------------------------------------------------------------------
var newwindow = '';
function popup(id)
{
var url = "../cal/detail.asp?id="+id;
	if (!newwindow.closed && newwindow.location)
	{
		newwindow.location.href = url;
	}
	else
	{
		newwindow = window.open(url,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=430, height=490")
		if (!newwindow.opener) newwindow.opener = self;
	}
	if (window.focus) {newwindow.focus()}
	//return false;
}

function showSelection(selection){
	pageoptions = new Array(30,60,90,120,360,720);
	selectedindex = 2;
	for(i=0;i<pageoptions.length;i++){
		selected = selection ;
		if(selected == pageoptions[i]){
			selectedindex = i;
		}
	}
	document.forms["shownextform"].maxDays.selectedIndex = selectedindex;
}
function changeCol(name){
	var x=document.getElementById(name)
	var y=document.getElementById("row")
	alert(y.style.backgroundcolor = x.options[x.selectedIndex].value)
}


function swapColour(newCol, thingToCol, textHold){
/*
usage:  swapColor(1#CCCCCC, divElement1, [formField12]);

1.	splits the colour's id from the HEX value.
2.	colour's the divElement with the HEX value provided.
3.	if formField is passed then form updated to store the colour id.

*/
	itemToColour = document.getElementById(thingToCol);
	itemWithColour = document.getElementById(newCol);
	
	newVal = itemWithColour.options[itemWithColour.selectedIndex].value;
	valArray = newVal.split("#");
	newVal = "#"+valArray[1];
	
	itemToColour.style.backgroundColor = newVal;
	
	if(textHold!="undefined"){
		document.getElementById(textHold).value = valArray[0];
	}
}	
