// JavaScript Document



$(document).ready(function(){
	
	bgChange("h2.about a", "hover");
	bgChange("h2.products a", "hover");
	
	function bgChange(target, newClass)
	{
		$(target).append("<div class='"+newClass+"'></div>");
		$(target+' .'+newClass).css('opacity', 0); 
		$(target+' .'+newClass).parent().hover(
		function() { 
			$(target+' .'+newClass).stop().animate({opacity: '1'},500);
		}, 
		function() { 
			$(target+' .'+newClass).stop().animate({ opacity: '0'},600);
		});
	}
	
	
	$("#pageTemp").hide();


	// Get URL


	if($("#PJ_Lists").length > 0)
	{
		
		$(".pageButton ul li a").click(
				function(){
					i = $(this).parents("li").index();
					$(".pageButton ul li").removeClass("current");
					$(".pageButton ul li:eq("+i+")").addClass("current");
					$("#PJ_Lists > div.Section").hide();
					$("#PJ_Lists > div.Section:eq("+i+")").show();
					return false;
				}	  
		);
		
		var args = location.href.split('#');
		
		//alert($.isArray(args).length > 0);
		if($.isArray(args))
		{
			if(args.length > 1 && args[1] != "top"){
				var s = args[1].match(/\d+\b/)-1;
				$(".pageButton ul li").removeClass("current");
				$(".pageButton ul li:eq("+s+")").addClass("current");
				$("#PJ_Lists > div.Section").hide();
				$("#PJ_Lists > div.Section:eq("+s+")").show();
			}else{
				$("#PJ_Lists > div.Section").hide();
				$("#PJ_Lists > div.Section:eq(0)").show();
			}
		}
	}
	


// Go back top Animation
	$(function () {
		// scroll body to 0px on click
		$('.PageTop a').click(function () {
			$('body,html').animate({
				scrollTop: 0
			}, 800);
			return false;
		});
	});
	
});


// JavaScript Document



