<!-- Begin Country State

var OtherArray =  new Array("('------Select Prov/State-----','',true,true)",
"('Alabama')",
"('Alaska')",
"('Arizona')",
"('Arkansas')",
"('California')",
"('Colorado')",
"('Connecticut')",
"('Delaware')",
"('Columbia')",
"('Florida')",
"('Georgia')",
"('Hawaii')",
"('Idaho')",
"('Illinois')",
"('Indiana')",
"('Iowa')",
"('Kansas')",
"('Kentucky')",
"('Louisiana')",
"('Maine')",
"('Maryland')",
"('Massachusetts')",
"('Michigan')",
"('Minnesota')",
"('Mississippi')",
"('Missouri')",
"('Montana')",
"('Nebraska')",
"('Nevada')",
"('New Hampshire')",
"('New Jersey')",
"('New Mexico')",
"('New York')",
"('North Carolina')",
"('North Dakota')",
"('Ohio')",
"('Oklahoma')",
"('Oregon')",
"('Pennsylvania')",
"('Rhode Island')",
"('South Carolina')",
"('South Dakota')",
"('Tennessee')",
"('Texas')",
"('Utah')",
"('Vermont')",
"('Virginia')",
"('Washington')",
"('West Virginia')",
"('Wisconsin')",
"('Wyoming')",
"('Alberta')",
"('British Columbia')",
"('Manitoba')",
"('New Brunswick')",
"('Newfoundland')",
"('Northwest Territories')",
"('Nova Scotia')",
"('Nunavut')",
"('Ontario')",
"('Prince Edward Island')",
"('Quebec')",
"('Saskatchewan')",
"('Yukon Territory')",
"('Puerto Rico')",
"('Other')");
var USAArray =  new Array("('-------- Select State --------','',true,true)",
"('Alabama')",
"('Alaska')",
"('Arizona')",
"('Arkansas')",
"('California')",
"('Colorado')",
"('Connecticut')",
"('Delaware')",
"('Columbia')",
"('Florida')",
"('Georgia')",
"('Hawaii')",
"('Idaho')",
"('Illinois')",
"('Indiana')",
"('Iowa')",
"('Kansas')",
"('Kentucky')",
"('Louisiana')",
"('Maine')",
"('Maryland')",
"('Massachusetts')",
"('Michigan')",
"('Minnesota')",
"('Mississippi')",
"('Missouri')",
"('Montana')",
"('Nebraska')",
"('Nevada')",
"('New Hampshire')",
"('New Jersey')",
"('New Mexico')",
"('New York')",
"('North Carolina')",
"('North Dakota')",
"('Ohio')",
"('Oklahoma')",
"('Oregon')",
"('Pennsylvania')",
"('Rhode Island')",
"('South Carolina')",
"('South Dakota')",
"('Tennessee')",
"('Texas')",
"('Utah')",
"('Vermont')",
"('Virginia')",
"('Washington')",
"('West Virginia')",
"('Wisconsin')",
"('Wyoming')");

var CanadaArray =  new Array("('------ Select Province ------','',true,true)",
"('Alberta')",
"('British Columbia')",
"('Manitoba')",
"('New Brunswick')",
"('Newfoundland')",
"('Northwest Territories')",
"('Nova Scotia')",
"('Nunavut')",
"('Ontario')",
"('Prince Edward Island')",
"('Quebec')",
"('Saskatchewan')",
"('Yukon Territory')");


<!-- Begin

var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\{\}\`\=\|\'\"]/;
function crapcheck(val) {
var strPass = val.value;
var strLength = strPass.length;
var lchar = val.value.charAt((strLength) - 1);
if(lchar.search(mikExp) != -1) {
var tst = val.value.substring(0, (strLength) - 1);
val.value = tst;
   }
}

var mik2Exp = /[$\\\#%\^\&\*\(\)\[\]\+\{\}\`\=\|\'\"\s]/;
function crap2check(val) {
var strPass = val.value;
var strLength = strPass.length;
var lchar = val.value.charAt((strLength) - 1);
if(lchar.search(mik2Exp) != -1) {
var tst = val.value.substring(0, (strLength) - 1);
val.value = tst;
   }
}

function doanothercheck(form) {
if(form.value.length < 1) {
alert("Please enter something.");
return false;
}
if(form.value.search(mikExp) == -1) {
alert("Correct Input");
return false;
}
else {
alert("Sorry, but the following characters\n\r\n\r@ $ % ^ & * # ( ) [ ] \\ { + } ` ~ =  | \n\r\n\rare not allowed!\n");
form.select();
form.focus();
return false;
}
alert("Correct Input");
return false;
}
//  End -->

function textCounter(field, countfield, maxlimit) {
crapcheck(BuyProduct.Comments);
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
//else 
//countfield.value = maxlimit - field.value.length;
}

function populateState(inForm,selected) {
if (selected == "USA") {
var selectedArray = eval(selected + "Array");
}
else {
if (selected == "Canada") {
var selectedArray = eval(selected + "Array");
}
else {
var selectedArray = eval("OtherArray");
}
}
while (selectedArray.length < inForm.State.options.length) {
inForm.State.options[(inForm.State.options.length - 1)] = null;
}
for (var i=0; i < selectedArray.length; i++) {
eval("inForm.State.options[i]=" + "new Option" + selectedArray[i]);
}
if (inForm.Country.options[0].value == '') {
inForm.Country.options[0]= null;
if ( navigator.appName == 'Netscape') {
if (parseInt(navigator.appVersion) < 4) {
window.history.go(0);
}
else {   	
if (navigator.platform == 'Win32' || navigator.platform == 'Win16') {
window.history.go(0);
            }
         }
      }
   }
}
// End -->

<!-- Begin
function changeCase(frmObj) {
var index;
var tmpStr;
var tmpChar;
var preString;
var postString;
var strlen;
tmpStr = frmObj.toLowerCase();
strLen = tmpStr.length;
if (strLen > 0)  {
for (index = 0; index < strLen; index++)  {
if (index == 0)  {
tmpChar = tmpStr.substring(0,1).toUpperCase();
postString = tmpStr.substring(1,strLen);
tmpStr = tmpChar + postString;
}
else {
tmpChar = tmpStr.substring(index, index+1);
if (tmpChar == " " && index < (strLen-1))  {
tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
preString = tmpStr.substring(0, index+1);
postString = tmpStr.substring(index+2,strLen);
tmpStr = preString + tmpChar + postString;
         }
      }
   }
}
	
Length = document.BuyProduct.State.length;
var newOption = new Option (tmpStr, tmpStr);
document.BuyProduct.State.options[Length] = newOption;
document.BuyProduct.State.options[Length].selected = true;
document.BuyProduct.StateHold.value=document.BuyProduct.State.options[document.BuyProduct.State.selectedIndex].text;
}
//  End -->


<!-- Begin
function changeCase2(frmObj) {
var index;
var tmpStr;
var tmpChar;
var preString;
var postString;
var strlen;
tmpStr = frmObj.toLowerCase();
strLen = tmpStr.length;
if (strLen > 0)  {
for (index = 0; index < strLen; index++)  {
if (index == 0)  {
tmpChar = tmpStr.substring(0,1).toUpperCase();
postString = tmpStr.substring(1,strLen);
tmpStr = tmpChar + postString;
}
else {
tmpChar = tmpStr.substring(index, index+1);
if (tmpChar == " " && index < (strLen-1))  {
tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
preString = tmpStr.substring(0, index+1);
postString = tmpStr.substring(index+2,strLen);
tmpStr = preString + tmpChar + postString;
         }
      }
   }
}
Length = document.BuyProduct.Country.length;
var newOption = new Option (tmpStr, tmpStr);
document.BuyProduct.Country.options[Length] = newOption;
document.BuyProduct.Country.options[Length].selected = true;
}
//  End -->

<!-- Begin
function changeCase3(frmObj) {
var index;
var tmpStr;
var tmpChar;
var preString;
var postString;
var strlen;
tmpStr = frmObj.toLowerCase();
strLen = tmpStr.length;
if (strLen > 0)  {
for (index = 0; index < strLen; index++)  {
if (index == 0)  {
tmpChar = tmpStr.substring(0,1).toUpperCase();
postString = tmpStr.substring(1,strLen);
tmpStr = tmpChar + postString;
}
else {
tmpChar = tmpStr.substring(index, index+1);
if (tmpChar == " " && index < (strLen-1))  {
tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
preString = tmpStr.substring(0, index+1);
postString = tmpStr.substring(index+2,strLen);
tmpStr = preString + tmpChar + postString;
         }
      }
   }
}
//frmObj.value = tmpStr;	
document.BuyProduct.City.value = tmpStr;
}

//  End -->


function addstate (Which) {
	if(Which == "State")
	{
		newState = window.prompt ("Enter a new State", "");
		if (newState) {
			changeCase(newState);

		}
}

//  End -->

	if(Which == "Country")
	{
		newState = window.prompt ("Enter a new Country", "");
		if (newState) {
			changeCase2(newState);
		}
	}

}

function validatePH(field) {
var valid = " -()0123456789"
var ok = "yes";
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert('Invalid entry! Only 1234567890 and ( ) - are accepted!');
field.focus();
field.select();
   }
}

function validate(field) {
var valid = "abcdefghijklmnopqrstuvwxyz0123456789_#@~"
var ok = "yes";
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Invalid entry!  Only characters and numbers are accepted!");
field.focus();
field.select();
   }
}


function replaceChars(entry) {
out = "http://"; // replace this
add = ""; // with this
ttt = entry.toLowerCase();
temp = "" + ttt; // temporary holder

while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add + 
temp.substring((pos + out.length), temp.length));
}
document.BuyProduct.URL.value = temp;
}


//--end

//--start

function RememberVal() {
document.BuyProduct.StateHold.value=document.BuyProduct.State.options[document.BuyProduct.State.selectedIndex].text;
//alert(document.BuyProduct.StateHold.value);
//alert(document.BuyProduct.State.options[document.BuyProduct.State.selectedIndex].text);
}

//--end


//--start
function RestoreVal() {
if (document.BuyProduct.StateHold.value == '') {
document.BuyProduct.StateHold.value=document.BuyProduct.State.value;
}
document.BuyProduct.State.value=document.BuyProduct.StateHold.value;
}

//--end


//--start


function domath() {
if (document.BuyProduct.Program_Name.selectedIndex == '1') {
document.BuyProduct.Pricer.value='$900.00';
document.BuyProduct.Pricev.value='900';
}
else
if (document.BuyProduct.Program_Name.selectedIndex == '2') {
document.BuyProduct.Pricer.value='$80.00';
document.BuyProduct.Pricev.value='80';
}
else
if (document.BuyProduct.Program_Name.selectedIndex == '3') {
document.BuyProduct.Pricer.value='$800.00';
document.BuyProduct.Pricev.value='800';
}
else
document.BuyProduct.Pricer.value='$00.00';
}

function domath2() {
if (document.BuyProduct.Program_Name.selectedIndex == '1') {
document.BuyProduct.Pricev.value='900';
}
else
if (document.BuyProduct.Program_Name.selectedIndex == '2') {
document.BuyProduct.Pricev.value='80';
}
else
if (document.BuyProduct.Program_Name.selectedIndex == '3') {
document.BuyProduct.Pricev.value='800';
}
else
document.BuyProduct.Pricev.value='00';
}




function resetform() {
document.forms[0].elements[1]=="";
}

function submitForms() {
if (isProduct() && isFname() && isLname() && isEmail()) {
domath2();
return true;
}
return false
}





function isProduct() {
if (document.BuyProduct.Program_Name.selectedIndex < "1") {
alert ("The Contact About field is blank. \n Please select a Contact About.")
document.BuyProduct.Program_Name.focus();
return false;
}
return true;
}



function isFname() {
if (document.BuyProduct.elements[5].value == "")
{
alert ("The First Name field is blank. \n Please enter your first name.")
document.BuyProduct.elements[5].focus();
return false;
}
return true;
}


function isLname() {
if (document.BuyProduct.elements[6].value == "") {
alert ("The Last Name field is blank. \n Please enter your last name.")
document.BuyProduct.elements[6].focus();
return false;
}
return true;
}

function isEmail() {
if (document.forms[0].elements[7].value == "") {
alert ("The email field is blank. \n Please enter your email address.")
document.forms[0].elements[7].focus();
return false;
}
if (document.forms[0].elements[7].value.indexOf ('@',0) == -1 ||
document.forms[0].elements[7].value.indexOf ('.',0) == -1) {
alert ("The email field requires a \"@\" and a \".\"be used. \n Please re-enter your email address.")
document.forms[0].elements[7].select();
document.forms[0].elements[7].focus();
return false;
}
return true;
}

function isAddress() {
if (document.forms[0].elements[9].value == "") {
alert ("The Address field is blank. \n Please type an Address.")
document.forms[0].elements[9].focus();
return false;
}
return true;
}


function isCity()
{
if (document.forms[0].elements[10].value == "")
{
alert ("The City field is blank. \n Please enter your city.")
document.forms[0].elements[10].focus();
return false;
}
return true;
}


function isCountry() {
//if (document.forms[0].elements[12].value == "") {
if (document.forms[0].elements[12].selectedIndex < "1") {
alert ("The Country field is blank. \n Please select a Country.")
document.forms[0].elements[12].focus();
return false;
}
return true;
}

function isState() {
if (document.forms[0].elements[14].selectedIndex < "1") {
alert ("The state field is blank.\n Please enter your state.")
document.forms[0].elements[14].focus();
return false;
}
//alert (document.forms[0].elements[14].selectedIndex)
return true;
}

function isZip() {
if (document.forms[0].elements[15].value == "") {
alert ("The Zip code field is blank. \n Please enter your Zip code.")
document.forms[0].elements[15].focus();
return false;
}
return true;
}

function isTelePh() {
if (document.forms[0].elements[16].value == "") {
alert ("The telephone number field is blank. \n Please enter your telephone number.")
document.forms[0].elements[16].focus();
return false;
}
return true;
}
