function validateSimpleSearch() {
	with( document.productsearchform ) {
		if( document.getElementById( "posted_data[substring]" ) ) {
			var el = document.getElementById( "posted_data[substring]" );			
			if(isWhitespace(el.value, "Please enter search criteria")) {
				el.focus();
				return false;			
			}				

		}
		return true;
	}
}

/**************************************************
**************************************************/				
function isWhitespace (s, msg) {
	var i;
	// whitespace characters
	var whitespace = " \t\n\r";
			
	// Is s empty?
	if (isEmpty(s)) {
		alert(msg); 
		return true;
	}
				
	// Search through string's characters one by one
	// until we find a non-whitespace character.
	// When we do, return false; if we don't, return true.
				
	for (i = 0; i < s.length; i++) {
    	// Check that current character isn't whitespace.
		var c = s.charAt(i);
		if (whitespace.indexOf(c) == -1) return false;
	}
				
	// All characters are whitespace.
	alert(msg);
	return true;
}	


/**************************************************
**************************************************/										
	function isEmpty(s) {   
		return ((s == null) || (s.length == 0));
	}
	
/**************************************************
**************************************************/										
function valEmail(el) {
	var invalidChars = " /:,;";
 	if (el.value == "") {
   		alert("Please enter a Email Address.");
		el.focus();
		return (true);
	}
	for (i=0; i<invalidChars.length; i++) {
		badChar = invalidChars.charAt(i);
    	if (el.value.indexOf(badChar,0) != -1) {
		   	alert("The Email Address contains an invalid character, please correct it.");
			el.focus();
			return (true);
	    }
	}
	atPos = el.value.indexOf("@",1);
	if (atPos == -1) {
	   	alert("The Email Address must contain an @ character.");
		el.focus();
		return (true);
	}
	if (el.value.indexOf("@",atPos+1) != -1) {
	   	alert("The Email Address must have letters before the @ character.");
		el.focus();
		return (true);
	}
	periodPos = el.value.indexOf(".",atPos);
	if (periodPos == -1) {
	   	alert("The Email Address must contain a . character.");
		el.focus();
		return (true);
	}
	if (periodPos+3 > el.value.length) {
	   	alert("The Email Address must have letters after the . character.");
		el.focus();
		return (true);
	}
	return (false);
}

/**************************************************
**************************************************/		
function launchwin(winurl,winname,winfeatures){
	newwin=window.open([winurl],[winname],[winfeatures]);
	if(newwin.focus) setTimeout('newwin.focus();',150);
}	