var isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
var NS4 = (document.layers) ? true : false;
var IEmac = ((document.all)&&(isMac)) ? true : false;
var IE4plus = (document.all) ? true : false;
var IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
var IE5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true : false;
var IE6 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 6.")!=-1)) ? true : false;
var ver4 = (NS4 || IE4plus) ? true : false;
var NS6 = (!document.layers) && (navigator.userAgent.indexOf('Netscape')!=-1)?true:false;

var IE5plus = IE5 || IE6;
var IEMajor = 0;

function changeCursor(elm){
	if(NS6 || IE4plus){
		var cursor=(IE5||IE4)?"hand":"pointer";
		elm.style.cursor=cursor;
	}
}

function changeNav(elm,cl){
	if(NS6 || IE4plus){
		elm.style.backgroundColor=cl;
		if (IE4){
			elm.children[0].style.backgroundColor=cl;
		} else {
			elm.childNodes[0].style.backgroundColor=cl;
		}
		var cursor=(IE5||IE4)?"hand":"pointer";
		elm.style.cursor=cursor;
	}
}

var excluded=['and','about','or'];

function validateForm(f){
	var cleanQuery=f.query.value;

	for(var i=0;i<excluded.length;i++){
		cleanQuery=eval('cleanQuery.replace(/^'+excluded[i]+' /gi,"")');
		cleanQuery=eval('cleanQuery.replace(/ '+excluded[i]+'$/gi,"")');
		cleanQuery=eval('cleanQuery.replace(/ '+excluded[i]+' /gi," ")');
	}

	// Trim spaces from start and end of query
	cleanQuery = cleanQuery.replace(/^\s*|\s*$/g,"");
	
	if( cleanQuery.length == 0 ){
		alert("Please enter search text."+cleanQuery);
		return false;
	}

	f.query.value=cleanQuery;
	return true;
}

function changeLoc(l){
	if(IE4){
		location=l.children[0];
	} else {
		location=l.childNodes[0];
	}
}
