//********************** Rollover effect **************************

function buttonOn(varThis) {
	varThis.className = 'subnavButton_on';
	//alert('var = ' + varThis.className);
}
function buttonOff(varThis) {
	varThis.className = 'subnavButton';
	//alert('var = ' + varThis.className);
}

//********************** Disable Select **************************

function disableselect(e)
{
	return false
}

function reEnable()
{
	return true
}

document.onselectstart=new
Function ("return false")

if(window.sidebar)
{
	document.onmousedown=disableselect
	document.onclick=reEnable
}
function right(e)
{
    if (document.layers && e.which == 3)
    {
        alert("Jon Penny's Black Belt Academy ©");
        return false;
    }
    else if (document.all && event.button == 2)
    {
        alert("Jon Penny's Black Belt Academy ©");
        return false;
    }
    return true;
}

document.onmousedown=right;

if (document.layers)
{
    window.captureEvents(Event.MOUSEDOWN);
}

//********************** input Form Post vars **************************

// Trivial CGI variable display code Copyright 2004 AWeber Systems, Inc.
var query_string = (location.search) ? ((location.search.indexOf('#') != -1) 
   ? location.search.substring(1, location.search.indexOf('#')) : location.search.substring(1)) : '';
var elements = new Array;

// Load CGI variables into elements[] associative array
if(query_string) {
   var pairs = query_string.split("&");
   for(i in pairs) {
      var tmp = pairs[i].split("=");
      elements[unescape(tmp[0])] = unescape(tmp[1]);
   }
}

// Print one element value indexed by key argument
function printElement(key) {
   if(elements[key]) {
      document.write(elements[key]);
   } else {
      document.write("Undefined");
   }
}

//********************** Intro Class Form Required **************************

function fncChkReqd()
{
	if(IntroSignUp.First_Name.value == "")
	 {
	    alert("Please enter your First Name.")
	    IntroSignUp.First_Name.select()
	    IntroSignUp.First_Name.focus()
	    return
	 }
	if(IntroSignUp.Last_Name.value == "")
	 {
	 	alert("Please enter your Last Name ")
	 	IntroSignUp.Last_Name.select()
	 	IntroSignUp.Last_Name.focus()
	 	return
	 }	
	if(IntroSignUp.email.value == "")
	 {
		alert("You must enter an Email Address.")
		IntroSignUp.email.select()
		IntroSignUp.email.focus()
		return
	 }
	at=IntroSignUp.email.value.indexOf("@")
	if (at == -1)
		{
		alert("Not a valid e-mail")
		IntroSignUp.email.select()
		IntroSignUp.email.focus()
		return
		}
	if(IntroSignUp.Home_Phone.value == "")
	 {
	 	alert("Please enter your Home Phone number.")
	 	IntroSignUp.Home_Phone.select()
	 	IntroSignUp.Home_Phone.focus()
	 	return
	 }
	if(IntroSignUp.Home_Phone.value == "999-999-9999")
	 {
	 	alert("Please enter your Home Phone number.")
	 	IntroSignUp.Home_Phone.select()
	 	IntroSignUp.Home_Phone.focus()
	 	return
	 }
	if(IntroSignUp.Student_Name.value == "")
	 {
	 	alert("Please enter Student's Name.")
	 	IntroSignUp.Student_Name.select()
	 	IntroSignUp.Student_Name.focus()
	 	return
	 }	
	if(IntroSignUp.Student_Age.value == "")
	 {
	 	alert("Please enter Student's Age.")
	 	IntroSignUp.Student_Age.select()
	 	IntroSignUp.Student_Age.focus()
	 	return
	 }	
	if(IntroSignUp.Session_Time.value == "Choose Your Session")
	 {
	 	alert("Please Select a Session Time.")
	 	IntroSignUp.Session_Time.select()
	 	IntroSignUp.Session_Time.focus()
	 	return
	 }	
	 
IntroSignUp.realname.value = IntroSignUp.First_Name.value + " " + IntroSignUp.Last_Name.value

IntroSignUp.submit();
}


function chkPhone(Phone)
{
	if(Phone.value != "")
	{
	if(!chkPhoneNum(Phone.value))
	 {
		alert("Phone number is Invalid. 999-999-9999")
		Phone.select()
		Phone.focus()
		return
	 }
	}
}

function chkPhoneNum(phoneNum)
{
	//Strips Hyphens out of phone number and verifies that phone number is valid.
	//Any phone number in the format xxxxxxxxxx, xxx-xxx-xxxx, or (xxx)xxx-xxxx will be valid
	var regexp = /^(\d{10}|\d{3}-\d{3}-\d{4}|\(\d{3}\)\d{3}-\d{4})$/
	return regexp.test(phoneNum)
}