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

//overlay function
$(function() {	
	// if the function argument is given to overlay, it is assumed to be the onBeforeLoad event listener
	
	$("a[rel].basketLink").overlay({
	
	expose: '#83c1e5',
		speed: 'fast',
		opacity: 0.7,
	
	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].basketLink").overlay({api:true});
    // define function that opens the overlay    
     window.openOverlay = function() 
     { 
        api.load();     
     } 
     
     //close overlay function
    $("#CloseBasket").click(function () {
	api = $("a[rel]").overlay();
	api.close();
	});
     
     
	
    
});

$(document).ready(function() {

 
 $("#main-nav a").each(function(i){

var link = $(this).attr("href");
if(link.indexOf(".aspx") > -1)
link = link.substring(0, (link.length - 5));

if (link == "/")
{
if (window.location.href.toLowerCase() == "http://www.menopausesupport.co.uk")
{$(this).attr("class","navCurrent");}
}
else
{
if (window.location.href.toLowerCase().indexOf(link.toLowerCase()) > -1)
{$(this).attr("class","navCurrent");}
}
});

});
