
var moved = false;

jQuery(
	function ($) 
	{
		new iwant.fire();
	}
);


var iwant = 
{
	fire: function () 
	{

		var hash = window.location.hash;

		screenSize();

		$(window).bind("resize", function () 
		{
			screenSize();
		});

		$("article").addClass("on");

		if (hash == "#info")
		{
			$("header").fadeIn(100);
			$("article").removeClass("on");
		}

		$("a.info").live("click", function() 
		{

			if (!$("header").is(':visible'))
			{
				$("header").fadeIn(100);
				$("article").removeClass("on");
			}
			else
			{
				$("header").fadeOut(100);
				$("article").addClass("on");
			}

		});

		$("header:visible").live("click", function() 
		{
			$(this).fadeOut(100);
			$("article").addClass("on");
		});

        $("article").bind("mouseenter", function() {
        
			var height = $(this).children("div").children("img").height();
            $(this).children("div").children("p").css({ "min-height": height });

        });

		/*$("article").click(function() 
		{
			var height = $(this).children("div").children("img").height() - 20;
            var width = $(this).children("div").children("img").width();
            var position = $(this).position();
            var windowWidth = $(window).width();
            var windowHeight = $(window).height();

            alert(scrollTop);

            if ((position.left + width) > windowWidth)
            {
                $("body").stop().animate({
                    scrollLeft: (position.left + width)
                });
            }

            if ((position.left + width) < windowWidth)
            {
                $("body").stop().animate({
                    scrollLeft: 0
                });
            }

            if ((position.top + height) > windowHeight)
            {
                $("body").stop().animate({
                    scrollTop: (position.top + width)
                });
            }

            if ((position.top + height) < windowHeight)
            {
                $("body").stop().animate({
                    scrollTop: 0
                });
            }
                
		});*/
        
       

	} // Fire

}


function screenSize() 
{
	var left = ($(window).width() - 612) / 2;
	var top = ($(window).height() - 552) / 2;

	$("header").css({ top: top, left: left });
}
