
function lightboxIn() {

	return false;
}

function lightboxOut() {

	return false;
}

/* LIGHTBOX */

function showpopup() {
	$('#overlay').css('height', $(document).height()+'px');
	$('#overlay').fadeIn(200, function(){$('#popup').fadeIn(300)});
	return false;
}

function hidepopup() {
	$('#popup').fadeOut(100, function(){$('#overlay').fadeOut(200)});
	return false;
}

function syncBigImage() {
	$("#popup img.big_pic").attr("src", $("#popup p a.on img").attr("alt"));
}

function popupSetup() {

	$('area').click(showpopup);
	$("#overlay").click(hidepopup);

	$("#popup p a").click(
		function() {
			$("#popup p a").removeClass("on");
			$(this).addClass("on");
			syncBigImage();
			
			return false;
		}
	);
	
	$("#popup a.next").click(
		function () {
			var current = $("#popup p a.on");
			var newSelection = current.next();
			if (newSelection.size() > 0) {
				current.removeClass("on");
				newSelection.addClass("on");
				syncBigImage();
			}else{
				current.removeClass("on");
				newSelection = $("#popup p").children().eq(0);
				newSelection.addClass("on");
				syncBigImage();	
			}
			return false;
		}
	);

	$("#popup a.prev").click(
		function () {
			var current = $("#popup p a.on");
			var newSelection = current.prev();
			if (newSelection.size() > 0) {
				current.removeClass("on");
				newSelection.addClass("on");
				syncBigImage();
			}else{
				current.removeClass("on");
				newSelection = $("#popup p").children().eq(7);
				newSelection.addClass("on");
				syncBigImage();	
			}
			return false;
		}
	);

}

$(document).ready(
	function () {
		$('area').hover(
			function () {
				$('.ss_images_high').stop(true, false);
				$('.ss_images_high').fadeTo(300, 1.0);
			},
			function () {
				$('.ss_images_high').fadeTo(300, 0.0);
			}
		);
		
		$('area').click(lightboxIn);
		$('.ss_images_high').fadeTo(0, 0.0);

		popupSetup();
		
		$("li.promolinks a").click(
	    	function() {
	    		$(this).parent().children('a').css("font-weight", "normal");
	    		$(this).css("font-weight", "bold");
	    		$(this).parent().parent().children('img').attr("src", 'i/tiptop/press/'+$(this).parent().parent().attr('id')+'_'+$(this).text()+'.jpg');
	    		
	    		return false;
	    	}
	    );
	
	}
);
