function ajaxreqcall(url, fn, queryString) {
	req = false;
    if(window.XMLHttpRequest) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
            	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {	
		req.onreadystatechange = fn;
		req.open('POST', url, true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.send(queryString);
	}
}

function showPage(){
	if(req.readyState != 4) return;
	var c = document.getElementById("content");
	c.innerHTML = req.responseText;
	$("#content").fadeIn('fast');
}

function grabPage(x){
	$("#content").fadeOut('fast');
	var c = document.getElementById("content");
   	var fn = function(){ showPage(); };
//   	alert("ajax.php?what=" + x);
	ajaxreqcall("ajax.php", fn, "what=" + x);
}

$(document).ready(
	function(){  
	    $("#menu li a.parent").hover(
		    function() {
		    	$(this).parent().find("ul").slideDown('fast').show();
				$(this).parent().hover(function() {},
				function(){  
		            $(this).parent().find("ul").fadeOut('fast');
		        }); 
		    }
	    );
/*
		if(location.href.indexOf("#")>-1){
			var workwith = location.href.split("#!/");
			var show = workwith[1];
			grabPage(show);
		} else
			grabPage("home");
*/
	}
); 

