/*
////////////////////////////////
//  Miscellaneous functions  //
//////////////////////////////
redirect:void													(url:string)
redirectConfirm:void											(url:string, message:string)
getElementCoordinate:Number										(objElement:html object, strMode:string)doMenuHide:Void													(id:number)doMenuTimeout:Void												(starttimeout, mainid)
doPrint:void													(warnlandscape:boolean)
onMenuOut:void													(event:Object)
onMenuOver:void													(event:Object)
openPicker:void													(params:string)

*/


//  Function to redirect the user to the specified page
function redirect (url)  //  Void
{
	window.location = url;
	
}











//  Function to confirm a redirect to the specified page
function redirectConfirm (url, message)  //  Void
{
	if (confirm(message))
	{
		redirect(url);
		
	} else
	{
		return false;
		
	};
	
}











////  Function to get the x coordinate of the specified element
function getElementCoordinate (objElement, strMode)  //  Number
{
	//  Set the initial value of the return
	numValue = 0;
	
	
	//  Check if the offset parent exists
	if (objElement.offsetParent)
	{
		//  Add the initial value to the return variable
		switch (strMode)
		{
			
			case "x":
			numValue += objElement.offsetLeft;
			break;
			
			
			
			case "y":
			numValue += objElement.offsetTop;
			break;
			
		};
		
		
		//  Start the loop
		while (objElement = objElement.offsetParent)
		{
			//  Add the value to the return variable
			switch (strMode)
			{
				
				case "x":
				numValue += objElement.offsetLeft;
				break;
				
				
				
				case "y":
				numValue += objElement.offsetTop;
				break;
				
			};
			
		};
		
	};
	
	
	//  Return the value
	return numValue;
	
}











////  Function to print the window
function doPrint (warnlandscape)  //  Void
{
	//  Check if the warn landscape is specified
	if (warnlandscape)
	{
		///  The window should be printed in landscape
		//  Alert the user to this info
		alert("Please note: This page is best printed in landscape format.");
		
	};
	
	
	//  Call the print method
	window.print();
	
}











//  Function to react to menu out
function onMenuOut (event) {
	$(this).removeClass('menuhover');
	$(this).children('ul').hide();
}











//  Function to react to menu over
function onMenuOver (event) {
	$(this).addClass('menuhover');
	$(this).children('ul')
		.css({
			'left' : 0,
			'top' : ($(this).outerHeight())
		})
		.show();
}











//  Function to open the file picker
function openPicker (params)  //  Void
{
	win_w = screen.width - 150;
	win_h = screen.height - 150;
	win_x = (screen.width / 2) - (win_w / 2);
	win_y = (screen.height / 2) - (win_h / 2);
	
	pickerwindow = window.open("/?mode.file.pick&"+params,"picker","width="+win_w+",height="+win_h+",top="+win_y+",left="+win_x+",menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no");
	
}











//  Sets up main menu
$(document).ready(function () {
	$('div#menu > span.items > span.main').hover(onMenuOver, onMenuOut);
	$('div#menu > span.items > span.main > ul > li').hover(onMenuOver, onMenuOut);
})











////  Variables
var maintimeout = new Array();
