var isIE = ( navigator.appVersion.indexOf( "MSIE" ) != -1 ) ? true : false;
var isWin = ( navigator.appVersion.toLowerCase().indexOf( "win" ) != -1 ) ? true : false;
var isOpera = ( navigator.userAgent.indexOf( "Opera" ) != -1 ) ? true : false;
var AjaxObject = false;
var myObj;

function SetFormFocus()
{
	for( var index = 0; index < document.forms[0].elements.length; index ++ )
	{
		if( document.forms[0].elements[index].type != "hidden" )
		{
			document.forms[0].elements[index].focus();
			return;
		}
	}
}

function SetFocus( myObject )
{
	myObj = document.getElementById( myObject );

	if( myObj )
	{
		myObj.focus();
	}
}

function UnifyName( myInput )
{
	myObj = document.getElementById( myInput );

	if( myObj )
	{
		myObj.name = myInput;
	}
}

function SetInnerHTML( myInput, myValue )
{
	myObj = document.getElementById( myInput );

	if( myObj )
	{
		myObj.innerHTML = myValue;
	}
}

function AppendInnerHTML( myInput, myValue )
{
	myObj = document.getElementById( myInput );

	if( myObj )
	{
		myObj.innerHTML += String(myValue);
	}
}

function SetInput( myInput, myValue )
{
	myObj = document.getElementById( myInput );

	if( myObj )
	{
		myObj.value = myValue;
	}
}

function AppendInput( myInput, myValue )
{
	myObj = document.getElementById( myInput );

	if( myObj )
	{
		myObj.value += String(myValue);
	}
}

function GetInput( myInput )
{
	myObj = document.getElementById( myInput );

	if( myObj )
	{
		return myObj.value;
	}
	else
	{
		return "";
	}
}

function EnableInput( myInput )
{
	myObj = document.getElementById( myInput );

	if( myObj )
	{
		myObj.disabled = false;
	}
}

function DisableInput( myInput )
{
	myObj = document.getElementById( myInput );

	if( myObj )
	{
		myObj.disabled = true;
	}
}

function ClearSelect( mySelect )
{
	myObj = document.getElementById( mySelect );

	if( myObj )
	{
		while( myObj.length > 0 )
		{
			myObj.remove( 0 );
		}
	}
}

function AddSelect( mySelect, value, inner )
{
	myObj = document.getElementById( mySelect );

	if( myObj )
	{
		var option = document.createElement( "OPTION" );
		myObj.options.add( option, myObj.length );
		option.value = value;
		option.innerHTML = inner;
	}
}

function RemoveSelect( mySelect, myValue )
{
	myObj = document.getElementById( mySelect );

	if( myObj )
	{
		for( var loop = 0; loop < myObj.length; loop ++ )
		{
			if( myObj.options[loop].value == myValue )
			{
				myObj.remove( loop );
			}
		}
	}
}

function SetSelect( mySelect, myValue )
{
	myObj = document.getElementById( mySelect );

	if( myObj )
	{
		for( var loop = 0; loop < myObj.length; loop ++ )
		{
			if( myObj.options[loop].value == myValue )
			{
				myObj.selectedIndex = loop;
			}
		}
	}
}

function GetSelect( mySelect )
{
	myObj = document.getElementById( mySelect );

	if( ( myObj ) && ( myObj.selectedIndex > -1 ) )
	{
		return myObj.options[myObj.selectedIndex].value;
	}
	else
	{
		return "";
	}
}

function GetSelectIndex( mySelect, index )
{
	myObj = document.getElementById( mySelect );

	if( myObj )
	{
		return myObj.options[index].value;
	}
	else
	{
		return "";
	}
}

function DisableSelect( mySelect )
{
	myObj = document.getElementById( mySelect );

	if( myObj )
	{
		if( mySelect == "ExamCategory" )
		{
			DisableSelect( "ExamNumber" );
		}

		while( myObj.length > 1 )
		{
			myObj.remove( 1 );
		}

		myObj.selectedIndex = 0;
		myObj.disabled = true;
	}
}

function GetCheckbox( myCheckbox )
{
	myObj = document.getElementById( myCheckbox );

	if( myObj )
	{
		return myObj.checked;
	}
	else
	{
		return "";
	}
}

function SetCheckbox( myCheckbox, myValue )
{
	myObj = document.getElementById( myCheckbox );

	if( myObj )
	{
		if( myValue == myObj.value )
		{
			myObj.checked = true;
		}
	}
}

function ClearCheckbox( myCheckbox )
{
	myObj = document.getElementById( myCheckbox );

	if( myObj )
	{
		myObj.checked = false;
	}
}

function ChangeDisplay( myObject, myValue )
{
	myObj = document.getElementById( myObject );

	if( myObj )
	{
		myObj.style.display = myValue;
	}
}

function ChangeVisibility( myObject, myValue )
{
	myObj = document.getElementById( myObject );

	if( myObj )
	{
		myObj.style.visibility = myValue;
	}
}

function ScrollToBottom( myObject )
{
	myObj = document.getElementById( myObject );

	if( myObj )
	{
		myObj.scrollTop = myObj.scrollHeight;
	}
}

function SetInvalid( myObject )
{
	myObj = document.getElementById( myObject );

	if( myObj )
	{
		var myClass = myObj.getAttribute( "class" );

		if( myClass.substr( myClass.length - 1 ) != "2" )
		{
			myObj.setAttribute( "class", myClass + "2" );
		}
	}
}

function SetValid( myObject )
{
	myObj = document.getElementById( myObject );

	if( myObj )
	{
		var myClass = myObj.getAttribute( "class" );

		if( myClass.substr( myClass.length - 1 ) == "2" )
		{
			myObj.setAttribute( "class", myClass.substr( 0, myClass.length - 1 ) );
		}
	}
}

function CreateAjaxObject()
{
	try{ AjaxObject = new XMLHttpRequest();	} catch( e ) {
	try{ AjaxObject = new ActiveXObject( "MSXML2.XMLHTTP.6.0" ); } catch( e ) {
	try{ AjaxObject = new ActiveXObject( "MSXML2.XMLHTTP" ); } catch( e ) {
	try{ AjaxObject = new ActiveXObject( "Microsoft.XMLHTTP" ); } catch( e ) {

	AjaxObject = false; } } } }
}






function ControlVersion()
{
   var version;
   var axo;
   var e;

   try
   {
      axo = new ActiveXObject( "ShockwaveFlash.ShockwaveFlash.7" );
      version = axo.GetVariable( "$version" );
   }
   catch( e )
   {
   }

   if( !version )
   {
      try
      {
         axo = new ActiveXObject( "ShockwaveFlash.ShockwaveFlash.6" );
         version = "WIN 6,0,21,0";
         axo.AllowScriptAccess = "always";
         version = axo.GetVariable( "$version" );
      }
      catch( e )
      {
      }
   }

   if( !version )
   {
      try
      {
         axo = new ActiveXObject( "ShockwaveFlash.ShockwaveFlash.3" );
         version = axo.GetVariable( "$version" );
      }
      catch( e )
      {
      }
   }

   if( !version )
   {
      try
      {
         axo = new ActiveXObject( "ShockwaveFlash.ShockwaveFlash.3" );
         version = "WIN 3,0,18,0";
      }
      catch( e )
      {
      }
   }

   if( !version )
   {
      try
      {
         axo = new ActiveXObject( "ShockwaveFlash.ShockwaveFlash" );
         version = "WIN 2,0,0,11";
      }
      catch( e )
      {
         version = -1;
      }
   }
	
   return version;
}

function GetSwfVer()
{
   var flashVer = -1;
	
   if( navigator.plugins != null && navigator.plugins.length > 0 )
   {
      if( navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"] )
      {
         var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
         var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
         var descArray = flashDescription.split( " " );
         var tempArrayMajor = descArray[2].split( "." );			
         var versionMajor = tempArrayMajor[0];
         var versionMinor = tempArrayMajor[1];
         var versionRevision = descArray[3];

         if( versionRevision == "" )
         {
            versionRevision = descArray[4];
         }

         if( versionRevision[0] == "d" )
         {
            versionRevision = versionRevision.substring( 1 );
         }
         else if( versionRevision[0] == "r" )
         {
            versionRevision = versionRevision.substring( 1 );
            
            if( versionRevision.indexOf("d") > 0 )
            {
               versionRevision = versionRevision.substring( 0, versionRevision.indexOf( "d" ) );
            }
         }
         
         var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
      }
   }
   else if( navigator.userAgent.toLowerCase().indexOf( "webtv/2.6" ) != -1 )
   {
      flashVer = 4;
   }
   else if( navigator.userAgent.toLowerCase().indexOf( "webtv/2.5" ) != -1 )
   {
      flashVer = 3;
   }
   else if( navigator.userAgent.toLowerCase().indexOf( "webtv" ) != -1 )
   {
      flashVer = 2;
   }
   else if( isIE && isWin && !isOpera )
   {
      flashVer = ControlVersion();
   }	

   return flashVer;
}

function DetectFlashVer( reqMajorVer, reqMinorVer, reqRevision )
{
   versionStr = GetSwfVer();

   if( versionStr == -1 )
   {
      return false;
   }
   else if( versionStr != 0 )
   {
      if( isIE && isWin && !isOpera )
      {
         tempArray = versionStr.split( " " );
         tempString = tempArray[1];
         versionArray = tempString.split( "," );
      }
      else
      {
         versionArray = versionStr.split( "." );
      }

      var versionMajor = versionArray[0];
      var versionMinor = versionArray[1];
      var versionRevision = versionArray[2];

      if( versionMajor > parseFloat( reqMajorVer ) )
      {
         return true;
      }
      else if( versionMajor == parseFloat( reqMajorVer ) )
      {
         if( versionMinor > parseFloat( reqMinorVer ) )
         {
            return true;
         }   
         else if( versionMinor == parseFloat( reqMinorVer ) )
         {
            if( versionRevision >= parseFloat( reqRevision ) )
            {
               return true;
            }   
         }
      }
   }

   return false;
}

function AC_AddExtension( src, ext )
{
   if( src.indexOf( '?' ) != -1 )
   {
      return src.replace( /\?/, ext+'?' );
   }
   else
   {
      return src + ext;
   }   
}

function AC_Generateobj( objAttrs, params, embedAttrs ) 
{ 
   var str = '';
   
   if( isIE && isWin && !isOpera )
   {
      str += '<object ';
      
      for( var i in objAttrs )
      {
         str += i + '="' + objAttrs[i] + '" ';
      }
      
      str += '>';
      
      for( var i in params )
      {
         str += '<param name="' + i + '" value="' + params[i] + '" /> ';
      }
      
      str += '</object>';
   }
   else
   {
      str += '<embed ';

      for( var i in embedAttrs )
      {
         str += i + '="' + embedAttrs[i] + '" ';
      }

      str += '> </embed>';
   }

   document.write(str);
}

function AC_FL_RunContent()
{
   var ret = AC_GetArgs( arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000", "application/x-shockwave-flash" );
   AC_Generateobj( ret.objAttrs, ret.params, ret.embedAttrs );
}

function AC_SW_RunContent()
{
   var ret = AC_GetArgs( arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000", null );
   AC_Generateobj( ret.objAttrs, ret.params, ret.embedAttrs );
}

function AC_GetArgs( args, ext, srcParamName, classid, mimeType )
{
   var ret = new Object();
   ret.embedAttrs = new Object();
   ret.params = new Object();
   ret.objAttrs = new Object();
   
   for( var i=0; i < args.length; i=i+2 )
   {
      var currArg = args[i].toLowerCase();    

      switch( currArg )
      {	
         case "classid":
            break;
         case "pluginspage":
            ret.embedAttrs[args[i]] = args[i+1];
            break;
         case "src":
         case "movie":	
            args[i+1] = AC_AddExtension( args[i+1], ext );
            ret.embedAttrs["src"] = args[i+1];
            ret.params[srcParamName] = args[i+1];
            break;
         case "onafterupdate":
         case "onbeforeupdate":
         case "onblur":
         case "oncellchange":
         case "onclick":
         case "ondblclick":
         case "ondrag":
         case "ondragend":
         case "ondragenter":
         case "ondragleave":
         case "ondragover":
         case "ondrop":
         case "onfinish":
         case "onfocus":
         case "onhelp":
         case "onmousedown":
         case "onmouseup":
         case "onmouseover":
         case "onmousemove":
         case "onmouseout":
         case "onkeypress":
         case "onkeydown":
         case "onkeyup":
         case "onload":
         case "onlosecapture":
         case "onpropertychange":
         case "onreadystatechange":
         case "onrowsdelete":
         case "onrowenter":
         case "onrowexit":
         case "onrowsinserted":
         case "onstart":
         case "onscroll":
         case "onbeforeeditfocus":
         case "onactivate":
         case "onbeforedeactivate":
         case "ondeactivate":
         case "type":
         case "codebase":
         case "id":
            ret.objAttrs[args[i]] = args[i+1];
            break;
         case "width":
         case "height":
         case "align":
         case "vspace": 
         case "hspace":
         case "class":
         case "title":
         case "accesskey":
         case "name":
         case "tabindex":
            ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
            break;
         default:
            ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
      }
   }
  
   ret.objAttrs["classid"] = classid;

   if( mimeType )
   {
      ret.embedAttrs["type"] = mimeType;
   }
   
   return ret;
}









function AddFlashMenu()
{
	var menu = document.getElementById( "flashmenu" );

	if( menu != null )
	{
		menu.innerHTML = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\"750\" height=\"255\" name=\"flash_menu\" id=\"flash_menu\" align=\"top\">" +
							  "<param name=\"allowScriptAccess\" value=\"always\" />" +
							  "<param name=\"allowFullScreen\" value=\"false\" />" +
							  "<param name=\"movie\" value=\"../../swf/SiteTools/menu_bar.swf\" />" +
							  "<param name=\"menu\" value=\"false\" />" +
							  "<param name=\"quality\" value=\"best\" />" +
							  "<param name=\"scale\" value=\"noscale\" />" +
							  "<param name=\"salign\" value=\"t\" />" +
							  "<param name=\"wmode\" value=\"transparent\" />" +
							  "<param name=\"bgcolor\" value=\"#ffffff\" />" +
							  "<embed src=\"../../swf/SiteTools/menu_bar.swf\" menu=\"false\" quality=\"best\" scale=\"noscale\" salign=\"t\" wmode=\"transparent\" bgcolor=\"#ffffff\" width=\"750\" height=\"255\" name=\"flash_menu\" id=\"flash_menu\" align=\"top\" allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"https://www.macromedia.com/go/getflashplayer\" />" +
							  "</object>";
	}
}

function AddFlashBanner()
{
	var banner = document.getElementById( "flashbanner" );

	if( banner != null )
	{
		banner.innerHTML = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\"200\" height=\"200\" name=\"flash_banner\" id=\"flash_banner\" align=\"top\">" +
								 "<param name=\"allowScriptAccess\" value=\"always\" />" +
								 "<param name=\"allowFullScreen\" value=\"false\" />" +
								 "<param name=\"movie\" value=\"../../swf/SiteTools/home_banner.swf\" />" +
								 "<param name=\"menu\" value=\"false\" />" +
								 "<param name=\"quality\" value=\"best\" />" +
								 "<param name=\"scale\" value=\"noscale\" />" +
								 "<param name=\"salign\" value=\"t\" />" +
								 "<param name=\"wmode\" value=\"transparent\" />" +
								 "<param name=\"bgcolor\" value=\"#ffffff\" />" +
								 "<embed src=\"../../swf/SiteTools/home_banner.swf\" menu=\"false\" quality=\"best\" scale=\"noscale\" salign=\"t\" wmode=\"transparent\" bgcolor=\"#ffffff\" width=\"200\" height=\"200\" name=\"flash_banner\" id=\"flash_banner\" align=\"top\" allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />" +
								 "</object>";
	}
}

function AdjustItemIndex( id, value )
{
   var item = document.getElementById( id );
   item.style.zIndex = value;
}

function AdjustSlideShow()
{
   var image = document.getElementById( "homeimages" );
   var detail = document.getElementById( "homedetails" );

   if( ( showstate > 5 ) || ( showstate < 1 ) )
   {
      showstate = 1;
   }
   else
   {
      showstate += 1;
   }
   
   switch( showstate )
   {
      case 1:
         image.src = "../../jpg/home_image_1.jpg";
         detail.src = "../../gif/home_detail_1.gif";
         break;
      case 2:
         image.src = "../../jpg/home_image_2.jpg";
         detail.src = "../../gif/home_detail_2.gif";
         break;
      case 3:
         image.src = "../../jpg/home_image_3.jpg";
         detail.src = "../../gif/home_detail_3.gif";
         break;
      case 4:
         image.src = "../../jpg/home_image_4.jpg";
         detail.src = "../../gif/home_detail_4.gif";
         break;
      case 5:
         image.src = "../../jpg/home_image_5.jpg";
         detail.src = "../../gif/home_detail_5.gif";
         break;
      case 6:
         image.src = "../../jpg/home_image_6.jpg";
         detail.src = "../../gif/home_detail_6.gif";
         break;
   }
}

function PauseSlideShow()
{
   window.clearInterval( showID );
}

function RestartSlideShow()
{
   showID = window.setInterval( "AdjustSlideShow()", delay );
}

function AdjustBanner()
{
   var image = document.getElementById( "homebanner" );

   if( image.src == "http://www.palm-school.com/gif/home_banner_1.gif" )
   {
      image.src = "http://www.palm-school.com/gif/home_banner_3.gif";
      image.useMap = "#bannermap2";
   }
   else if( image.src == "http://www.palm-school.com/gif/home_banner_3.gif" )
   {
      image.src = "http://www.palm-school.com/gif/home_banner_1.gif";
      image.useMap = "#bannermap1";
   }
}





var MenuImages = new Array();
var SubMenuImages = new Array();
var SubSubMenuImages = new Array();

function drawPage()
{
   var myObj;
   var baseOffset = 6;
   var offsetLeft = 0;

   if( document.body.clientWidth > 765 )
   {
      baseOffset = ( ( document.body.clientWidth - 750 ) / 2 );
   }

   offsetLeft = baseOffset + 0;
   myObj = document.getElementById( "head-table" );
   myObj.style.top = "0px";
   myObj.style.left = offsetLeft.toString() + "px";
   myObj.style.visibility = "visible";

   offsetLeft = baseOffset + 0;
   myObj = document.getElementById( "body-table" );
   myObj.style.top = "100px";
   myObj.style.left = offsetLeft.toString() + "px";
   myObj.style.visibility = "visible";
}

function showMenu( menuID, topOffset, leftOffset )
{
   var myObj;
   var baseOffset = 6;
   var offsetLeft = 0;

   if( document.body.clientWidth > 765 )
   {
      baseOffset = ( ( document.body.clientWidth - 750 ) / 2 );
   }

   myObj = document.getElementById( menuID );

   offsetLeft = baseOffset + leftOffset;
   myObj.style.top = topOffset.toString() + "px";
   myObj.style.left = offsetLeft.toString() + "px";
   myObj.style.visibility = "visible";
}

function hideMenu( menuID )
{
   var myObj;

   myObj = document.getElementById( menuID );

   myObj.style.visibility = "hidden";
}

var isIE = ( navigator.appVersion.indexOf( "MSIE" ) != -1 ) ? true : false;
var isWin = ( navigator.appVersion.toLowerCase().indexOf( "win" ) != -1 ) ? true : false;
var isOpera = ( navigator.userAgent.indexOf( "Opera" ) != -1 ) ? true : false;

function GetSwfVersion( major, minor )
{
   if( navigator.plugins && navigator.plugins.length > 0 )
   {
      var type = 'application/x-shockwave-flash';
      var mimeTypes = navigator.mimeTypes;

      if( mimeTypes && mimeTypes[type] && mimeTypes[type].enabledPlugin && mimeTypes[type].enabledPlugin.description )
      {
         var version = mimeTypes[type].enabledPlugin.description;
         var versionParts = version.split( / +/ );
         var MajorMinor = versionParts[2].split( /\./ );

         if( parseInt( MajorMinor[0], 10 ) > major )
         {
            return 2;
         }
         else if( parseInt( MajorMinor[0], 10 ) == major )
         {
            if( parseInt( MajorMinor[1], 10 ) >= minor )
            {
               return 2;
            }
            else
            {
               return 1;
            }
         }
         else if( parseInt( MajorMinor[0], 10 ) > 0 )
         {
            return 1;
         }         
      }
   }

   return 0;
}

function DetectFlashVersion( reqMajor, reqMinor )
{
   var myObj1 = document.getElementById( "CorrectVersion" );
   var myObj2 = document.getElementById( "WrongVersion" );
   var myObj3 = document.getElementById( "NoVersion" );

   var result = GetSwfVersion( reqMajor, reqMinor );

   if( result == 0 )
   {
      myObj1.innerHTML = "";
      myObj2.innerHTML = "";
   }
   else if( result == 1 )
   {
      myObj1.innerHTML = "";
      myObj3.innerHTML = "";
   }
   else if( result == 2 )
   {
      myObj2.innerHTML = "";
      myObj3.innerHTML = "";
   }

   return;
}



function UpdateCreditCost()
{
   var credit = 0;
   var cost = 0;

   if( GetInput( "FormID" ) == "CECC" )
   {
		var myCourses = GetInput( "CourseList" ).split( "," );

		for( var index in myCourses )
		{
			if( GetSelect( "Course" + myCourses[index] ) != "" )
			{
				credit += Number( GetInput( "Credit" + myCourses[index] ) );
				cost += Number( GetInput( "Cost" + myCourses[index] ) );
			}
		}

		SetInnerHTML( "CourseCredit", String(credit) + " Hour" );

		if( credit != 1 )
		{
			AppendInnerHTML( "CourseCredit", "s" );
		}

		SetInnerHTML( "CourseCost", "$" + String(Number(cost).toFixed(2)) );
	}
	else if( GetInput( "FormID" ) == "CEIC" )
	{
		var myCourses = GetInput( "CourseList" ).split( "," );

		for( var index in myCourses )
		{
			if( GetCheckbox( "Course" + myCourses[index] ) )
			{
				credit += Number( GetInput( "Credit" + myCourses[index] ) );
				cost += Number( GetInput( "Cost" + myCourses[index] ) );
			}
		}

		SetInnerHTML( "CourseCredit", String(credit) + " Hour" );

		if( credit != 1 )
		{
			AppendInnerHTML( "CourseCredit", "s" );
		}

		SetInnerHTML( "CourseCost", "$" + String(Number(cost).toFixed(2)) );
	}
	else if( GetInput( "FormID" ) == "EPIC" )
	{
		var myCourses = GetInput( "CourseList" ).split( "," );

		if( GetCheckbox( "CourseZZTK09" ) )
		{
			ClearCheckbox( "CourseZZBR08" );
			DisableInput( "CourseZZBR08" );
		}
		else
		{
			EnableInput( "CourseZZBR08" );
		}

		for( var index in myCourses )
		{
			if( GetCheckbox( "Course" + myCourses[index] ) )
			{
				cost += Number( GetInput( "Cost" + myCourses[index] ) );
			}
		}

		SetInnerHTML( "CourseCost", "$" + String(Number(cost).toFixed(2)) );
	}
	else if( GetInput( "FormID" ) == "EPPE" )
	{
		var myExams = GetInput( "ExamList" ).split( "," );

		for( var index in myExams )
		{
			if( GetCheckbox( "Exam" + myExams[index] ) )
			{
				cost += Number( GetInput( "Cost" + myExams[index] ) );
			}
		}

		SetInnerHTML( "Cost", "<span class=\"label2\">Total Cost: </span><span class=\"alert\" id=\"ExamCost\">$" + String(Number(cost).toFixed(2)) + "</span>" );
	}
}

function UpdateCourses( formID )
{
	if( GetInput( "FormID" ) == "EPIC" )
	{
		var courses = GetInput( "CourseList" ).split( "," );
		var courseids = GetInput( "CourseIDList" ).split( "," );

		if( GetSelect( "ExamCategory" ) == "" )
		{
			ChangeDisplay( "Courses", "none" );
			ChangeDisplay( "Cost", "none" );

			for( var index in courses )
			{
				ClearCheckbox( "Course" + courses[index] );
			}

			ChangeDisplay( "NoCourse", "" );
			UpdateCreditCost();
		}
		else
		{
			ChangeDisplay( "NoCourse", "none" );

			for( var index in courses )
			{
				SetInnerHTML( "Subtitle" + courses[index], "" );

				if( ( GetSelect( "ExamCategory" ) == "General-GN" ) || ( GetSelect( "ExamCategory" ) == "Building-BL" ) || ( GetSelect( "ExamCategory" ) == "Residential-RS" ) )
				{
					ChangeDisplay( "Notes" + courses[index], "" );
				}
				else
				{
					ChangeDisplay( "Notes" + courses[index], "none" );
				}

				if( GetInput( "CourseReset" ) == "True" )
				{
					ClearCheckbox( "Course" + courses[index] );
				}

				if( GetInput( "CourseIDList" ).indexOf( courses[index].replace( "ZZ", GetSelect( "ExamCategory" ).substr( GetSelect( "ExamCategory" ).length - 2 ) ) ) >= 0 )
				{
					ChangeDisplay( courses[index], "table-row" );
				}
				else
				{
					ChangeDisplay( courses[index], "none" );
				}
			}

			SetInput( "CourseReset", "True" );
			ChangeDisplay( "Courses", "" );
			ChangeDisplay( "Cost", "" );
			UpdateCreditCost();
		}
	}
	else if( GetInput( "FormID" ) == "EPSC" )
	{
		var courses = GetInput( "CourseList" ).split( "," );

		if( GetSelect( "ExamCategory" ) == "" )
		{
			ChangeDisplay( "Courses", "none" );

			for( var index in courses )
			{
				ClearCheckbox( "Course" + courses[index] );
			}

			ChangeDisplay( "NoCourse", "inline" );
		}
		else
		{
			ChangeDisplay( "NoCourse", "none" );

			for( var index in courses )
			{
				if( reset )
				{
					ClearCheckbox( "Course" + courses[index] );
				}

				if( GetInput( "Licenses" + courses[index] ).indexOf( GetSelect( "ExamCategory" ).substr( GetSelect( "ExamCategory" ).length - 2 ) ) != -1 )
				{
					ChangeDisplay( courses[index], "table-row" );
				}
				else
				{
					ChangeDisplay( courses[index], "none" );
				}
			}

			ChangeDisplay( "Courses", "inline" );
		}

		reset = true;
	}
}

function UpdateExams()
{
	if( GetInput( "FormID" ) == "EPPE" )
	{
		var exams = GetInput( "ExamList" ).split( "," );
		var examids = GetInput( "ExamIDList" ).split( "," );

		if( GetSelect( "LicenseCategory" ) == "" )
		{
			ChangeDisplay( "Exams", "none" );
			ChangeDisplay( "Cost", "none" );

			for( var index in exams )
			{
				ClearCheckbox( "Exam" + exams[index] );
			}

			ChangeDisplay( "NoExam", "" );
			UpdateCreditCost();
		}
		else
		{
			ChangeDisplay( "NoExam", "none" );

			for( var index in exams )
			{
				ChangeDisplay( "Notes" + exams[index], "none" );

				if( GetInput( "ExamReset" ) == "True" )
				{
					ClearCheckbox( "Exam" + exams[index] );
				}

				if( GetInput( "ExamIDList" ).indexOf( exams[index].replace( "ZZ", GetSelect( "LicenseCategory" ).substr( GetSelect( "LicenseCategory" ).length - 2 ) ) ) >= 0 )
				{
					ChangeDisplay( exams[index], "table-row" );
				}
				else
				{
					ChangeDisplay( exams[index], "none" );
				}
			}

			SetInput( "ExamReset", "True" );
			ChangeDisplay( "Exams", "" );
			ChangeDisplay( "Cost", "" );
			UpdateCreditCost();
		}
	}
}

function AdjustForm()
{
	if( GetInput( "FormID" ) == "EPIC" )
	{
		SetInnerHTML( "Category2", "" );
		ChangeDisplay( "bottom1", "none" );
		ChangeDisplay( "Courses", "none" );
		ChangeDisplay( "Cost", "none" );
		ChangeDisplay( "top1", "table-row" );
		ChangeDisplay( "top2", "table-row" );
		ChangeDisplay( "top3", "table-row" );
		ChangeDisplay( "NoCourse", "" );
	}
	else if( GetInput( "FormID" ) == "EPPE" )
	{
		SetInnerHTML( "Category2", "" );
		ChangeDisplay( "bottom1", "none" );
		ChangeDisplay( "Exams", "none" );
		ChangeDisplay( "Cost", "none" );
		ChangeDisplay( "top1", "table-row" );
		ChangeDisplay( "top2", "table-row" );
		ChangeDisplay( "top3", "table-row" );
		ChangeDisplay( "NoExam", "" );
	}
	else if( GetInput( "FormID" ) == "EPSC" )
	{
		SetInnerHTML( "Category1", "" );
		ChangeDisplay( "bottom1", "none" );
		ChangeDisplay( "Courses", "none" );
		UnifyName( "ExamCategory" );
		ChangeDisplay( "top1", "table-row" );
		ChangeDisplay( "top2", "table-row" );
		ChangeDisplay( "top3", "table-row" );
		ChangeDisplay( "NoCourse", "inline" );
	}
}

function ValidateForm()
{
	var status = false;

	if( GetInput( "FormID" ) == "OBBP" )
	{
		var myInputs = ['FirstName','LastName','HomeAddress1','HomeCity','HomeState','HomeZipCode','DaytimeTelephone','EmailAddress','CreditCardName','CreditCardNumber','CreditCardVerification'];
		var myInputTitles = ['First Name','Last Name','Home Address #1','City','State','Zip Code','Daytime Telephone','Email Address','Name On Credit Card','Account Number','Verification Code'];
		var mySelects = ['CreditCardType','CreditCardExpirationMonth','CreditCardExpirationYear'];
		var mySelectTitles = ['Type Of Card','Expiration Date - Month','Expiration Date - Year'];
		var myRadios = ['AddressType','TakingExam'];
		var myRadioTitles = ['Address Type','Taking Exam'];
		var mySelects2 = ['LicenseType','ExamMonth','ExamYear'];
		var mySelectTitles2 = ['License Type','Exam Date - Month','Exam Date - Year'];

		for( var index in myInputs )
		{
			SetInput( myInputs[index], GetInput( myInputs[index] ).replace( /^\s+|\s+$/g, "" ) );

			if( GetInput( myInputs[index] ) == "" )
			{
				alert( "'" + myInputTitles[index] + "' is a required field and is currently empty!" );
				SetInvalid( myInputs[index] );
				SetFocus( myInputs[index] );
				EnableInput( "Submit" );
				return false;
			}
			else
			{
				SetValid( myInputs[index] );
			}
		}

		for( var index in mySelects )
		{
			if( GetSelect( mySelects[index] ) == "" )
			{
				alert( "'" + mySelectTitles[index] + "' is a required field and is currently empty!" );
				SetInvalid( mySelects[index] );
				SetFocus( mySelects[index] );
				EnableInput( "Submit" );
				return false;
			}
			else
			{
				SetValid( mySelects[index] );
			}
		}

		for( var index in myRadios )
		{
			if( ( GetCheckbox( myRadios[index] + "1" ) == "" ) && ( GetCheckbox( myRadios[index] + "2" ) == "" ) )
			{
				alert( "'" + myRadioTitles[index] + "' is a required field and is currently empty!" );
				SetInvalid( myRadios[index] );
				SetFocus( myRadios[index] );
				EnableInput( "Submit" );
				return false;
			}
			else
			{
				SetValid( myRadios[index] );
			}
		}

		if( GetCheckbox( "TakingExam1" ) )
		{
			for( var index in mySelects2 )
			{
				if( GetSelect( mySelects2[index] ) == "" )
				{
					alert( "'" + mySelectTitles2[index] + "' is a required field and is currently empty!" );
					SetInvalid( mySelects2[index] );
					SetFocus( mySelects2[index] );
					EnableInput( "Submit" );
					return false;
				}
				else
				{
					SetValid( mySelects2[index] );
				}
			}
		}

		if( !ValidateObject( "EmailAddress" ) )
		{
			alert( "'Email Address' currently contains an invalid value!\nA valid email address is expected ( name@email.com )." );
			SetInvalid( "EmailAddress" );
			SetFocus( "EmailAddress" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "EmailAddress" );
		}

		if( !ValidateObject( "CreditCardNumber" ) )
		{
			alert( "'Credit Card - Account Number' currently contains an invalid value!" );
			SetInvalid( "CreditCardNumber" );
			SetFocus( "CreditCardNumber" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "CreditCardNumber" );
		}

		if( !ValidateObject( "CreditCardExpiration" ) )
		{
			alert( "'Credit Card - Expiration Date' currently contains an invalid value!" );
			SetInvalid( "CreditCardExpirationMonth" );
			SetInvalid( "CreditCardExpirationYear" );
			SetFocus( "CreditCardExpirationMonth" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "CreditCardExpirationMonth" );
			SetValid( "CreditCardExpirationYear" );
		}
	}
	else if( GetInput( "FormID" ) == "OBSC" )
	{
		var myInputs = GetInput( "Inputs" ).split( "," );

		for( var index in myInputs )
		{
			SetInput( myInputs[index], GetInput( myInputs[index] ).replace( /\s+/g, "" ) );

			if( GetInput( myInputs[index] ) == "" )
			{
				alert( "'Quantity' is a required field and is currently empty!\nIf you are trying to remove the item from your cart, use '0'." );
				SetInvalid( myInputs[index] );
				SetFocus( myInputs[index] );
				return false;
			}
			else if( GetInput( myInputs[index] ).match( /[^0-9]/ ) != null )
			{
				alert( "'Quantity' requires a numeric value, check your entry for invalid characters!" );
				SetInvalid( myInputs[index] );
				SetFocus( myInputs[index] );
				return false;
			}
			else
			{
				SetValid( myInputs[index] );
			}
		}
	}
	else if( GetInput( "FormID" ) == "EPIC" )
	{
		DisableInput( "Submit" );

		var myInputs = ['FirstName','LastName','HomeAddress1','HomeCity','HomeState','HomeZipCode','DaytimeTelephone','EmailAddress','CreditCardName','CreditCardNumber','CreditCardVerification'];
		var myInputTitles = ['First Name','Last Name','Home Address #1','City','State','Zip Code','Daytime Telephone','Email Address','Name On Credit Card','Account Number','Verification Code'];
		var mySelects = ['CreditCardType','CreditCardExpirationMonth','CreditCardExpirationYear'];
		var mySelectTitles = ['Type Of Card','Expiration Date - Month','Expiration Date - Year'];
		var myCourses = GetInput( "CourseList" ).split( "," );

		for( var index in myInputs )
		{
			SetInput( myInputs[index], GetInput( myInputs[index] ).replace( /^\s+|\s+$/g, "" ) );
			
			if( GetInput( myInputs[index] ) == "" )
			{
				alert( "'" + myInputTitles[index] + "' is a required field and is currently empty!" );
				SetInvalid( myInputs[index] );
				SetFocus( myInputs[index] );
				EnableInput( "Submit" );
				return false;
			}
			else
			{
				SetValid( myInputs[index] );
			}
		}

		for( var index in mySelects )
		{
			if( GetSelect( mySelects[index] ) == "" )
			{
				alert( "'" + mySelectTitles[index] + "' is a required field and is currently empty!" );
				SetInvalid( mySelects[index] );
				SetFocus( mySelects[index] );
				EnableInput( "Submit" );
				return false;
			}
			else
			{
				SetValid( mySelects[index] );
			}
		}

		if( GetSelect( "ExamCategory" ) == "" )
		{
			alert( "'Exam Category' is a required field and is currently empty!" );
			SetInvalid( "ExamCategory" );
			SetFocus( "ExamCategory" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "ExamCategory" );
		}

		for( var index in myCourses )
		{
			if( GetCheckbox( "Course" + myCourses[index] ) )
			{
				status = true;
			}
		}

		if( !status )
		{
			alert( "'Course Selection' is a required field and is currently empty!" );
			EnableInput( "Submit" );
			return false;
		}

		if( !ValidateObject( "EmailAddress" ) )
		{
			alert( "'Email Address' currently contains an invalid value!\nA valid email address is expected ( name@email.com )." );
			SetInvalid( "EmailAddress" );
			SetFocus( "EmailAddress" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "EmailAddress" );
		}

		if( !ValidateObject( "CreditCardNumber" ) )
		{
			alert( "'Credit Card Number' currently contains an invalid value!" );
			SetInvalid( "CreditCardNumber" );
			SetFocus( "CreditCardNumber" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "CreditCardNumber" );
		}

		if( !ValidateObject( "CreditCardExpiration" ) )
		{
			alert( "'Credit Card - Expiration Date' currently contains an invalid value!" );
			SetInvalid( "CreditCardExpirationMonth" );
			SetInvalid( "CreditCardExpirationYear" );
			SetFocus( "CreditCardExpirationMonth" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "CreditCardExpirationMonth" );
			SetValid( "CreditCardExpirationYear" );
		}
	}
	else if( GetInput( "FormID" ) == "EPPE" )
	{
		DisableInput( "Submit" );

		var myInputs = ['FirstName','LastName','HomeAddress1','HomeCity','HomeState','HomeZipCode','DaytimeTelephone','EmailAddress','CreditCardName','CreditCardNumber','CreditCardVerification'];
		var myInputTitles = ['First Name','Last Name','Home Address #1','City','State','Zip Code','Daytime Telephone','Email Address','Name On Credit Card','Account Number','Verification Code'];
		var mySelects = ['CreditCardType','CreditCardExpirationMonth','CreditCardExpirationYear'];
		var mySelectTitles = ['Type Of Card','Expiration Date - Month','Expiration Date - Year'];
		var myExams = GetInput( "ExamList" ).split( "," );

		for( var index in myInputs )
		{
			SetInput( myInputs[index], GetInput( myInputs[index] ).replace( /^\s+|\s+$/g, "" ) );
			
			if( GetInput( myInputs[index] ) == "" )
			{
				alert( "'" + myInputTitles[index] + "' is a required field and is currently empty!" );
				SetInvalid( myInputs[index] );
				SetFocus( myInputs[index] );
				EnableInput( "Submit" );
				return false;
			}
			else
			{
				SetValid( myInputs[index] );
			}
		}

		for( var index in mySelects )
		{
			if( GetSelect( mySelects[index] ) == "" )
			{
				alert( "'" + mySelectTitles[index] + "' is a required field and is currently empty!" );
				SetInvalid( mySelects[index] );
				SetFocus( mySelects[index] );
				EnableInput( "Submit" );
				return false;
			}
			else
			{
				SetValid( mySelects[index] );
			}
		}

		if( GetSelect( "LicenseCategory" ) == "" )
		{
			alert( "'License Category' is a required field and is currently empty!" );
			SetInvalid( "LicenseCategory" );
			SetFocus( "LicenseCategory" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "LicenseCategory" );
		}

		for( var index in myExams )
		{
			if( GetCheckbox( "Exam" + myExams[index] ) )
			{
				status = true;
			}
		}

		if( !status )
		{
			alert( "'Exam Selection' is a required field and is currently empty!" );
			EnableInput( "Submit" );
			return false;
		}

		if( !ValidateObject( "EmailAddress" ) )
		{
			alert( "'Email Address' currently contains an invalid value!\nA valid email address is expected ( name@email.com )." );
			SetInvalid( "EmailAddress" );
			SetFocus( "EmailAddress" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "EmailAddress" );
		}

		if( !ValidateObject( "CreditCardNumber" ) )
		{
			alert( "'Credit Card Number' currently contains an invalid value!" );
			SetInvalid( "CreditCardNumber" );
			SetFocus( "CreditCardNumber" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "CreditCardNumber" );
		}

		if( !ValidateObject( "CreditCardExpiration" ) )
		{
			alert( "'Credit Card - Expiration Date' currently contains an invalid value!" );
			SetInvalid( "CreditCardExpirationMonth" );
			SetInvalid( "CreditCardExpirationYear" );
			SetFocus( "CreditCardExpirationMonth" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "CreditCardExpirationMonth" );
			SetValid( "CreditCardExpirationYear" );
		}
	}
	else if( GetInput( "FormID" ) == "EPSC" )
	{
		DisableInput( "Submit" );

		var myInputs = ['FirstName','LastName','DaytimeTelephone','EmailAddress'];
		var myInputTitles = ['First Name','Last Name','Daytime Telephone','Email Address'];
		var myCourses = GetInput( "CourseList" ).split( "," );

		for( var index in myInputs )
		{
			SetInput( myInputs[index], GetInput( myInputs[index] ).replace( /^\s+|\s+$/g, "" ) );
			
			if( GetInput( myInputs[index] ) == "" )
			{
				alert( "'" + myInputTitles[index] + "' is a required field and is currently empty!" );
				SetInvalid( myInputs[index] );
				SetFocus( myInputs[index] );
				EnableInput( "Submit" );
				return false;
			}
			else
			{
				SetValid( myInputs[index] );
			}
		}

		if( GetSelect( "ExamCategory" ) == "" )
		{
			alert( "'Exam Category' is a required field and is currently empty!" );
			SetInvalid( "ExamCategory" );
			SetFocus( "ExamCategory" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "ExamCategory" );
		}

		for( var index in myCourses )
		{
			if( GetCheckbox( "Course" + myCourses[index] ) )
			{
				status = true;
			}
		}

		if( !status )
		{
			alert( "'Course Selection' is a required field and is currently empty!" );
			EnableInput( "Submit" );
			return false;
		}

		if( !ValidateObject( "EmailAddress" ) )
		{
			alert( "'Email Address' currently contains an invalid value!\nA valid email address is expected ( name@email.com )." );
			SetInvalid( "EmailAddress" );
			SetFocus( "EmailAddress" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "EmailAddress" );
		}
	}
	else if( GetInput( "FormID" ) == "CECC" )
	{
		DisableInput( "Submit" );

		var myInputs = ['FirstName','LastName','LicenseNumbers','HomeAddress1','HomeCity','HomeState','HomeZipCode','DaytimeTelephone','EmailAddress','CreditCardName','CreditCardNumber','CreditCardVerification'];
		var myInputTitles = ['First Name','Last Name','License Numbers','Street Address #1','City','State','Zip Code','Daytime Telephone','Email Address','Name On Credit Card','Account Number','Verification Code'];
		var mySelects = ['CreditCardType','CreditCardExpirationMonth','CreditCardExpirationYear'];
		var mySelectTitles = ['Type Of Card','Expiration Date - Month','Expiration Date - Year'];
		var myCourses = GetInput( "CourseList" ).split( "," );

		for( var index in myCourses )
		{
			if( GetSelect( "Course" + myCourses[index] ) != "" )
			{
				status = true;
			}
		}

		if( !status )
		{
			alert( "'Course Selection' is a required field and is currently empty!" );
			EnableInput( "Submit" );
			return false;
		}

		for( var index in myInputs )
		{
			SetInput( myInputs[index], GetInput( myInputs[index] ).replace( /^\s+|\s+$/g, "" ) );

			if( GetInput( myInputs[index] ) == "" )
			{
				alert( "'" + myInputTitles[index] + "' is a required field and is currently empty!" );
				SetInvalid( myInputs[index] );
				SetFocus( myInputs[index] );
				EnableInput( "Submit" );
				return false;
			}
			else
			{
				SetValid( myInputs[index] );
			}
		}

		for( var index in mySelects )
		{
			if( GetSelect( mySelects[index] ) == "" )
			{
				alert( "'" + mySelectTitles[index] + "' is a required field and is currently empty!" );
				SetInvalid( mySelects[index] );
				SetFocus( mySelects[index] );
				EnableInput( "Submit" );
				return false;
			}
			else
			{
				SetValid( mySelects[index] );
			}
		}

		if( !ValidateObject( "EmailAddress" ) )
		{
			alert( "'Email Address' currently contains an invalid value!\nA valid email address is expected ( name@email.com )." );
			SetInvalid( "EmailAddress" );
			SetFocus( "EmailAddress" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "EmailAddress" );
		}

		if( !ValidateObject( "CreditCardNumber" ) )
		{
			alert( "'Credit Card Number' currently contains an invalid value!" );
			SetInvalid( "CreditCardNumber" );
			SetFocus( "CreditCardNumber" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "CreditCardNumber" );
		}

		if( !ValidateObject( "CreditCardExpiration" ) )
		{
			alert( "'Credit Card - Expiration Date' currently contains an invalid value!" );
			SetInvalid( "CreditCardExpirationMonth" );
			SetInvalid( "CreditCardExpirationYear" );
			SetFocus( "CreditCardExpirationMonth" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "CreditCardExpirationMonth" );
			SetValid( "CreditCardExpirationYear" );
		}
	}
	else if( GetInput( "FormID" ) == "CEIC" )
	{
		DisableInput( "Submit" );

		var myInputs = ['FirstName','LastName','LicenseNumbers','HomeAddress1','HomeCity','HomeState','HomeZipCode','DaytimeTelephone','EmailAddress','CreditCardName','CreditCardNumber','CreditCardVerification'];
		var myInputTitles = ['First Name','Last Name','License Numbers','Home Address #1','City','State','Zip Code','Daytime Telephone','Email Address','Name On Credit Card','Account Number','Verification Code'];
		var mySelects = ['CreditCardType','CreditCardExpirationMonth','CreditCardExpirationYear'];
		var mySelectTitles = ['Type Of Card','Expiration Date - Month','Expiration Date - Year'];
		var myCourses = GetInput( "CourseList" ).split( "," );

		for( var index in myInputs )
		{
			SetInput( myInputs[index], GetInput( myInputs[index] ).replace( /^\s+|\s+$/g, "" ) );

			if( GetInput( myInputs[index] ) == "" )
			{
				alert( "'" + myInputTitles[index] + "' is a required field and is currently empty!" );
				SetInvalid( myInputs[index] );
				SetFocus( myInputs[index] );
				EnableInput( "Submit" );
				return false;
			}
			else
			{
				SetValid( myInputs[index] );
			}
		}

		for( var index in mySelects )
		{
			if( GetSelect( mySelects[index] ) == "" )
			{
				alert( "'" + mySelectTitles[index] + "' is a required field and is currently empty!" );
				SetInvalid( mySelects[index] );
				SetFocus( mySelects[index] );
				EnableInput( "Submit" );
				return false;
			}
			else
			{
				SetValid( mySelects[index] );
			}
		}

		for( var index in myCourses )
		{
			if( GetCheckbox( "Course" + myCourses[index] ) )
			{
				status = true;
			}
		}

		if( !status )
		{
			alert( "'Course Selection' is a required field and is currently empty!" );
			EnableInput( "Submit" );
			return false;
		}

		if( !ValidateObject( "EmailAddress" ) )
		{
			alert( "'Email Address' currently contains an invalid value!\nA valid email address is expected ( name@email.com )." );
			SetInvalid( "EmailAddress" );
			SetFocus( "EmailAddress" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "EmailAddress" );
		}

		if( !ValidateObject( "CreditCardNumber" ) )
		{
			alert( "'Credit Card Number' currently contains an invalid value!" );
			SetInvalid( "CreditCardNumber" );
			SetFocus( "CreditCardNumber" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "CreditCardNumber" );
		}

		if( !ValidateObject( "CreditCardExpiration" ) )
		{
			alert( "'Credit Card - Expiration Date' currently contains an invalid value!" );
			SetInvalid( "CreditCardExpirationMonth" );
			SetInvalid( "CreditCardExpirationYear" );
			SetFocus( "CreditCardExpirationMonth" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "CreditCardExpirationMonth" );
			SetValid( "CreditCardExpirationYear" );
		}
	}
	else if( GetInput( "FormID" ) == "SSEU" )
	{
		DisableInput( "Submit" );

		var myInputs = ['FullName','EmailAddress','Subject','Message'];
		var myInputTitles = ['Full Name','Email Address','Subject','Message'];

		if( GetSelect( "Target" ) == "" )
		{
			alert( "'To' is a required field and is currently empty!" );
			SetInvalid( "Target" );
			SetFocus( "Target" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "Target" );
		}

		for( var index in myInputs )
		{
			SetInput( myInputs[index], GetInput( myInputs[index] ).replace( /^\s+|\s+$/g, "" ) );

			if( GetInput( myInputs[index] ) == "" )
			{
				alert( "'" + myInputTitles[index] + "' is a required field and is currently empty!" );
				SetInvalid( myInputs[index] );
				SetFocus( myInputs[index] );
				EnableInput( "Submit" );
				return false;
			}
			else
			{
				SetValid( myInputs[index] );
			}
		}

		if( !ValidateObject( "EmailAddress" ) )
		{
			alert( "'Email Address' currently contains an invalid value!\nA valid email address is expected ( name@email.com )." );
			SetInvalid( "EmailAddress" );
			SetFocus( "EmailAddress" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "EmailAddress" );
		}
	}
	else if( GetInput( "FormID" ) == "SSIP" )
	{
		DisableInput( "Submit" );

		var myInputs = ['FirstName','LastName','Address1','City','State','ZipCode','EmailAddress'];
		var myInputTitles = ['First Name','Last Name','Street Address #1','City','State','Zip Code','Email Address'];

		for( var index in myInputs )
		{
			SetInput( myInputs[index], GetInput( myInputs[index] ).replace( /^\s+|\s+$/g, "" ) );

			if( GetInput( myInputs[index] ) == "" )
			{
				alert( "'" + myInputTitles[index] + "' is a required field and is currently empty!" );
				SetInvalid( myInputs[index] );
				SetFocus( myInputs[index] );
				EnableInput( "Submit" );
				return false;
			}
			else
			{
				SetValid( myInputs[index] );
			}
		}

		if( ( GetSelect( "ExamCategory" ) == "" ) && ( GetInput( "ExamCategory" ) == "" ) )
		{
			alert( "'Exam Category' is a required field and is currently empty!" );
			SetInvalid( "ExamCategory" );
			SetFocus( "ExamCategory" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "ExamCategory" );
		}

		if( !ValidateObject( "EmailAddress" ) )
		{
			alert( "'Email Address' currently contains an invalid value!\nA valid email address is expected ( name@email.com )." );
			SetInvalid( "EmailAddress" );
			SetFocus( "EmailAddress" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "EmailAddress" );
		}
	}
	else if( GetInput( "FormID" ) == "SSOC" )
	{
		DisableInput( "Submit" );

		if( GetInput( "Confirmation" ) == "" )
		{
			alert( "'Access Code' is a required field and is currently empty!" );
			SetInvalid( "Confirmation" );
			SetFocus( "Confirmation" );
			EnableInput( "Submit" );
			return false;
		}
		else
		{
			SetValid( "Confirmation" );
		}
	}

	return true;
}

function ValidateObject( myObject )
{
	if( ( myObject == "EmailAddress" ) && ( GetInput( "EmailAddress" ).toLowerCase() != "no email" ) )
	{
		var reg = /^[_A-Za-z0-9\-]+(\.[_A-Za-z0-9\-]+)*\@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)*(\.[A-Za-z]{2,4})$/;

		return reg.test( GetInput( myObject ) );
	}
	else if( ( myObject == "CreditCardNumber" ) && ( GetInput( "BillingZipCode" ) != "00000" ) )
	{
		var digits = GetInput( "CreditCardNumber" ).split( "" );
		var sum = 0;

		for( index = digits.length; index > 0; index -- )
		{
			digits[index-1] = parseInt( digits[index-1] );

			if( ( digits.length - index ) % 2 == 1 )
			{
				digits[index-1] *= 2;

				if( digits[index-1] >= 10 )
				{
					digits[index-1] -= 9;
				}
			}

			sum += digits[index-1];
		}

		return ( sum % 10 == 0 );
	}
	else if( myObject == "CreditCardExpiration" )
	{
		var myDate = new Date();

		if( myDate.getFullYear() == parseInt( GetInput( "CreditCardExpirationYear" ), 10 ) )
		{
			if( myDate.getMonth() >= parseInt( GetInput( "CreditCardExpirationMonth" ), 10 ) )
			{
				return false;
			}
		}

		return true;
	}

	return false;
}

function ToggleCartView()
{
	if( GetInput( "CartStatus" ) == "HIDDEN" )
	{
		SetInput( "CartStatus", "VISIBLE" );
		SetInnerHTML( "CartLink", "Hide Shopping Cart Details" );
		ChangeDisplay( "CartDetails", "block" );
		ChangeDisplay( "CartEditLink", "block" );
		ChangeDisplay( "CartSubtotal", "none" );
	}
	else
	{
		SetInput( "CartStatus", "HIDDEN" );
		SetInnerHTML( "CartLink", "View Shopping Cart Details" );
		ChangeDisplay( "CartDetails", "none" );
		ChangeDisplay( "CartEditLink", "none" );
		ChangeDisplay( "CartSubtotal", "block" );
	}
}

function ToggleExamView( status )
{
	if( status == "SHOW" )
	{
		ChangeDisplay( "ExamDetails1", "table-row" );
		ChangeDisplay( "ExamDetails2", "table-row" );
		ChangeDisplay( "ExamDetails3", "table-row" );
	}
	else
	{
		ChangeDisplay( "ExamDetails1", "none" );
		ChangeDisplay( "ExamDetails2", "none" );
		ChangeDisplay( "ExamDetails3", "none" );
	}
}

function ClearSessionStatus()
{
	if( AjaxObject == false )
	{
		CreateAjaxObject();
	}

	if( AjaxObject != false )
	{
		AjaxObject.open( "GET", "https://www.palm-school.com/php/ss_sessionmanager.php", true );
		AjaxObject.send( null );
	}
}
