function activatePaginiationLinks() {
	if ($("table.pagination a").length>0) {
		// hover:
		$("table.pagination a").hover(
			function(){$(this).addClass("ui-state-hover");},
			function(){$(this).removeClass("ui-state-hover");}
		);
		// ajax load:
		$("table.pagination a").click(function(){
			var sURL = $(this).attr('href')+" .listing > *"; //alert(sURL);
			if ($(this).parents(".listing:first").length>0) {
				// show loader:
				$("table.pagination td.loader span").addClass("loader");
				$(this).parents(".listing:first").load(sURL,function(){
					activatePaginiationLinks(); //alert("! :)");
				});
				return false;
			}
		});
	}
}
// top menu set current/active:
function topMenuSetActive() {
	var sCurrentHref = $(location).attr('href'); //alert(sCurrentHref);
	$("#header_main_menu li a").each(function(){
		if ($(this).attr('href')==sCurrentHref) {
			$(this).parents("li:first").addClass("active");
			// parent too:
			if ($(this).parents("li:first").parents("li:first").length>0) {
				$(this).parents("li:first").parents("li:first").addClass("active");
			}
		}
	});
}
$(function(){
	topMenuSetActive();
	// top menu drop-down:
	$("#header_main_menu li").hover(
		function(){
			$(this).addClass("active");
			$(this).find(".submenu").slideDown(200);
		},
		function(){
			$(this).removeClass("active");
			$(this).find(".submenu").fadeOut(400);
			topMenuSetActive();
		}
	);
	// init pagination :)
	activatePaginiationLinks();
	// h1 home effect:
	$("h1 a:first").hover(
		function(){
			$(".header-brand-container span.home").fadeIn(200);
		},
		function(){
			$(".header-brand-container span.home").fadeOut(200);
		}
	);
});

