<!-- hiding from older non-JavaScript aware browsers

	// this function clears the value set for the form element passed to it
	// so long as the value is the default text passed in the variable txt.
	function clearme(fe,txt){
		// check to see that the form element is the default text
		if (fe.value == txt){
			// clear the default text
			fe.value = "";
		}
		return;
	}

	// this function sets default text back to the input field if it is 
	// blank after the users focus leaves the field.
	function resetme(fe,txt){
		// check if the form element is empty
		if (fe.value == ""){
			// set the default text
			fe.value = txt;
		}
		return;
	}

	// this function returns a true/false result based on the presence of copy
	// in the form element passed. this is used by two functions checkvalue() 
	// and verify()
	function isblank(fe){
		// check that the value is not empty
		if (fe.value == "") {
			// its blank
			return true;
		} else {
			// it has data
			return false;
		}
	}

	// this takes a form element and checks to see if there is a value assigned 
	// to it. If it comes back as a blank field, the form element will display 
	// the errormessage variable to the user
	function checkvalue(fe, msg) {
		// call the isblank() function with this form element
		if (isblank(fe)){
			// display the error to the user
			alert(msg);
			// set focus on the element we just checked
			fe.focus();
		}
		return;
	}

	// this function is for validating an entire form for blank entries. The
	// error message that is displayed must be short enough to fit in users 
	// windows and get across the idea that there are problems. The benefit
	// of this function is its ease of use, because you simply pass it the 
	// form, a list of required fields and an error message to display. The 
	// function handles all of the logic of submitting the form.
	function verify(frm, fields, IsOptional, msg){

		if (fields==""){

			for (i=0; i<frm.elements.length; i++){
				// loop through each of the required fieldnames
				//ignore hidden fields
				if (frm.elements[i].type!='hidden'){
					if (isblank(frm.elements[i])){
						// display an error
						alert(msg);
						// set the cursor to he field that threw the error
						frm.elements[i].focus();
						// block the form from submitting
						return false;
					} 
				}
			}
		}
		else{
			// get fields marked required
			fieldarray = fields.split(",");
			// loop through all the elements on the form
			if (IsOptional==false){
				for (i=0; i<frm.elements.length; i++){
					// loop through each of the required fieldnames
					for (j=0; j<fieldarray.length; j++){
						// if a field is required (and we're processing that field) and its blank
						if (frm.elements[i].type!='hidden'){
							if (fieldarray[j] == frm.elements[i].name && isblank(frm.elements[i]))
								 {
								// display an error
								alert(msg);
								// set the cursor to he field that threw the error
								frm.elements[i].focus();
								// block the form from submitting
								return false;
							} 
						}
					}
				}
			}
			else{
				for (i=0; i<frm.elements.length; i++){
					// loop through each of the required fieldnames
					flg = false
					for (j=0; j<fieldarray.length; j++){
						// if a field is required (and we're processing that field) and its blank
						if (fieldarray[j] == frm.elements[i].name) {
							flg=true
							break;
						} 
					}
					if (flg==false){
						if (frm.elements[i].type!='hidden'){
							if (isblank(frm.elements[i])) {
							// display an error
								alert(msg);
								// set the cursor to he field that threw the error
								frm.elements[i].focus();
								// block the form from submitting
								return false;
							}
						}
					}
				}			
			}
			
		}
		// exit clean and allow form to submit
		return true;
	}
	
	function isValidEmail(Email)
	{
		var str=Email
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		if (filter.test(str))
			return true;
		else
			return false;
	}

	function compare(Field1,Field2, msg)
	{
		if (Field1 == Field2)
			return true;
		else
		{
			alert(msg)
			return false;
		}
	}

	function setLimit(sContent, iLimit)
	{
		// event.keyCode 8  = Backspace
		// event.keyCode 46  = Delete
		// event.keyCode 37 - 40  = Arrows
		// event.keyCode 33-36  = PageUp, PageDown, Home, End

		//alert(event.keyCode)
		if (event.keyCode==8 || event.keyCode==9 || event.keyCode==46 || (event.keyCode>=37 && event.keyCode<=40))
			return true
		else if (event.keyCode>=33 && event.keyCode<=36)
			return true

		if (sContent.length >= iLimit)
			return false;
		else
			return true;
	}
// stop hiding from older non-JavaScript aware browsers -->
