$jq = jQuery.noConflict();


$jq(document).ready(function() {

	/*
	* SLIDE IN MENU ITEMS


	var position = (($jq(".body").width() - 960) / 2) +230;
	$jq(".categoryList li").css("position","relative");
	$jq(".categoryList li").css("left","-"+position+"px");
	$jq(".categoryList li").css("opacity","0");
	$jq(".categoryList li").each(function(catIndex){
		setTimeout(
			function(){
				$jq(".categoryList li:eq("+catIndex+")").animate({left:"0px",opacity:1},800)
			}
		, catIndex*100);
	});

		*/


	/*
	* MENU ITEMS HOCER EFFECT


	$jq(".categoryList li a").mouseenter(function(){
		$jq(this).animate({
			paddingLeft:"10px"
		},300);
	});

	$jq(".categoryList li a").mouseleave(function(){
		$jq(this).animate({
			paddingLeft:"0px"
		},300);
	});

	*/
	$jq(".categoryList li:not(.active) ul").hide();

	var config = {
	     sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)
	     interval: 200, // number = milliseconds for onMouseOver polling interval
	     over: function(){
			if(!$jq(this).hasClass("active")){
				$jq(this).parent().find(".active ul").slideUp();
				//$jq(".categoryList .active ul").slideUp();
				$jq(this).parent().find("li").removeClass("active");
				$jq(this).children("ul").slideDown();
				$jq(this).addClass("active");
			}
		}, // function = onMouseOver callback (REQUIRED)
	     timeout: 500, // number = milliseconds delay before onMouseOut
	     out: function(){} // function = onMouseOut callback (REQUIRED)
	};


	$jq(".categoryList li.parent").hoverIntent(config);


	/*
	* BODY BACKGROUND


		$jq(window).resize(function(){
			if($jq(".body") && $jq(".body").width() > 1160 && $jq(".body").height() > 660){

				var position = ($jq(".body").width() - 960) / 2;
				position += 992;
				$jq(".body").css("background-image","url("+BODY_BG_IMG+")");
				$jq(".body").css("background-position",position+"px bottom");
				$jq(".body").css("background-repeat","no-repeat");
			}else if($jq(".body")){
				$jq(".body").css("background-image","none");
			}
		});

		$jq(window).trigger("resize");
	*/
	/*
	* FEATURE CYCLE
	*/

		if( $jq(".feature") ){

			$jq(".featureLeft,.featureRight").css("opacity","0.4");

			$jq(".featureLeft,.featureRight").mouseenter(function(){
				$jq(this).animate({
					opacity: 0.6
				},500);
			});

			$jq(".featureLeft,.featureRight").mouseleave(function(){
				$jq(this).animate({
					opacity: 0.4
				},500	);
			});

			$jq('.feature ul').cycle({
	            fx: 'scrollHorz',
	            startingSlide: 0,  // start on the slide that was in the markup
	            timeout:  8000,
	            speed:    1500,
	            prev:    '.featureLeft',
	            next:    '.featureRight'
	        });

		}



	/*
	* NAV BAR
	*/

	if($jq(".topNav ul")){

		$jq(".topNav ul li").mouseenter(function(){
			$jq(this).find("img").animate({
				opacity: 0.4
			});
		});

		$jq(".topNav ul li").mouseleave(function(){
			$jq(this).find("img").animate({
				opacity: 1
			});
		});
	}

	/*
	* SEARCH BOX
	*/

	if($jq('.header .searchBox')){

		$jq('.header .searchBox .searchSubmit').animate({
				width: "0px"
			},1);

		$jq('.header .searchBox .searchText').focus(function(){
			if($jq(this).val() == "product search"){
				$jq(this).val("")
			}
			$jq('.header .searchBox .searchSubmit').animate({
				width: "32px"
			},500);
		});

		$jq('.header .searchBox .searchText').blur(function(){
			$jq('.header .searchBox .searchSubmit').animate({
				width: "0px"
			},500);
		});

	}

	/*
	* FORM STYLE
	*/

	$jq(".body").jqTransform();

});