function loadOverlay(status,code,title, desc, dimension,price, image)
{
    // get document width
    var documentWidth = $(window).width();

    // get window width
    var windowWidth   = 600;    
    
    // forumula to calculate center
    var leftPadding   = (documentWidth - windowWidth) / 2;
       
	document.getElementById('curtain').style.height  = $(document).height() + "px";
	document.getElementById('curtain').style.width       = $(document).width() + "px"; 
    // apply style
    document.getElementById('overlay').style.left    = leftPadding + 'px';

    
	var product = "<b>Product Description</b>";
    
    
    product += "<p>" + desc + "</p>";
    


    
    product += '<br/><div id="product-price" class="product-price">€ '+price+'</div>';    
    
    if (status == 2)
    {
    	product += "<br /> <b>Out of Stock</b>";
    }
    else
    {
    	product += '<a href="#" onClick="addToCart(\''+code+'\',\''+title+'\')"><img src="/media/images/active/order-now.gif" width="124" height="19" alt="" border="0" /></a>';
	}
    
//    alert(price);
	image = '<img src="/media/images/active/products/large/'+image+'.jpg" width="273" height="321" alt="Product title" />';
    if (dimension)
    {
	    image += "<br /><b>Dimensions :</b><p>" + dimension + "</p></b>";
	}

    $("#overlay-header").html('<b>' + title + '</b>');   
	$("#product-image").html(image);            
	$("#product-description").html(product);               
	$("#curtain").show();     
    $("#overlay").show("slow");
}

    $(document).ready(function(){

		$("#curtain").css("opacity","0.75"); 
	});


function closeOverlay()
{
	$("#curtain").hide();
    $("#overlay").hide();
}

function closeAddToCart()
{
	$("#overlay").hide();
	$("#curtain").hide();
    $("#add-to-cart").hide();
}

function addToCart(code,title)
{
	document.getElementById('curtain').style.height  = $(document).height() + "px";
	document.getElementById('curtain').style.width       = $(document).width() + "px"; 
	$("#curtain").show();
	$("#cart-item").val(code);    
	$("#cart-header").html('<b>' + title + '</b>');     
    $("#overlay").hide("slow");
    $("#add-to-cart").show("slow");

}
