$(function(){
	function MoveArrow(to){
		var q = to.position();
		//q.left += (eval(to.css('width').replace('px',''))/2);
		q.left+=20;
		$('#arrow').stop().animate({'left' : q.left+'px'},500+$(this).index()*100);

		
		
	}
	
var d = $('#menu li.cur');
if(d.length == 1)	
MoveArrow(d);	
$('#menu li').hover(function(){
MoveArrow($(this));
},
function(){
	
	MoveArrow(d);
	
}
);
	$('#fade').bind('fade-cycle', function() {
    $(this).animate({'opacity' : .2},1000, function() {
        $(this).animate({'opacity' : 1},1000, function() {
            $(this).trigger('fade-cycle');
        });
    });
});

setTimeout(function() {
        $('#fade').trigger('fade-cycle');
    }, 1000);


});


function KillSession(){
	var xmlhttp;
	if (window.XMLHttpRequest)		xmlhttp=new XMLHttpRequest();
	else													xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	xmlhttp.onreadystatechange=function(){
		//if(xmlhttp.readyState==4 && xmlhttp.status==200)
			//document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
		xmlhttp.open("GET","/_ajax/logout.php",true);
		xmlhttp.send();
	}
} 
