var productDetailsQuickView = {

	quickViewArea: null,
	quickViewEasyViewer: null,
	picker: null,

	initialize: function() {
		var quickView = $('evQuickView');
		if (quickView != null) {
			this.quickViewArea = quickView;
			
			this.quickViewEasyViewer = new easyViewer('QuickView');
			
			var productLinks = $$('.productQuickView');
			for (var i = 0; i < productLinks.length; i++) {
				var url = $(productLinks[i].id + 'QVUrl');
				if (url != null && url.value != null) {
					productLinks[i].quickViewUrl = url.value;
					productLinks[i].quickViewBindObj = this;
					productLinks[i].onclick = this.clickHandler;
				}
			}
		}
	},
	
	openQuickView: function(url) {
		new Ajax.Request(url, {method:'post', onSuccess: this.openQuickViewSuccess, onFailure: function() {alert('failure');}});
	},
	
	openQuickViewSuccess: function(transport) {
		var response = transport.responseText;
		var bindObj = productDetailsQuickView;

		bindObj.quickViewArea.update(response);
		bindObj.quickViewEasyViewer.attachActionsToHandles();
		bindObj.picker = new skuPicker(eval($('lookupTable').value)[0],'','productDetail',eval($('imagesLookupTable').value)[0], true);
		bindObj.picker.init();
		bindObj.quickViewEasyViewer.show();
	},
	
	clickHandler: function() {
		this.quickViewBindObj.openQuickView(this.quickViewUrl);
		return false;
	}
};
