var isOpen = false;

function quickShop(productId){
	
		var siteHeight = Element.getHeight($('body'));
		var siteWidth = Element.getWidth($('body'));
		
		var scrollOffset = document.viewport.getScrollOffsets();
		
		var offsetHeight = document.viewport.getHeight();
		var offsetWidth = document.viewport.getWidth();
		
		var topOffset = ((offsetHeight + scrollOffset[1])/2) - (346/2);
		var leftOffset = ((offsetWidth + scrollOffset[0])/2) - (478/2);
		
		
		var fader = new Element('div', {"style":  "position:absolute; display:block; height:"+siteHeight+"px; width:"+siteWidth+"px; top:0; left:0; filter:alpha(opacity=40); -moz-opacity:0.4; opacity: 0.4; background-color:#000000; z-index:100;", "id":"ajaxyFader"});

var newContainer = new Element('div', {"style": "position:absolute; height:346px; width:478px; top:" + topOffset + "px; left:" + leftOffset + "px; z-index:200;", "id":"ajaxyContainer"});


$('body').insert(fader);
	  $('body').insert(newContainer);

		new Ajax.Request(window.location.href.replace(/index.php(.)*/gi, '') +'ajaxy.php?id='+productId, {
  onSuccess: function(response) {
	  
	  
				  
	newContainer.insert(response.responseText);
	newContainer.hide();
	Effect.Appear('ajaxyContainer', { duration: 0.4 });


	if ((response.getHeader('Server') || '').match(/Apache/))
    	  ++gApacheCount;
	 }

});

}

function wClose(){
		
	Element.remove($('ajaxyContainer'));
	Element.remove($('ajaxyFader'));
	
	}

function quickShopClose(){
	
		Effect.Fade('ajaxyContainer', { duration: 0.4 });
		window.setTimeout(wClose, 500);
		
	
	}
