<!--
window.onload = function(){
	//fix_height();
}
window.onresize = function(){
	//fix_height();
}

function verify_email(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){return false}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) {return false}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) {return false}
	if (str.indexOf(at,(lat+1))!=-1) {return false}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) {return false}
	if (str.indexOf(dot,(lat+2))==-1) {return false}
	if (str.indexOf(" ")!=-1) {return false}
	return true					
	}

function ensureNumeric(strString,mini,maxi)
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;
   if (strString.length < mini | strString.length > maxi) return false;
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }

function check_form(str_form,str_args) {
	var arr_args = str_args.split(",")
	str_error_message = ""
	for(i=0;i<arr_args.length;i++) {
		var arr_this_element = arr_args[i].split("|")
		str_field = arr_this_element[0]
		str_type = arr_this_element[1]
		bln_required = arr_this_element[2]
		str_message = arr_this_element[3]
		this_value = eval("document." + str_form + "." + str_field + ".value")
		this_value = this_value.replace(" ","")
			if (str_type == "t") { //Check String
				if (bln_required==1) {
					if (this_value=='') {str_error_message = str_error_message + str_message + "\n\n"}
				}
			} else if (str_type == "e") { //Check Email
				if (bln_required==1) {
					if (this_value==''||!verify_email(this_value)) {str_error_message = str_error_message + str_message + "\n\n"}
				} else {
					if (this_value!=''&&!verify_email(this_value)) {str_error_message = str_error_message + str_message + "\n\n"}
				}
			} else if (str_type == "n") { //Check Numeric
				if (bln_required==1) {
					if (this_value==''||isNaN(this_value)) {str_error_message = str_error_message + str_message + "\n\n"}
				} else {
					if (this_value!=''&&isNaN(this_value)) {str_error_message = str_error_message + str_message + "\n\n"}
				}
			} else if (str_type == "d") { //Check Date
				if (bln_required==1) {
					if (this_value==''||!verify_date(this_value)) {str_error_message = str_error_message + str_message + "\n\n"}
				} else {
					if (this_value!=''&&!verify_date(this_value)) {str_error_message = str_error_message + str_message + "\n\n"}
				}
			}
		}
		if (str_error_message!="") {
			str_error_message = "Incomplete Form Information!                              \n________________________\n\n" + str_error_message
			alert(str_error_message)
			document.check_form_return = false
		} else {
			document.check_form_return = true
			//eval("document.forms." + str_form + ".submit();")
		}
	}
