var $j = jQuery.noConflict();

$j(document).ready(function(){
    
    //primaryNav Dropdowns
	$j('#primary-nav>li').hoverIntent(primaryNavConfig);
	
	// clear input on focus
    var currentValue = '';
	$j('#ajaxSearch_input input[type="text"], #quick-contact input[type="text"], #quick-contact textarea, #contact input[type="text"], #contact textarea').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 = '';
		}
	});
	
	// Home Banner
	$j("#banner").cycle({
        	fx: "fade",
        	prev: '#prev', 
        	next: '#next',
        	speed: 1000,
        	timeout: 6000
    	});

	// Gallery
	Galleria.loadTheme('/js/galleria/themes/classic/galleria.classic.min.js');
    	$j("#gallery").galleria({
        	width: 940,
            height: 740
         });
         
    // Fancy Box     
	$j("a.group").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'titlePosition' : 'over',
		'overlayShow'	:	false
	});
		
});

//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"); }

