$(document).ready(function(){					
	mainmenu();
	ie6Hover();
	externalLinks();
	zindex();
	AwardGallery();
	Faqs();
});


function mainmenu(){
$("#NavPrimary ul").css({display: "none"}); // Opera Fix
$("#NavPrimary li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).fadeIn(400);
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
		});
	}
	//hover 
	function ie6Hover(){
	$("ul#NavPrimary li").hover(function() {
				$(this).addClass('hover');
			}, function() {
				$(this).removeClass('hover');
	});
}

function Faqs() {
	$('.answers-cta').click(function () {
			var answers = $(this).attr('href');
			$(answers).addClass('answers-active');
			return false;
	});
	$('.answers-close').click(function (){
			$(this).parent().removeClass('answers-active');
			return false;
	});
}

function externalLinks(){
	$("a[rel=external]").attr('target', '_blank');
}

function zindex(){
	var zIndexNumber = 1000;
	$('div').each(function() {
		$(this).css('zIndex', zIndexNumber);
		zIndexNumber -= 10;
	});
}

function AwardGallery() {
	
	function isFirst() {
	if($("ul#Award-Photos li:first").is(".active"))	{ $('a#Photo-previous').hide(); } else { $('a#Photo-previous').show(); }
	if($("ul#Award-Photos li:last").is(".active"))	{ $('a#Photo-next').hide(); } else { $('a#Photo-next').show(); } 
	}
	
	isFirst();

    $('a#Photo-next').click(function () {														  
        $('#Award-Photos li.active').next('li').addClass('active').fadeIn('slow').prev('li').removeClass('active');
		isFirst();
        return false;
    });
	
    $('a#Photo-previous').click(function () {
		$('#Award-Photos li.active').prev('li').addClass('active').next('li').fadeOut('slow').removeClass('active');
		isFirst();
        return false;
    });

}



