var $j = jQuery.noConflict();

$j(document).ready(function(){

	//Colorbox
	$j('#colorbox-list a, a[rel="colorbox"]').colorbox();
	
	//Easy Slider
	if($j().easySlider) {
	$j("#banner-images").easySlider({
		auto: true,
		continuous: true 
	});
	}
	
	//primaryNav Dropdowns
	if(typeof $j.hoverIntent == 'function') {
	$j('#primary-nav>li').hoverIntent(primaryNavConfig);
	}	
	
	// clear input on focus
    var currentValue = '';
	$j('#search-input').focus(function(){    
		currentValue = $j(this).val();        
		(!$j(this).attr('title')) ? $j(this).attr('title', currentValue) : '' ;
		if($j(this).val() == $j(this).attr('title')){
			$j(this).val(''); 
		}
	}).blur(function(){
		if($j(this).val()==''){
			$j(this).val($j(this).attr('title'));
			currentValue = '';
		}
	});
	
	//Tabs Stuff (Media Gallery Nav)
	$j("#media-gallery>div").addClass('tab');
	$j('#media-tab-nav li a').click(function($e){
		
		$e.preventDefault();
		
		$j("#media-gallery>div").hide().filter(this.hash).fadeIn();
		$j('#media-tab-nav li a').removeClass('active');
		$j(this).addClass('active');	
		
	}).filter(':first').click();
	
	//Tabs Stuff (Viedo Gallery Nav)
	$j("#videos-wrapper>div").addClass('tab');
	$j('#video-tab-nav li a').click(function($e){
		
		$e.preventDefault();
		
		$j("#videos-wrapper>div").hide().filter(this.hash).fadeIn();
		$j('#video-tab-nav li a').removeClass('active');
		$j(this).addClass('active');	
		
	}).filter(':first').click();
	
	// Initialize Galleriffic Gallery
	/*
var gallery = $j('#thumbs').galleriffic({
		numThumbs:                 10,
		imageContainerSel:         '#slideshow', // The CSS selector for the element within which the main slideshow image should be rendered
		captionContainerSel:       '#caption', // The CSS selector for the element within which the captions should be rendered
		loadingContainerSel:       '#loading', // The CSS selector for the element within which should be shown when an image is loading
		nextPageLinkText:          '&rsaquo;',
		prevPageLinkText:          '&lsaquo;',
		enableHistory:             false,
		syncTransitions: 			true,
		defaultTransitionDuration: 500
	});
*/
/* !Email a Friend Social Button ============================== */
$j(".socialForm").colorbox({width:"35%", height:"85%",iframe:true});
	$j(document).ready(function(){
 	$j("#referer").val(document.referrer);
	});

});

//primaryNav Hover Intent Configuration
var primaryNavConfig = {    
     sensitivity: 10,     
     interval: 100,  
     over: primaryOver,   
     out: primaryOut,
     timeout: 250  
};

function primaryOver(){$j(this).find(">ul").slideDown('fast');  $j(this).addClass("hover"); }
function primaryOut(){$j(this).find(">ul").hide('fast');  $j(this).removeClass("hover"); }

