
var $window = $(window);

function newPos(x, y, pos, multi){
	return x + ' ' + (y - (pos * multi) + 'px');
}

function Move(div1, pos1, in1, div2, pos2, in2, div3, pos3, in3){

	var pos = $window.scrollTop();
	
	div1.css({'backgroundPosition': newPos('80%', pos1, pos, in1)});
	
	div2.css({'backgroundPosition': newPos('20%', pos2, pos, in2)});

	div3.css({'backgroundPosition': newPos('80%', pos3, pos, in3)});

}

function moveSingle(div1, pos1, in1){

	var pos = $window.scrollTop();
	
	div1.css({'backgroundPosition': newPos('80%', pos1, pos, in1)});

}



$(document).ready(function(){

/****

 J U D G E S
 
*****/

var judgeName = $('.judge a');
var judge = $('.judge');
var hiddenInnit = $('.hiddenInfo');

var currentOpen;

judge.click(function(){

	currentOpen = $(this);
	
	judge.not(currentOpen).css('background','#fff').children('a').css('color', '#000');
	judge.not(currentOpen).children('.hiddenInfo').slideUp(500);
	
	currentOpen.css('background','#efe5f4').children('a').css('color', '#650098');
	currentOpen.children('.hiddenInfo').slideDown(500);
	currentOpen.children().children('.showBio').fadeOut(200);

	
	return false;
});

judge.hover(function(){
	$(this).not(currentOpen).children('a').css('color', '#650098');
	$(this).not(currentOpen).children().children('.showBio').fadeIn(200);
},function(){
	$(this).not(currentOpen).children('a').css('color','#000');
	$(this).not(currentOpen).children().children('.showBio').fadeOut(200);
});



/**********

M E N U

**********/

$('#nav li').hover(
        function () {
            //show its submenu
            $('ul', this).show();
 
        }, 
        function () {
            //hide its submenu
            $('ul', this).hide();         
        }
    );
	

/************

C A T E G O R I E S

*************/
$('.aboutList li').click(function(){
	var thisThing = $(this);

	$('.aboutList ul').not($('ul', thisThing)).slideUp(300, function(){
		$('ul', thisThing).slideDown(300);
	});

});

$('#awardCategories .aboutList li').hover(function(){
	$(this).css('color', '#609');
	$('ul.aboutList li ul li').css('color','#000');
}, function(){
	$(this).css('color','#000');
});

/********

S C R O L L I N G

*********/
$.localScroll();

});
/*******

S L I D E  S H O W

*******/

function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});
