var $_GET=Array()
$chunks=window.location.href.split("/");
for($x=0; $x<$chunks.length; $x++){
	if($chunks[$x].search("_")){
		$parts=$chunks[$x].split("_");
		$_GET[$parts[0]]=$parts[1];
	}
}

function amILocal($needle){
	$haystack=window.location.href;
	if($haystack.search($needle)>=0){
		return true;
	} else {
		return false;
	}
}

if(amILocal(LOCAL_HOST)){
	ROOT="http://"+LOCAL_HOST+"/"+LOCAL_FOLDER+"/";
	AJAXURLstop=LOCAL_FOLDER;
} else {
	ROOT="http://"+LIVE_URL+"/";
	AJAXURLstop=LIVE_URL;
}

function createCookie(name,value,days) {
	if(days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

URLparts=window.location.href.split("/");
addParts=true;
AJAXlink="";
for(i=URLparts.length-2; i>0; i--){
	if(URLparts[i]==AJAXURLstop){
		addParts=false;
	}
	if(addParts){
		AJAXlink+="../";
	}
}
AJAXlink+="ajax/";


window.addEvent("domready", function(){
    if($_GET['page']!="views"){
        $("viewsmenu").setStyle("display", "none");
        $("gardenviews").onmouseover=function(){
            $("viewsmenu").setStyle("display", "block");
        }
        $("gardenviews").onmouseout=function(){
            $("viewsmenu").setStyle("display", "none");
        }
    }
	/*
    $$("form.validate")[0].onsubmit=function(){
		dontsend=0;
		$$("form.validate .required").each(function(element){
			if(element.value==""){
				element.fader=new Fx.Styles(element);
				element.fader.start({
					backgroundColor:"#FFCCCC"
				});
				dontsend=1;
			} else {
				element.fader=new Fx.Styles(element);
				element.fader.start({
					backgroundColor:"#FFFFFF"
				});
			}
		});
		if(dontsend==1){
			return false;
		} else {
			return true;
		}
	}
    */

});