// JavaScript Document
function validate_required(field,alerttxt)
{
	with (field) {
		if (value==null||value==""||value==0) {
			alert(alerttxt);
			return false;
		} else {
			return true;
		}
	}
}

function setCookie(c_name,value,expiredays)
{
	var exdate=new Date()
	exdate.setDate(exdate.getDate()+expiredays)
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : "; expires="+exdate.toGMTString())
	//alert("setting cookie for "+value);
}

function validateAndSetCookie(thisform)
{
	//category = document.getElementById('catselector').selectedIndex;
	
	alert('you must pic a category to search!');
	
	theForm=document.form1;
	with (thisform) {
		if (validate_required(query,"Please enter criteria for query.")==false) {
			query.focus();
		    return false;
		}
		if (validate_required(location,"Please enter location.")==false) {
			location.focus();
		    return false;
		}
		
		if (document.getElementById('catselector').selectedIndex < 2){
			alert('you must pic a category to search!')
			return false;
		}
	}
	
	setCookie('clfLocation',theForm.location.value,365)

}