// JavaScript Document
$(document).ready(function(){
	
	
	var config = {    
    	over: function(){
			$(this).children('div.dropdownDiv').show();
			$(this).children('div.dropdownDiv').css("z-index", "9999");
			//$(this).children('div.dropdownDiv').css("left", $(this).outerWidth() - 2);
		},
     	timeout: 200,
		out: function(){
			$(this).children('div.dropdownDiv').css("z-index", "0");
			$(this).children('div.dropdownDiv').hide();
		}
	};
	
	$(".dropdown").hoverIntent(config);
	
	$("ul#nav li").hover(function(){
		$(this).addClass("hover");
	}, function(){
		$(this).removeClass("hover");
	});
	
	$("#searchQ").click(function(event){
		$(this).addClass("active");
		if($(this).val() == 'Google Search'){
			$(this).val("");
		}
	});
	
	$("#searchQ").focusout(function(){
		$(this).removeClass("active");
		if($(this).val().length < "1"){
			$(this).val("Google Search");
		}
	});
	
	
	$("#logo").hover(function(){
		$(this).addClass("hover");
		$(this).children().addClass("hover");
		$(this).children().children().addClass("hover");
	}, function(){
		$(this).removeClass("hover");
		$(this).children().removeClass("hover");
		$(this).children().children().removeClass("hover");
	});
	
	$('a.backtop').click(function(event){
		$('html,body').animate({
			scrollTop: '0'
		}, 2000);
	});
	
	$.get("/system/ping.php?r=" + Math.random());

});
