﻿
    function BuyProduct()
    {
        Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoaded);
    }

    function pageLoaded(sender, args)
    {
         openOverlay();
         Sys.WebForms.PageRequestManager.getInstance().remove_pageLoaded(pageLoaded);
    }

//scrollable functions -->
$(function() {		
		 
	$("div.scrollable").scrollable({
		size: 10,
		items: '#thumbs',  
		hoverClass: 'hover',
		loop:'true'
	});
	
	//Remove add to list link once clicked
	$(".small").click(function () {
	    $(this).hide(1000);
	});	
	
	//close overlay function
    $("#ContinueShopping").click(function () {
	api = $("a[rel]").overlay();
	api.close();
	});
	
});

//overlay function
$(function() {	
	// if the function argument is given to overlay, it is assumed to be the onBeforeLoad event listener
	
	$("a[rel]").overlay({
	
	onBeforeLoad: function() 
	{
		// grab wrapper element inside content
		var wrap = this.getContent().find("div.wrap");

		// load only for the first time it is opened
		wrap.load(this.getTrigger().attr("href"));
	},
	
	onClose: function()
	{ 
	    updatePanel();
	} 
	
	
	});
	
    var api = $("a[rel]").overlay({api:true});
    // define function that opens the overlay    
     window.openOverlay = function() 
     { 
        api.load();     
     } 
	    
});
