
function trim(theString){
	while(theString.substr(0,1)==" ")
		theString=theString.substr(1);

	while(theString.substr(theString.length-1,1)==" ")
		theString=theString.substr(0,theString.length-1);

	return theString;
}

function chkAll(theForm){

	var msg="";
	var j=0;
	var blnCatChecked=true;
	var qry=theForm.query.value=trim(theForm.query.value);
	var srchCat=theForm.sc;

	if(srchCat.length>1){
		blnCatChecked=false;
		for(i=0;i<srchCat.length;i++){
			if(srchCat[i].checked){
				blnCatChecked=true;
				break;
			}
		}
	}

	msg+=qry==""?(++j)+". Please input the keywords.\n":"";
	msg+=blnCatChecked?"":(++j)+". Please select the categories which should be included.\n";

	if(msg!=""){
		alert(msg);
		return false;
	}
}

