//Highslide stuff

hs.graphicsDir = '/images/highslide/';
hs.showCredits = false;
hs.align = 'center';
hs.dimmingOpacity = 0.4;
hs.registerOverlay({
	html: '<div class="closebutton" onclick="return hs.close(this)" title="Close"></div>',
	position: 'top right',
	useOnHtml: true,
	fade: 2 // fading the semi-transparent overlay looks bad in IE
});
hs.allowMultipleInstances = false;
/*
hs.allowSizeReduction = false;
hs.outlineType = 'custom';





;

*/



$(document).ready(function(){
    
    
    //Drop down menu
    $("ul#nav li").hover(function(){
    
        $(this).addClass("hover");
        $('ul:first',this).fadeIn('fast');
    
    }, function(){
    
        $(this).removeClass("hover");
        $('ul:first',this).fadeOut('fast');
    
    });
    
    $("ul#nav li ul li:has(ul)").find("a:first").append(" &raquo; ");
    
    //product scroller
    var sr = $('#portfolio_images');    
    var sr_width = sr.width();
    var item_width = 490;
    
    $('#scroll_left').click(function(){
        var sr_position = sr.position();
        var sr_left = sr_position.left-item_width;
        
        if( sr_left < (item_width * -1) ){
            sr.animate({
                left: '+='+item_width
            },500,function(){
                if( sr.css('left') == '0px'){
                    $('#scroll_left').fadeOut();     
                }    
            });
            $('#scroll_right').fadeIn(); 
            
        } else {
            $(this).fadeOut();
        }    
    });
    
    $('#scroll_right').click(function(){
        var sr_position = sr.position();
        var sr_left = sr_position.left-item_width;
        var next_left = ( sr_left + sr_width);
        
        if( next_left >= 420 ){
            
            sr.animate({
                left: '-='+item_width
            },500,function(){
                   
            });
            $('#scroll_left').fadeIn();
            
            if( next_left < 800 ){
                $(this).fadeOut();    
            }
              
        } else {
            $(this).fadeOut();
        }
    });
    
    $('#readmore_link').click(function(){
        $('#home_readmore').slideDown();
        $(this).fadeOut();
    });
    
    $('.more_copy .label').toggle(
        function(){
            $('.more_copy .inner').slideDown(750);    
        },
        function(){
            $('.more_copy .inner').slideUp(750);    
        }
    );
    
    //Portfolio filters
    
    $('.filter .filter_title').toggle(
        function(){
            $(this).next().slideDown();
            $(this).children('.filter_arrow').attr('src','/images/filter_arrow_up.png');    
        },
        function(){
            $(this).next().slideUp();
            $(this).children('.filter_arrow').attr('src','/images/filter_arrow_down.png');
        }
    )
	
	//Staff Page
	
	$('#staff-shea-desc').animate({"opacity": 1 });
		
	$('#staff-select a').mouseover(function() {
		$('#staff-shea-desc').stop().animate({"opacity": 0 });
		sid=$(this).attr('id');
		$('#staff-' + sid + '-desc').stop().animate({"opacity": 1 });
		}).mouseout(function () {$('#staff-' + sid + '-desc').stop().animate({"opacity": 0 });
	});
    
    
});


