var lastMouseX;
var lastMouseY;
var curPopupWindow = null;
	
function manualSubmit(action) {
	var f = document.forms[0];
	f.action = action
	f.submit();
}

// cross browser compatible
function changeCursor(cursor, evt) {
	evt = (evt) ? evt : event;
  var el = (evt.target) ? evt.target : event.srcElement;

	switch (cursor) {
		case "hand":
			el.style.cursor = "pointer"; // for modzilla, don't change order
			el.style.cursor = "hand"; // for ie
			break
		default:
			el.style.cursor = "";
	}
}

function mouseCursor(cursor) {  var el = event.srcElement;
	switch (cursor) {
		case "hand":
			el.style.cursor = "hand";
			break
		default:
			el.style.cursor = "default";
	}
}

function openPopup(url, name, width, height, features, snapToLastMousePosition) {
  closePopup();
	if (snapToLastMousePosition) {
		if (lastMouseX - width < 0) lastMouseX = width;
		if (lastMouseY + height > screen.height) 	lastMouseY -= (lastMouseY + height + 50) - screen.height;	
    lastMouseX -= width;
    lastMouseY += 10;
		features +=	"screenX=" + lastMouseX + ",left=" + lastMouseX + "screenY=" + lastMouseY + ",top=" + lastMouseY;
	}
	curPopupWindow = window.open(url, name, features, false);
}

function setLastMousePosition(evt) {
	evt = (evt) ? evt : event;
	lastMouseX = evt.screenX;
	lastMouseY = evt.screenY;
}

function closePopup() {
	if (curPopupWindow != null) {
		if (!curPopupWindow.closed)	curPopupWindow.close();
		curPopupWindow = null;
	}
}

function popUp_Scroll(url, name, width, height) {
	openPopup(url, name, width, height, "width=" + width + ",height=" + height + ",dependent=no,resizable=yes,toolbar=no,status=yes,directories=no,menubar=no,scrollbars=1", false);
}

function popUp(url, name, width, height) {
	openPopup(url, name, width, height, "width=" + width + ",height=" + height + ",dependent=no,resizable=yes,toolbar=no,status=no,directories=no,menubar=no,scrollbars=0", false);
}

function popUp_Snap(url, name, width, height) {
	openPopup(url, name, width, height, "width=" + width + ",height=" + height + ",dependent=no,resizable=yes,toolbar=no,status=no,directories=no,menubar=no,scrollbars=0", true);
}

// -- CUSTOM FUNCTIONS ----------------------------------------------------------------------------

//image rotator scripts
function ImageRotator()
{
	var low		= 0;
	var high	= 8;
	var curr	= 0;
		GetRandomNumber();
		RoundIt();
		
		curr = RoundIt();
		
			if(curr < low)
				{ curr = low }
			if(curr > high)
				{ curr = high }
				
	var dir		= "images/";
	var images	= new Array(9);
	
	images[0]	= "header1.jpg";
	images[1]	= "header2.jpg";
	images[2]	= "header3.jpg";
	images[3]	= "header1.jpg";
	images[4]	= "header2.jpg";
	images[5]	= "header3.jpg";
	images[6]	= "header1.jpg";
	images[7]	= "header2.jpg";
	images[8]	= "header3.jpg";



	//alert(images[curr]);
	
	document.write("\<img src=\"" + dir + images[curr] + "\" width=191 height=62>");
}

function GetRandomNumber()
{
return Math.random()*10
}

function RoundIt()
{
return Math.round(GetRandomNumber())
}

//end image rotator scripts

