// JavaScript Document
function trim(value) {
   var temp = value;
   var obj = /^(\s*)([\W\w]*)(\b\s*$)/;
   if (obj.test(temp)) { temp = temp.replace(obj, '$2'); }
   var obj = / +/g;
   temp = temp.replace(obj, " ");
   if (temp == " ") { temp = ""; }
   return temp;
}

re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i

function submFormo2o3contact(form1)
{
	strx1 = "";
	ctr = 0;
	if (document.form1.subject.value == "") strx1 = "Subject required.\n"  ;
	if (document.form1.fullname.value == "") strx1 = strx1 + "Full Name required.\n"  ;
	if (document.form1.email.value == "") {
		strx1 = strx1 + "Email required.\n";
	} else  if (re.test(document.form1.email.value) == false)
	{
	strx1 = strx1 + "Invalid E-mail Address\n"  ;
	} 
	if (document.form1.message.value == "") strx1 = strx1 + "Message required.\n"  ;
 
	if (strx1 != ""){
		alert ("Please enter the ff. required field(s):\n\n" + strx1) ;
		return false;
	}
}

function keyPressCD(e,fldFOCUS,form1,cmdcond)
{
	var key = window.event ? e.keyCode : e.which;
 
	switch (cmdcond)
	{
	case 1 : //enter letters  only
		if (key==8 || key ==0 || key==32) {
			return key;
		}
		else if (key ==13)
		{
				document.form1[fldFOCUS].focus();
				document.form1[fldFOCUS].select();
				return false;
		} else if ((key < 65 || key > 90) && (key < 97 || key >122)  )
		{
			return false;
		}
	case 2 : // enter key and tab for select combo box
		 if (key ==13)
		 {
			document.form1[fldFOCUS].focus();
			return false;
		 }
		break;
	case 3 : // enter key and tab for text box
		 if (key ==13)
		 {
			document.form1[fldFOCUS].focus();
			document.form1[fldFOCUS].select();
			return false;
		 }
		break;
	case 4 : // for telephone and fax  
		reg = /^[0-9]*$/;
		if (key==8 || key ==0 ) {
			return key;
		} else if (key ==13)
		{
				document.form1[fldFOCUS].focus();
				document.form1[fldFOCUS].select();
				return false;
		} else {
			if (key < 45 || key > 57 )return !reg.test(key);
		}
		break;
	}
}
