var hoverBanner = new Class.create();
hoverBanner.prototype = {

    initialize : function (oArgs){
		this.targetUrl = oArgs.targetUrl ? oArgs.targetUrl : null;
        this.containerDivId   = oArgs.containerDivId ? oArgs.containerDivId : 'hoverContainer';
		this.containerObj = $(this.containerDivId);
		this.containerObj.imageUrl = null;
		this.offsetLeft = 55;
		this.offsetTop = 10;
		this.hideBanner = false;
		if(Prototype.Browser.IE && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5)) == 6)
		{
			this.offsetLeft = 45;
			this.offsetTop = -294;
		}
		if(null != this.containerObj)
		{
			$$('.photos .photo').each(function(listItem){
				$(listItem).observe('mouseover', function(){
					if(!this.hideBanner)
					{
						$(this.containerObj).show();
						var offset = listItem.positionedOffset();
						$(this.containerObj).setStyle({
							'left': (offset.left-this.offsetLeft)+'px',
							'top': (offset.top-this.offsetTop)+'px'
						});
						$(this.containerObj).imageUrl = null;
						$(listItem).getElementsBySelector('a[href]').each(function(link) {
							$(this.containerObj).imageUrl = $(link).readAttribute('href');
						}.bind(this));
					}
				}.bind(this));
			}.bind(this));
		}
    },

	hide : function() {
		this.hideBanner = true;
		$(this.containerObj).hide();
	},

	openTarget : function() {
		var url = this.targetUrl;
		if(null != url)
			document.location.href = url;
	},

	openImage : function() {
		var url = $(this.containerObj).imageUrl;
		if(null != url)
			document.location.href = url;
	}

}

