
// -- CUSTOM FUNCTIONS AND EFFECTS --

// -- NO CONFLICT MODE

var $s = jQuery.noConflict();

$s(document).ready(function(){

	// Custom SSOE Fonts
	// Cufon.replace('h1'); // Works without a selector engine
	// Cufon.replace('h2'); // Works without a selector engine
	// Cufon.replace('.sidebar h5'); // Works without a selector engine
	// Cufon.replace('.nav1'); // Requires a selector engine for IE 6-7, see above
	// Cufon.replace('.sidebar .menu'); // Requires a selector engine for IE 6-7, see above
	// Cufon.replace('#crumbs'); // Requires a selector engine for IE 6-7, see above
								
	// -- 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; 
	});
	
	// -- BROCHURE filter 
	$s('ul#filter a').click(function() {
			$s(this).css('outline','none');
			$s('ul#filter .current').removeClass('current');
			$s(this).parent().addClass('current');
			
			var filterVal = $s(this).text().replace(' ','-');
					
			if(filterVal == 'all') {
				$s('ul#brochure-gallery li.hidden').fadeIn('slow').removeClass('hidden');
			} else {
				
				$s('ul#brochure-gallery li').each(function() {
					if(!$s(this).hasClass(filterVal)) {
						$s(this).fadeOut('normal').addClass('hidden');
					} else {
						$s(this).fadeIn('slow').removeClass('hidden');
					}
				});
			}
			
			return false;
		});
	
}) // 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>'; 
		} 
		
		
			
	});
	// footer social icons hover
	$s('.social-footer img.social').css('opacity', 0);
	$s('.social-footer a').hover(function(){
		$s('img', this).stop().animate({opacity: 1}, 200);
	}, function(){
		$s('img', this).stop().animate({opacity: 0}, 200);
	});
	
	// -- 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);
	});	
	
})

	

