function submitQuickPassForm() {
	 
	var str = trim(document.quickPassCode.qpCode.value); 
	
	if (document.quickPassCode.qpCode.value == "Type Code Here" || str.length == 0) {
		alert("Enter your QuickPass code and then click \"go\"");
	} else {
		document.quickPassCode.submit();
	}
	
}  
 function submitQuickPassForm_key(evt) {
	 
	  var str = trim(document.quickPassCode.qpCode.value);
	  var charCode = (evt.which) ? evt.which : evt.keyCode;
	  if(charCode ==13)
	  {
		if (document.quickPassCode.qpCode.value == "Type Code Here" || str.length == 0) {
			alert("Enter your QuickPass code and then click \"go\"");
			return false;
		} else {
			document.quickPassCode.submit();
			
		}
		
	}
}  
function resetCodeInput() {
	document.quickPassCode.qpCode.value = "";
}
 function trim(s) {
	s = s.replace(/(^\s*)|(\s*$)/gi,"");
	s = s.replace(/[ ]{2,}/gi," ");
	s = s.replace(/\n /,"\n");
	return s;
}
function goToPage() //Function Start: invoked when the "Enter" image button is clicked on the homepage.
{
StateIndex=document.form1.select1.selectedIndex; //Stores the State index number
PageIndex2=document.form1.select2.selectedIndex; //Stores the descipline index number

//alert("Descipline Selected: "+PageIndex2);

//alert("State Selected: "+StateIndex);

var state=document.form1.select1.options[StateIndex].value; //Stores the value of the State index
var descipline=document.form1.select2.options[PageIndex2].value; //Stores the value of the descipline index




if (state != "") //validating if the state selection is not empty
{
if (descipline != "subject") //validating if the descipline selection is not empty
{
var rad_val;
for (var i=0; i < document.form1.rad_select.length; i++)
{
if (document.form1.rad_select[i].checked)
{
rad_val = document.form1.rad_select[i].value;
break;
}
else
{
rad_val = "5";
}
}
if (rad_val == "5")
{
alert("Please select a User.");
return;
}



else


{

if (descipline == "../../js-bin/techconnect.html") {

window.open ("http://www.techconnect.glencoe.com/tc/jsp/TcHome.jsp");

} else if (descipline == "../../js-bin/passkey.html") {

window.open ("http://passkeylearning.com/");
} else if (descipline == "../../js-bin/aleks.html") {

window.open ("http://www.k12.aleks.com/?ref=web");
}

else
{
window.open ("http://www.glencoe.com/sites/"+state+"/"+rad_val+"/"+descipline+"/index.html");


}

}
}

else if(document.form1.select2.options[PageIndex2].value == "subject")
{
//alert(state);
if(state=="alabama")
stateABB="al";
if(state=="alaska")
stateABB="ak";
if(state=="arizona")
stateABB="az";
if(state=="arkansas")
stateABB="ar";
if(state=="california")
stateABB="ca";
if(state=="colorado")
stateABB="co";
if(state=="connecticut")
stateABB="ct";
if(state=="delaware")
stateABB="de";
if(state=="district_of_columbia")
stateABB="dc";
if(state=="florida")
stateABB="fl";
if(state=="georgia")
stateABB="ga";
if(state=="hawaii")
stateABB="hi";
if(state=="idaho")
stateABB="id";
if(state=="illinois")
stateABB="il";
if(state=="indiana")
stateABB="in";
if(state=="international")
stateABB="ak";
if(state=="iowa")
stateABB="ia";
if(state=="kansas")
stateABB="ks";
if(state=="kentucky")
stateABB="ky";
if(state=="louisiana")
stateABB="la";
if(state=="maine")
stateABB="me";
if(state=="maryland")
stateABB="md";
if(state=="massachusetts")
stateABB="ma";
if(state=="michigan")
stateABB="mi";
if(state=="minnesota")
stateABB="mn";
if(state=="mississippi")
stateABB="ms";
if(state=="missouri")
stateABB="mo";
if(state=="montana")
stateABB="mt";
if(state=="nebraska")
stateABB="ne";
if(state=="nevada")
stateABB="nv";
if(state=="new_hampshire")
stateABB="nh";
if(state=="new_jersey")
stateABB="nj";
if(state=="new_mexico")
stateABB="nm";
if(state=="new_york")
stateABB="ny";
if(state=="north_carolina")
stateABB="nc";
if(state=="north_dakota")
stateABB="nd";
if(state=="ohio")
stateABB="oh";
if(state=="oklahoma")
stateABB="ok";
if(state=="oregon")
stateABB="or";
if(state=="pennsylvania")
stateABB="pa";
if(state=="rhode_island")
stateABB="ri";
if(state=="south_carolina")
stateABB="sc";
if(state=="south_dakota")
stateABB="sd";
if(state=="tennessee")
stateABB="tn";
if(state=="texas")
stateABB="tx";
if(state=="utah")
stateABB="ut";
if(state=="vermont")
stateABB="vt";
if(state=="virginia")
stateABB="va";
if(state=="washington")
stateABB="wa";
if(state=="west_virginia")
stateABB="wv";
if(state=="wisconsin")
stateABB="wi";
if(state=="wyoming")
stateABB="wy";

var rad_val;
for (var i=0; i < document.form1.rad_select.length; i++)
{
if (document.form1.rad_select[i].checked)
{
rad_val = document.form1.rad_select[i].value;
break;
}
else
{
rad_val = "5";
}
}
if (rad_val == "5")
{
alert("Please select a User.");
return;
}



else
{
//alert(stateABB);
location.href = "http://www.glencoe.com/sites/"+state+"/support_"+rad_val+"/state_resources/state_res_"+stateABB+".html";
//alert("Please select a dicipline");
//return;
}
}
}
else
{
alert("Please select a state");

return;
}
//checkbox script to add in for remembering settings
if (document.forms[0].checkbox.checked)
{

window.onUnload=saveSelections(document.forms[0]);

} else {

//document.cookie = ("mvalue"+window.location.pathname) + "=" +"; expires=Thu, 01-Jan-70 00:00:01 GMT";
//resetcookie(document.forms[0]);
//	alert("Hello World 3!")

window.onUnload=resetSelections(document.forms[0]);

}


}


