// CHECKS VALIDITY OF NEW MEMBER LOGIN ENTRIES
// REQUIRES LOADING 'GENERALVALIDATE.JS' BEFORE
// THIS FILE IN YOUR CALLING PAGE

//	THIS GETS THE CURRENT FULL PATH TO THE PAGE
var pageName = window.location.pathname;
//	THIS RETURNS JUST THE PAGE NAME AND ITS EXTENSION
pageName = pageName.substring(pageName.lastIndexOf('/') + 1);
//	THIS IDENTIFIES JUST THE PAGE EXTENSION OF THE CURRENT PAGE
var pageExtension = pageName.substring(pageName.lastIndexOf('.')+1);
//	STORAGE VAR EASES TYPING LATER
var slctd = '';

function UpdateSupportType(){
	slctd = document.forms[0].SupportType.options[document.forms[0].SupportType.selectedIndex].value;
	//alert("pageExtension is: " + pageExtension);	//	DEBUG
	if(pageExtension == 'php'){
		if(slctd == 'Phone support'){
			document.location.href="support.php?s=1";
		}
		if(slctd == 'Free email support'){
			document.location.href="support.php?s=2";
		}
		if(slctd == ''){
			document.location.href="support.php";
		}
	} else {
		if(slctd == 'Phone support'){
			document.location.href="support.php?s=1";
		}
	}
	return false;
}

function CheckSupportType(){
	slctd = document.forms[0].SupportType.options[document.forms[0].SupportType.selectedIndex].value;
	if(slctd != "undefined"){
		//alert("SupportType is: " + slctd);	//	DEBUG
		if(slctd.length < 1){
			alert("Please select a support type first");
			document.forms[0].SupportType.focus();
			return false;
		}
	} else {
		alert("ERROR: Form Element 'SupportType' is undefined!\n\nProbably misnamed but could be missing to.\n\nIf you changed the form recently, please check the element name");
	}
}
