
// -- CUSTOM FUNCTIONS AND EFFECTS --

// -- NO CONFLICT MODE

var $s = jQuery.noConflict();

$s(document).ready(function(){
								
	// -- HIDE IMAGES BEFORE LOADING
	
	$s(".port2_img, .port4_img, .port_ls_img, .cycle_slider li, #nivo_slider li").addClass('preload').find('img').hide();								
	
	
	// -- NAVIGATION MENU
	
	$s('.nav1 ul').css({display: "none"});
	$s('.nav1 li').hover(function(){	
		$s(this).find('ul:first').css({visibility: "visible",display: "none"}).fadeIn(200);
	},
	function(){
		$s(this).find('ul:first').css({visibility: "visible",display: "none"});
	});			
	
	
	// -- ACCORDION
	
	$s('h5.handle').click(function() {
		$s(this).next().toggle('fast');
		$s(this).toggleClass("activehandle");
		return false;
	}).next().hide();
	
	
	// -- TOGGLE
	
	$s('h5.toggle').click(function() {
		$s(this).next().toggle('fast');
		$s(this).toggleClass("activetoggle");
		return false;
	}).next().hide();	
	
	
	// -- PRETTYPHOTO INIT
	
	$s("a[rel^='prettyPhoto[group1]'], a[rel^='prettyPhoto[group2]']").prettyPhoto({theme:'light_square', showTitle:false, opacity:0.6})


	// -- TOP OF PAGE
	
	$s('.top').click(function(){ 
		$s('html, body').animate({scrollTop:0}, 500 ); 
		return false; 
	});
	
	
	// -- Custom Slide Show
	
	$s("#slideshow").css("overflow", "hidden");
	
	$s("ul#slides").cycle({
		fx: 'fade',
		pause: 1,
		prev: '#prev',
		next: '#next'
	});
	
	$s("#slideshow").hover(function() {
    	$s("ul#nav").fadeIn();
  	},
  		function() {
    	$s("ul#nav").fadeOut();
  	});	

	
}) // END DOCUMENT.READY

$s(window).load( function() {
	
	// -- SHOW IMAGES ON LOAD
	
	$s(".port2_img, .port4_img, .port_ls_img, .cycle_slider li, #nivo_slider li").removeClass('preload').find('img').fadeIn();
	
	// -- CYCLE SLIDER INIT
	
	$s('.cycle_slider').cycle({ 
		fx:     'fade', 
		speed:  400, 
		timeout: 4000, 
		next: '.next',  
		prev: '.prev',
		pause: 1,
		cleartype: true,
		pager:  '.cycle_nav', 
		pagerAnchorBuilder: function(idx, slide) { 
			return '<li><a href="#"></a></li>'; 
		} 
	});
	
	
	// -- SHOW/HIDE SLIDER CONTROLS
	
	$s('.show_desc').fadeIn();
	$s('.slider').hover(function(){
		$s('.controls').show();
	}, function() {
		$s('.controls').hide();
	});
	
	$s('.controls a.prev').hover(function(){
		$s('.controls a.next').fadeOut(300);
	}, function() {
		$s('.controls a.next').fadeIn(300);
	});	
	
	$s('.controls a.next').hover(function(){
		$s('.controls a.prev').fadeOut(300);
	}, function() {
		$s('.controls a.prev').fadeIn(300);
	});	
})
