$(document).ready(function(){
  		

    	//$('#tabs').tabs({ event: 'mouseover' });
		
		$("#search")
		    .val("Search...")
		    .css("color", "#999")
		    .focus(function(){
		        $(this).css("color", "black");
		        if ($(this).val() == "Search...") {
		            $(this).val("");
		        }
		    })
		    .blur(function(){
		        $(this).css("color", "#999");
		        if ($(this).val() == "") {
		            $(this).val("Search...");
		        }
		    });
		
		$('.reviewTab').click(function() {
			$('#tabs2').tabs('select', 4); 
    		return false;
		});
    	
    	$('#tabs2').tabs({
   			show: function(event, ui) { 
   				var myBorder = RUZEE.ShadedBorder.create({ corner:7, shadow:15, border:1 });
   				myBorder.render($('.rounded'));
   			}
		});
    	    	
    	var myBorder = RUZEE.ShadedBorder.create({ corner:7, shadow:15, border:1 });
   		myBorder.render($('.rounded'));
    	
    	$('.static-star').rating();
    	
    	var onMenu = 0;
    	var onTab = 0;
    	var overlayOn = 0;
    	var currentX = 0;
    	var menName = "";
    
    	
    	// HIDE all menus
    	function hideAll() {
    		$(".menu").hide();
    		
    		$('.n2').each(function(){
     			$(this).children().stop().animate({"opacity":0.0});
    		});

    	};
    	  
    	
    	$(".n2").hover(
    		function() {
	    		var menuName = $(this).children().attr("id");
    			hideAll();
				onMenu=1;
     			onTab=1;
     			$(this).children().stop().animate({"opacity":1.0},500);
     			$("#menu-"+menuName).stop().show().css({"opacity":1.0});
    		},
    		function() {
    			menName = $(this).attr("id");
    			function decide() {
				
					if (onMenu == 0) {
						$(".menu").fadeOut(150);
						$("#"+menName).children().stop().animate({"opacity":0.0});
						onTab=0;
					}	
				}
				onMenu=0;
				setTimeout(decide,300);
			
    			
    		}
    	);
    	    	
    	
    	
    	// MENU HOVER
    	$(".menu").each(
    		function() {
    			var menuName = $(this).attr("id");
    			$("#"+menuName).hover(
     				function () {
     					$(this).animate({"opacity":1.0},50,function() {
     						onMenu=1;
     					});
     					onMenu = 1;
     					
     				}, 
      				function () {
      					onMenu = 0;
      					onTab = 0;
      					var menuName2 = (menuName).split("-",2);
      					function decide() {
      						if (onTab==0) {
      							hideAll();
      							$("#"+menuName).fadeOut(150);
      						}
      					}
      					setTimeout(decide,300);
      				}
    			);
    		}
    	);
    	
    	
    	// HIGHLIGHTING STUFF
    	function hoverOff() {
    		$(".menu li").removeClass('navOver');
    		$(".menu h3").removeClass('navOver');
    		onMenu = 1;
    	};
    	
    	$(".menu SPAN").hover(
    		function() {
    			onMenu=1;
    		},
    		function() {
    			onMenu=1;
    		}
    	);
    	
    	
    	$(".maincats li").hoverIntent(
    		function() {
    			$cat = ($(this).attr('id')).split("-");
    			$(".set").hide();
       			$("#set-"+$cat[1]).show();
    			
    		},
    		function() {
    			
    		}
    	);
    	
    	$(".listit").hoverIntent(
    		function() {
    			
    			$cat = ($(this).attr('id')).split("-");
    			$(".list").hide();
    			$("#list-"+$cat[1]).show();
    		},
    		function() {
    			
    		}
    	);
    	
    	
    	$(".menu  li").hover(
    		function() {
    			hoverOff();
    			$(this).addClass('navOver');
    			//alert($(this).attr("id"));
    			
    			//$("#overDesc").html($("."+$(this).attr("id")).html());
    			onMenu=1;
    		},
    		function() {
    			hoverOff();
    			onMenu=1;
    		}
    	);
    	
    	
    	$(".menu h3").hover(
    		function() {
    			hoverOff();
    			//$(this).addClass('navOver');
    			//$("#overDesc").html($("."+$(this).attr("id")).html());
    			onMenu=1;
    		},
    		function() {
    			hoverOff();
    			onMenu=1;
    		}
    	);
    	
    	
    	// GO WHEN CLICKED
    	$(".menu li").click(function() {
    		window.location=$(this).find("a").attr("href"); return false;
		});
		
		$(".rounded IMG").each(function() {
			$(this).clone().removeAttr("width").attr("width");
			$(this).clone().removeAttr("height").attr("height");
		});
				
  	});
