// JavaScript Document
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

function goToURL(url) { window.location = url;}
////////////// bvpImgMover class definition \\\\\\\\\\\\\\
function bvpImgMover(sLayerId, iTopOffset, iSlideTime, iCeiling, iFloor) {
	this.chaserDiv = null
	this.layerId = sLayerId
	this.topOffset = iTopOffset
	this.slideTime = iSlideTime
	this.ceiling = iCeiling
	this.floor = iFloor
	bvpImgMover.registry[bvpImgMover.registry.length] = this
}
bvpImgMover.isIE = window.clientInformation ? true : false
bvpImgMover.isIEDTD = ((document.doctype && document.doctype.name.indexOf(".dtd")>-1) || document.compatMode == "CSS1Compat") ? true : false;
bvpImgMover.isN4 = document.layers ? true : false
bvpImgMover.isN6 = navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 5
bvpImgMover.isO5 = navigator.userAgent.indexOf("Opera") != -1 && parseInt(navigator.appVersion) >= 4
bvpImgMover.registry = new Array( )
bvpImgMover.callRate = 10
window.setInterval("bvpImgMover.timer( )", bvpImgMover.callRate)
bvpImgMover.timer = function() {
for (var i = 0; chObj = this.registry[i]; i++) {
if (!chObj.chaserDiv) chObj.attemptLoad()
if (chObj.chaserDiv) chObj.main()
}
}
bvpImgMover.prototype.attemptLoad = function() {
var chDiv = null
if (bvpImgMover.isN6 || bvpImgMover.isO5) chDiv = document.getElementById(this.layerId)
else if (bvpImgMover.isIE) chDiv = document.all[this.layerId]
else if (bvpImgMover.isN4) chDiv = document.layers[this.layerId]
if (chDiv && chDiv != null) {
this.chaserDiv = chDiv
}
}
bvpImgMover.prototype.main = function( )
{
this.currentY = this.getCurrentY()
var scrollTop = bvpImgMover.getWindowScroll() 
var newTargetY = scrollTop + this.topOffset
var floor = bvpImgMover.getDocumentHeight() - this.floor
newTargetY = Math.max( newTargetY, this.ceiling)
if (!bvpImgMover.isO5) newTargetY = Math.min(newTargetY, floor)
if ( this.currentY != newTargetY ) {
if ( newTargetY != this.targetY ) {
this.targetY = newTargetY
this.slideInit( )
}
this.slide( )
}
}
bvpImgMover.prototype.slideInit = function( )
{
this.A = (this.targetY - this.currentY) / this.slideTime / this.slideTime
this.startT = (new Date()).getTime()
this.startP = this.getCurrentY()
this.D = this.targetY - this.startP
}

bvpImgMover.prototype.slide = function( )
{
var elapsed = (new Date()).getTime() - this.startT
if (elapsed < this.slideTime) {
this.moveTo(this.D - (Math.round(Math.pow(this.slideTime - elapsed, 2) * this.A)) + this.startP)
}
}
bvpImgMover.prototype.moveTo = function(ny) {
if (bvpImgMover.isN4) this.chaserDiv.top = ny
else this.chaserDiv.style.top = ny + "px"
}
bvpImgMover.prototype.getCurrentY = function() {
var n = bvpImgMover.isN4 ? this.chaserDiv.top : parseInt(this.chaserDiv.style.top)
return isNaN(n) ? 0 : n
}
bvpImgMover.getWindowScroll = function() {
if (bvpImgMover.isIEDTD) 
{
window.status=document.documentElement.scrollTop;
return document.documentElement.scrollTop;
}
else if (bvpImgMover.isIE) return document.body.scrollTop;
else return window.pageYOffset
}
bvpImgMover.getDocumentHeight = function() {
if (bvpImgMover.isO5) return 0 // opera can't retreive this property.
else if (bvpImgMover.isIEDTD) return Math.max(document.documentElement.scrollHeight, document.documentElement.offsetHeight)
else if (bvpImgMover.isIE) return Math.max(document.body.scrollHeight, document.body.offsetHeight)
else return window.document.height
}

function chkHeights() { var l=200
if (elementHeight("injL")>185) { l=100
}
if ((elementHeight("left")-elementHeight("right"))>=(elementHeight("injL")-l)) { document.getElementById("injL").style.display = "none"; document.getElementById("injR").style.display = "";}
else
{ document.getElementById("injR").style.display = "none"; document.getElementById("injL").style.display = "";}
if ((elementHeight("right")-elementHeight("left"))>(elementHeight("injL")*3/8)) { document.getElementById("flipflop").style.display = "";}
}
function chkNavHeight() { var x=document.getElementById("results")
if ((elementHeight("nav")>elementHeight("left")) && (elementHeight("resultBox")>=(elementHeight("left")-elementHeight("logon")-100)) && ((elementHeight("left")-elementHeight("logon")-100)>=110)) { x.style.height = (elementHeight("left")-elementHeight("logon")-100)+"px"; x.style.overflow = "scroll";}
else
{ document.getElementById("results").style.display = "none";}
}
function elementHeight(element) { var height=0
if (document.getElementById(element)) { height=document.getElementById(element).clientHeight;}
return height;}
function getURL(uri) { uri.dir = location.href.substring(0, location.href.lastIndexOf('\/')); uri.dom = uri.dir; if (uri.dom.substr(0,7) == 'http:\/\/') uri.dom = uri.dom.substr(7); uri.path = ''; var pos = uri.dom.indexOf('\/'); if (pos > -1) {uri.path = uri.dom.substr(pos+1); uri.dom = uri.dom.substr(0,pos);}
uri.page = location.href.substring(uri.dir.length+1, location.href.length+1); pos = uri.page.indexOf('?');if (pos > -1) {uri.page = uri.page.substring(0, pos);}
pos = uri.page.indexOf('#');if (pos > -1) {uri.page = uri.page.substring(0, pos);}
uri.ext = ''; pos = uri.page.indexOf('.');if (pos > -1) {uri.ext =uri.page.substring(pos+1); uri.page = uri.page.substr(0,pos);}
uri.file = uri.page; if (uri.ext != '') uri.file += '.' + uri.ext; if (uri.file == '') uri.page = 'index'; uri.args = location.search.substr(1).split("?"); return uri;}
function dhtmlLoadScript(url)
	{
	   var e = document.createElement("script");
	   e.src = url;
	   e.type="text/javascript";
	   document.getElementsByTagName("head")[0].appendChild(e); 
	}
	if (document.URL.match("action=scores")) {
			 
			   dhtmlLoadScript("/includes/calendar/utils.js");
			   dhtmlLoadScript("/includes/calendar/calendar.js");
			   dhtmlLoadScript("/includes/calendar/calendar-setup.js");
			   dhtmlLoadScript("/includes/calendar/calendar-en.js");
			
	}
var uri = new Object(); getURL(uri); 
MM_reloadPage(true);

function chkCountry()
{
	var country = document.getElementById("country");
	var stateBox = document.getElementById("state");
	var stateText = document.getElementById("stateText");
	
	if (country.value=="United States" || country.value=="USA")
	{
		//activate state box if de-active
		if (stateBox.disabled==true)
		{
			stateBox.disabled=false;
		}
		//change stateText to "State"
		if (document.all)
		{
			stateText.innerHTML="State";
		} else {
			stateText.textContent="State";
		}		
	}
	else if (country.value=="Canada")
	{
		//activate state box if de-active
		if (stateBox.disabled==true)
		{
			stateBox.disabled=false;
		}
		//change stateText to "Province"
		if (document.all)
		{
			stateText.innerHTML="Province";
		} else {
			stateText.textContent="Province";
		}	
	}
	else
	{
		//not US or Canada, so de-activate state box
		if (stateBox.disabled==false)
		{
			stateBox.disabled=true;
		}
		//empty stateText
		if (document.all)
		{
			stateText.innerHTML="";
		} else {
			stateText.textContent="";
		}	
	}
}
function clearFields() {
	document.getElementById('email').style.backgroundColor = "white";
	document.getElementById('confirmEmail').style.backgroundColor = "white";
	document.getElementById('namef').style.backgroundColor = "white";
	document.getElementById('namel').style.backgroundColor = "white";
	document.getElementById('adr1').style.backgroundColor = "white";
	document.getElementById('city').style.backgroundColor = "white";
	document.getElementById('state').style.backgroundColor = "white";
	document.getElementById('zip').style.backgroundColor = "white";
	document.getElementById('agecheck').style.backgroundColor = "white";
}
function checkFields() {
clearFields();
missinginfo = "";
if ((document.signupForm.email.value == "") || 
(document.signupForm.email.value.indexOf('@') == -1) || 
(document.signupForm.email.value.indexOf('.') == -1)) {
missinginfo += "\n     -  Email address";
document.getElementById('email').style.backgroundColor = "red";
}
if ((document.signupForm.confirmEmail.value == "") || 
(document.signupForm.confirmEmail.value.indexOf('@') == -1) || 
(document.signupForm.confirmEmail.value.indexOf('.') == -1)) {
missinginfo += "\n     -  Confirm Email address";
document.getElementById('confirmEmail').style.backgroundColor = "red";
}
var a=document.signupForm.email.value;
var b=document.signupForm.confirmEmail.value;
if (a != b) {
missinginfo += "\n     -  Check the spelling of your email address";
document.getElementById('email').style.backgroundColor = "red";
document.getElementById('confirmEmail').style.backgroundColor = "red";
}
if (document.signupForm.namef.value == "") {
missinginfo += "\n     -  First Name";
document.getElementById('namef').style.backgroundColor = "red";
}

if (document.signupForm.namel.value == "") {
missinginfo += "\n     -  Last Name";
document.getElementById('namel').style.backgroundColor = "red";
}

if (document.signupForm.adr1.value == "") {
missinginfo += "\n     -  Street Address";
document.getElementById('adr1').style.backgroundColor = "red";
}

if (document.signupForm.city.value == "") {
missinginfo += "\n     -  City";
document.getElementById('city').style.backgroundColor = "red";
}

if (document.signupForm.state.value == "") {
missinginfo += "\n     -  State";
document.getElementById('state').style.backgroundColor = "red";
}

if (document.signupForm.zip.value == "") {
missinginfo += "\n     -  Zip Code";
document.getElementById('zip').style.backgroundColor = "red";
}

if (document.signupForm.agecheck.checked == false) {
missinginfo += "\n     -  Please verify your age";
document.getElementById('agecheck').style.backgroundColor = "red";
}

if (missinginfo != "") {
missinginfo ="_____________________________\n" +
"You failed to correctly fill in your:\n" +
missinginfo + "\n_____________________________" +
"\nPlease re-enter and submit again!";
alert(missinginfo);
return false;
}
else return true;
}