function Collage(element)
{
	this.element = element;
	this.animationSpeedIn = 10000;
	this.animationSpeedOut = 250;
	this.scale = 50;
	this.init();
}

Collage.prototype.init = function()
{
	if (ieVersion == 6 || ieVersion == 7)
		return;
	else
		this.bindEvents();
}

Collage.prototype.bindEvents = function()
{
	var parentRef = this;
	
	$(parentRef.element).unbind();
	$(parentRef.element).children(".window-section").unbind();
	
	$(parentRef.element).mouseleave(function() {
		$(parentRef.element).children(".window-section").children("a").children("img").stop();
	});

	$(parentRef.element).children(".window-section").hover(
		function() {
			$(parentRef.element).children(".window-section").children("a").children("img").stop();
			if ( $(this).hasClass("maintain-width") )
			{
				var myWidth = $(this).width();		
				var myScale = parentRef.scale;
				$(this).children("a").children("img").animate({ width: myWidth + myScale}, parentRef.animationSpeedIn, "easeOutCirc", function(){});
			}
			else
			{
				var myHeight = $(this).height();
				var myScale = parentRef.scale;
				$(this).children("a").children("img").animate({ height: myHeight + myScale}, parentRef.animationSpeedIn, "easeOutCirc", function(){});
			}
		},
		function() {
			if ( $(this).hasClass("maintain-width") )
			{
				$(this).children("a").children("img").animate({ width: "100%", top: 0, left: 0}, parentRef.animationSpeedOut, function(){});
			}
			else
			{
				$(this).children("a").children("img").animate({ height: "100%", top: 0, left: 0}, parentRef.animationSpeedOut, function(){});
			}
		}
	);	
}

var collages = new Array();

$(document).ready(function() {
	$(".collage-container").each(function() {
		collages.push(new Collage(this));
	});
});
