// JavaScript Document
var i = 1;
$(document).ready(function(){
	$("#magic").click(function () {
		$("span").hide("fast", function(){magicEffect(this);})
	});
	$("#imagePreview").click(function(){
		maskViewport();
		fadeInFunction(this);
		
		var leftPos = ($("#blocker").innerWidth() - $("#fullview").width() ) /2;
		var topPos = ($("#blocker").innerHeight() - $("#fullview").height() ) /2;
		$("#fullview").css("left",leftPos+"px");
		$("#fullview").css("top",topPos+"px");
		$("#fullview").css("cursor","pointer");
		$("#fullview").click(function(){
			$(this).remove();
			unmaskViewport();
		});
		return false;
	});
});
function fadeInFunction(image){
	$("body").append("<img id=\"fullview\" src='"+$(image).attr("src")+"' />");
	$("#fullview").fadeIn(500);
}
function magicEffect(thisItem){
		$(thisItem).addClass("newClass");
		$(thisItem).html("The Magic is Good");
		$(thisItem).hide("fast").show(2000); 
}
function imageChanger(direction){
	$("#imagePreview").fadeOut("slow", function(){$("#imagePreview").attr({src:"meetimages/new"+ i+ ".jpg" }).fadeIn(500);});
	if(direction == 'up'){
		i++;
		if( i >7){
			i = 1
		}
	}else if(direction == 'down'){
		i--;
	}
	if( i <1){
		i = 7
	}
}
function maskViewport()
	{
			  $("body").prepend("<div id=\"blocker\" style=\"position: fixed; z-index: 3; left: 0; right: 0; top: 0; bottom: 0; background-color: black; opacity: 0; filter: alpha(opacity=0);\"></div>");
			  $("#blocker").fadeTo(500,.65);
			 
	}
	function unmaskViewport()
	{
			  $("#blocker").fadeOut(500, function() {$("#blocker").remove();});
	}
