/* prevent backspace from going back */
if (typeof window.event != 'undefined')
{
	document.onkeydown = function()
	{
		var tag = event.srcElement.tagName.toUpperCase();
		if (tag != 'INPUT' && tag != 'TEXTAREA')
			return (event.keyCode != 8);
	}
}else{
	document.onkeypress = function(e)
	{
		var tag = e.target.nodeName.toUpperCase();
		if (tag != 'INPUT' && tag != 'TEXTAREA')
			return (e.keyCode != 8);
	}
}

function capmax(ctrl, len)
{
	s = document.getElementById(ctrl).value;
	if(s.length > len)
	{
		document.getElementById(ctrl).value = s.substring(0, len);
		alert("You've exceeded the allowable length of " + len + " for " + document.getElementById(ctrl).ASName + ".")
	}
}

function mkp()
{
	if(p != 0)
		document.getElementById('b' + p).className = 'b0';
	
     p = (p == 7) ? 1 : p + 1;
	
	document.getElementById('b' + p).className = 'b1';
}

function showTip(x, y, text)
{
	_tip = document.getElementById('tip');
	_frame = document.getElementById('tipFrame');
	_tipText = document.getElementById('tipText');

	if(x + 300 > document.body.clientWidth)
		x = x - 300;

	_tipText.innerHTML = text;
	_tip.style.left = x + 10 + "px";
	_tip.style.top = y + 10 + "px";
	_tip.style.display = "block";

	_frame.style.width = _tip.offsetWidth + "px";
	_frame.style.height = _tip.offsetHeight + "px";
	_frame.style.top = _tip.style.top;
	_frame.style.left = _tip.style.left;
	_frame.style.display = "block";
}

function getMouseX(evt) {
 if (evt.pageX) return evt.pageX;
 else if (evt.clientX)
    return evt.clientX + (document.documentElement.scrollLeft ?
    document.documentElement.scrollLeft :
    document.body.scrollLeft);
 else return 0;
}

function getMouseY(evt) {
 if (evt.pageY) return evt.pageY;
 else if (evt.clientY)
    return evt.clientY + (document.documentElement.scrollTop ?
    document.documentElement.scrollTop :
    document.body.scrollTop);
 else return 0;
}

function hideTip()
{
	document.getElementById('tip').style.display="none";
	document.getElementById('tipFrame').style.display="none";
}

function previewFForm(url, win)
{
	//var preview = win.open(url, "FedbackForm", "status=no;resizable=yes,width=600,height=600,top=100,left=100,scrollbars=yes");
	var preview = win.open(url, "FeedbackForm", "width=700,height=600,scrollbars=yes,top=100,left=100,");
	preview.focus();
}

function showPopup(url, win)
{
	var popup = win.open(url, "Popup", "width=700,height=600,scrollbars=no,top=100,left=100,");
	popup.focus();
}

function showPopupScroll(url, win)
{
	var popup = win.open(url, "PopupScroll", "width=550,height=550,scrollbars=yes,top=100,left=100,");
	popup.focus();
}

function showMedPopup(url, win)
{
	var popup = win.open(url, "Popup", "width=600,height=650,scrollbars=yes,top=100,left=100,");
	popup.focus();
}

function showSmallPopup(url, win)
{
	var popupSml = win.open(url, "SmallPopup", "width=450,height=300,scrollbars=no,top=100,left=100,");
	popupSml.focus();
}

function verifyAccountForm(url, win)
{
	var verify = win.open(url, "VerifyAccuShowId", "status=no;resizable=no,width=500,height=300,top=100,left=100,scrollbars=no");
	verify.focus();
}

function onCreateAnyway(c)
{
	if(confirm("Create the Showing anyway?"))
	{
		procSubmit(false);
		c.value = 'Wait...';
		c.disabled = true;
		return true;
	}
	
	return false;
}
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,titlebar=no,width=500,height=300,left = 362,top = 234');");
}	


