<!--

nm = /[0-9]/;
wsp = " \t\n\r";
nasym = /[\b\B\s\.\,\-a-zA-Z]/;
pasym = /[0-9a-zA-Z]/;

function saveRestName(thisform)
{
with (thisform)
{
	document.cookie = "restname="+restname.value+";";
}
}

function loadRestName(thisform,cookies)
{
with (thisform)
{
	if(cookies["restname"])
	{
		restname.value = cookies["restname"];
		return true;
	}
}
return false;
}

function enterOnly(field, event, list) 
{
var key;
if (window.event) key = window.event.keyCode;
else if (event) key = event.which;
else return true;
if ((key == null) || (key == 0) || (key == 8) || (key == 9) || (key == 13) || (key == 27)) return true;
else if (list.test(String.fromCharCode(key))) { window.status = ""; return true; }
else { window.status = "Invalid Key Stroke!"; return false; }
}

function phoneOnly(field, event, list)
{
if(enterOnly(field, event, list))
{
	switch(field.value.length)
	{
		case 0: field.value="("+field.value; break;
		case 4: field.value=field.value+")"; break;
		case 8: field.value=field.value+"-"; break;
	}
	return true;
}
else return false;
}

function emailvalidation(entered, alertbox)
{
// E-mail Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
with (entered)
{
apos=value.indexOf("@"); 
dotpos=value.lastIndexOf(".");
lastpos=value.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
{if (alertbox) {alert(alertbox);} return false;}
else {return true;}
}
} 

function emptyvalidation(entered, alertbox)
{
with (entered)
{
if (value==null || value=="" || value.length==0)
{if (alertbox!="") {alert(alertbox);} return false;}
for(i=0;i<value.length;i++)
{
	var c=value.charAt(i);
	if(wsp.indexOf(c)==-1) return true;
}
return false;
} 
}

function countvalidation(entered, num, alertbox)
{
with (entered)
{
if (value.length==num) return true;
else if (alertbox!="") alert(alertbox);
return false;
} 
}

function passvalidation(entered, num, list, alertbox)
{
with (entered)
{
if (value.length > num && list.test(value)) return true;
else if (alertbox!="") alert(alertbox);
return false;
}
}

function radiovalidation(entered)
{ 
// set var radio_choice to false
var radio_choice = new Array();
radio_choice[0] = false;
radio_choice[1] = false;
if(entered.length == null && entered.checked) { radio_choice[0] = entered.value; radio_choice[1] = true; }
else
{
	// Loop from zero to the one minus the number of radio button selections
	for (counter = 0; counter < entered.length; counter++)
	{
	// If a radio button has been selected it will return its value (If not it will return false)
	if (entered[counter].checked) { radio_choice[0] = entered[counter].value; radio_choice[1] = counter; }
	}
}
return radio_choice;
}

function countCheckBox(entered)
{
var count = 0;
if(entered.length == null && entered.checked) return 1;
else { for (var x = 0; x < entered.length; x++) { if (entered[x].checked) count++;	} }
return count;
}

function selectvalidation(entered)
{
// set var radio_choice to false
var select_choice = -1;
// Loop from zero to the one minus the number of radio button selections
for (counter = 0; counter < entered.length; counter++)
{
// If a radio button has been selected it will return true (If not it will return false)
if (entered[counter].selected) select_choice = counter;
}
return select_choice;
}

function dotab() 
{ 
var e = window.event; 
if (e.keyCode == 9) // tab 
{ 
e.srcElement.value = e.srcElement.value + "\t";return false; 
} 
return true; 
}
//-->