// JavaScript Document
$(document).ready(function() {
						   
	$("#menu ul li a").hover(
		function () {
			//alert($(this).parent().parent().attr("class"));
			if ($(this).parent().parent().attr("class").length > 0) {
				if ($(this).prev().attr("class") != 'left_active') {
					$(this).prev().attr("class","left_hover");
					$(this).next().attr("class","right_hover");
				}
			}
		}, 
		function () {
			if ($(this).parent().parent().attr("class").length > 0) {
				if ($(this).next().attr("class") != 'right_active') {
					$(this).prev().attr("class","left");
					$(this).next().attr("class","right");
				}
			}
		}
	);
	$("#menu li a").each(function() { 	
		if ($(this).parent().parent().attr("class").length > 0) {
			$(this).before('<span class="left"></span>');
			$(this).after('<span class="right"></span>');
		}
	});
	$("#menu li.active a").each(function() { 
		if ($(this).parent().parent().attr("class").length > 0) {
			$(this).prev().attr("class","left_active");
			$(this).attr("id","active_menu");
			$(this).next().attr("class","right_active");
		}
	});
	$("#feeds ul li:last").attr("class","twee");


	$('#header2').css( {backgroundPosition: "0 0"} );	
	function slidershit() {
		
		setTimeout(function(){
			$('#header').css( {backgroundPosition: "0 -301px"} );
			$('#header2').fadeTo(4500, 0.0);
		},4000);
		
		setTimeout(function(){
			$('#header2').css( {backgroundPosition: "0 -602px"} );
			$('#header2').fadeTo(4500, 1.0);
		},12000);
		
		setTimeout(function(){
			$('#header').css( {backgroundPosition: "0 -903px"} );
			$('#header2').fadeTo(4000, 0.0);
		},20000);
		
		setTimeout(function(){
			$('#header2').css( {backgroundPosition: "0 -1204px"} );
			$('#header2').fadeTo(4000, 1.0);
		},28000);
		
		setTimeout(function(){
			$('#header').css( {backgroundPosition: "0 0px"} );
			$('#header2').fadeTo(4000, 0.0);
		},36000);
	}
	
	slidershit();
	setInterval(function(){
		$('#header2').css( {backgroundPosition: "0 0"} );
		slidershit();
	}, 40000); 

	$("span.error").each(function() {
		if ($(this).text() != "") { 
			$(this).prev().attr("class","error");	
		}
	});
});

