﻿var productImage = new (function() {

	this.view = function( url, mtop ) {
		var img = $("product-image-placeholder");
		if( img.e.src.indexOf(url) == -1 ) {
			img.opacity(0);
			img.style("marginTop",mtop + "px");
			img.e.src = url;
			img.fadeIn();
		};
	};
});				
					
var quickView = new (function() {
	var self = this;
	function display( data ) {
		$("dim").create().top(0).left(0).opacity(0).style("position","fixed").style("backgroundColor","#000").width("100%").height("100%").show().fadeTo(70).e.onclick=self.close;
		$("quick-view").create("product-list").paste(data.text).show().fadeIn();
	};
	
	this.open = function( uri, lang ) {
		fast.ajax.get({ uri : uri, onload : display, cache : false, data : "lang="+ lang  });
	};
	
	this.close = function() {
		$("quick-view").fadeOut( function(){$("quick-view").hide();} );
		$("dim").fadeOut( function(){$("dim").hide();} );
	};	

});
