
		//This will work if the form name is "Form1"
		// Routine when user entered invalid input
		function Invalid( form, control, msg ) {
				alert( "Please enter " + msg + "." ) ;
				form.item( control ).focus() ;
				window.event.returnValue = false ;
				return ;
		} // Invalid()

		function Trim( strValue ) {
		/************************************************
		DESCRIPTION: Removes leading and trailing spaces.
		PARAMETERS: Source string from which spaces will be removed;
		RETURNS: Source string with whitespaces removed.
		*************************************************/ 
			var objRegExp = /^(\s*)$/;

			//check for all spaces
			if(objRegExp.test(strValue)) {
			strValue = strValue.replace(objRegExp, '');
			if( strValue.length == 0)
				return strValue;
			}
		    
			//check for leading & trailing spaces
			objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
			if(objRegExp.test(strValue)) {
				//remove leading and trailing whitespace characters
				strValue = strValue.replace(objRegExp, '$2');
				}
			return strValue;
		} // trim()

		function ChkEmail( strValue) {
		/************************************************
		REMARKS: Accounts for email with country appended
		does not validate that email contains valid URL
		type (.com, .gov, etc.) and optionally,
		a valid country suffix.  Since email has many
		forms this expression only tests for near valid
		address.  Some additional validation may be
		required.
		*************************************************/
		var objRegExp  = /^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-\.]*)(\.[a-z]{2,3}(\.[a-z]{2}){0,2})$/i;
		//check for valid email
		return objRegExp.test(strValue);
		}
						

		var isIE = document.all?true:false;
		var isNS = document.layers?true:false;
		
		/************************************************
		Accept digits 0-9 only		  
		*************************************************/
		function DigitsOnly(e) {
			var w_ret = true;
			if (isIE) {
				if (window.event.keyCode < 47 || window.event.keyCode > 57) {
					window.event.keyCode = 0;
					w_ret = false;
				}
			}
			if (isNS) {
				if (e.which < 47 || e.which > 57) {
					e.which = 0;
					w_ret = false;
				}
			}
			return (w_ret); 
		} // DigitsOnly
		/************************************************
		Accept digits 0-9 and - only		  
		*************************************************/
		function DigitsPoint(e) {
			var w_ret = true;
			if (isIE) {
				if ( (window.event.keyCode < 47 || window.event.keyCode > 57) && window.event.keyCode != 46 ) {
					window.event.keyCode = 0;
					w_ret = false;
				}
			}
			if (isNS) {
				if ( (e.which < 47 || e.which > 57) && e.which != 46 ) {
					e.which = 0;
					w_ret = false;
				}
			}
			return (w_ret); 
		} // DigitsDashOnly

		function DigitsDash(e) {
			var w_ret = true;
			if (isIE) {
				if ( (window.event.keyCode < 47 || window.event.keyCode > 57) && window.event.keyCode != 45 ) {
					window.event.keyCode = 0;
					w_ret = false;
				}
			}
			if (isNS) {
				if ( (e.which < 47 || e.which > 57) && e.which != 45 ) {
					e.which = 0;
					w_ret = false;
				}
			}
			return (w_ret); 
		} // DigitsOnly

		/************************************************
		Prevent wb-crawlers to get email that they use on spamming		  
		*************************************************/
		function generate_EAddr( username, domain ) {
			var atsign = "&#64;";
			var addr = username + atsign + domain ;
			
			document.write( 
				"<" + "A " + "href=" + "'mailto:" + addr + "'>" +
				addr +
				"</A>" );
		}

		/************************************************
		Show and Hide Div Layers		  
		*************************************************/
        function toggleLayer( whichLayer ){
            var elem, vis;
            if( document.getElementById ) // this is the way the standards work
                elem = document.getElementById( whichLayer );
            else if( document.all ) // this is the way old msie versions work
                elem = document.all[whichLayer];
            else if( document.layers ) // this is the way nn4 works
                elem = document.layers[whichLayer];
                            
            vis = elem.style;  
             // if the style.display value is blank we try to figure it out here
            if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
                vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
                 
            vis.display = (vis.display==''||vis.display=='block')?'none':'block';
        }        	