var $j = jQuery.noConflict();

$j(document).ready(function(){
	function makeTall() {
		$j(this).find('ul').stop().fadeTo(200, 1).slideDown('fast');
		$j(this).find('a').addClass('hover');

	}
	function makeShort() {
		$j(this).find('ul').stop().fadeTo(300, 0, function(){
			$j(this).hide();
		});
		$j(this).find('a').removeClass('hover');
	}
	var config = {    
	     sensitivity: 4, // number = sensitivity threshold (must be 1 or higher)    
	     interval: 50, // number = milliseconds for onMouseOver polling interval    
	     over: makeTall, // function = onMouseOver callback (REQUIRED)    
	     timeout: 500, // number = milliseconds delay before onMouseOut    
	     out: makeShort // function = onMouseOut callback (REQUIRED)     
	};
	//Primary Nav Dropdown
	$j('ul#primary-nav li, body.ls ul#primary-nav li').hoverIntent( config );
	
	//Additional Tech Data Expandable
	$j('p#tech-data-btn,#tech-data').click(function () {
    	if ($j('#tech-data').is(':hidden')) {
        	$j('#tech-data').slideDown('slow');
        	$j('p#tech-data-btn').addClass('deactivate');
    	} else {
        	$j('#tech-data').slideUp('slow');
        	$j('p#tech-data-btn').removeClass('deactivate');
      	}
    });
    
    //Style Search Results
    $j('.ajaxSearch_result:odd').css('background','#FFF');
    $j('.ajaxSearch_result:even').css('background','#EEE');


 	$j("#banner-home").jCarouselLite({
 		btnNext: "#nextBtn",
        btnPrev: "#prevBtn",
 		auto: 3000,
 		speed: 600,
 		visible: 1
 	});

	$j('.close').click(function(){
		$j(this).parent().slideUp('fast');
	});

	//videos
	currentVideo = 0;
	$j('#video-thumbs p a').click(function(e){
		e.preventDefault();
		
		if(currentVideo != 0 && currentVideo != $j(this).attr('href')){
			$j('#video-full').find('#'+currentVideo).slideUp('fast');
		}		
		
		currentVideo = $j(this).attr('href');
		$j('#video-full').find('#'+currentVideo).slideToggle('fast');
		return false;
	});


	//translations
	$j(".tl").click(function(){
		$j("#translations").slideToggle('fast');
		return false;
	});
	$j("#translations").hover(function(){}, function(){
		$j(this).slideUp('fast');

	}); 
	/*$j("#subForm").submit(function(){
		$.ajax({
			type: "POST",
			url: "http://topspot.createsend.com/t/y/s/ouultu/",
			data: $j("#subForm").serialize(),
			success: function(){
				window.location = "http://www.mascoat.com";
			}
		});
	});*/  
});
