	
	var pathname = window.location.pathname;

	$('#categoriesWrapper ul li a.hp-category-graphic').each(function(index) 
	{
		if ($(this).attr('href') == pathname)
		{
			$(this).addClass('active');
		}
		
	});
	
	
	if ($('#banner-carousel .belt .panel').size() >= 1)
	{	
		var intSlideSpeed = 1000;
		var intPauseTime = 6000
		
		//If we are on the homepage than scroll the backgrond image automatically.		
		if ($('#banner-carousel.homepage').length > 0)
		{
			var intSlideSpeed = 1000;
			var intPauseTime = 3000
		}
		
		stepcarousel.setup({
			galleryid: 'banner-carousel', //id of carousel DIV
			beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
			panelclass: 'panel', //class of panel DIVs each holding content
			autostep: {enable: true, moveby:1, pause: intPauseTime},
			panelbehavior: {speed:intSlideSpeed, wraparound:true, persist:false},
			defaultbuttons: {enable: false, moveby: 1, leftnav: ['arrowl.gif', -10, 100], rightnav: ['arrowr.gif', -10, 100]},
			contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file']
		})
	}
	
	
	
	if ($('#internal-ourbrands .belt .panel').size() >= 1)
	{
		stepcarousel.setup({
			galleryid: 'internal-ourbrands', //id of carousel DIV
			beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
			panelclass: 'panel', //class of panel DIVs each holding content
			autostep: {enable:true, moveby:1, pause: 2500},
			panelbehavior: {speed:500, wraparound:true, persist:false},
			defaultbuttons: {enable: false, moveby: 1, leftnav: ['arrowl.gif', -10, 100], rightnav: ['arrowr.gif', -10, 100]},
			contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file']
		})
	}

		
			if ($('.content-scroller').length > 0)
			{
				$('.content-scroller').jScrollPane();
			}

	
	function viewGallery() 
	{
    	var shadowboxEval = "Shadowbox.open(["; 
		
		for (var counter = 0; counter < galleryArray.length; counter++) 
		{
			
        	if (counter > 0) 
			{
				shadowboxEval = shadowboxEval + ", "; 
			}
	        
			shadowboxEval = shadowboxEval + "galleryArray[" + counter + "]";
    	}

	 	shadowboxEval += "]);"; eval(shadowboxEval);
	}
	
	
window.onload = function()
{ 
	//Execute the Shadbox Init only on Internal Page.
	Shadowbox.init({	language: 'en', 
    					players:  ['img', 'html', 'iframe'], 
        				skipSetup: true   
					});
	
	
	if (checkCookie('one_day_sale_ad') != 'true')
	{
		setCookie('one_day_sale_ad', 'true', 1);
		showOneDaySale();
	}
} 	

//function showOneDaySale()
//{
//	var  img1 = {
//					player: 'img',
//					content: '/images/OneDaySale-Flyer.jpg',
//					height: 262,
//					width: 622,
//					title: 'Greta\'s Flair One Day Sale.  September 24th from 9:30am - 5:00PM',
//					};
//					
//	Shadowbox.open([img1]); 
//}

//create this html
jQuery('body').prepend("<a class='promo' href='#' onclick='showOneDaySale();' title='Greta\'s Flair One Day Sale.  September 24th from 9:30am - 5:00PM' rel='shadowbox'> <img src='/images/popup.png' width='250' height='68'/></a>");

/* Cookie Functionality
*****************************************/
function setCookie(c_name, value, exdays)
{
	var exdate = new Date();
	exdate.setDate(exdate.getDate() + exdays);
	
	var c_value = escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
	
	document.cookie = c_name + "=" + c_value;
}

function getCookie(c_name)
{
	var i,x,y,ARRcookies=document.cookie.split(";");
	
	for (i=0;i<ARRcookies.length;i++)
	{
		x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
		y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
		x=x.replace(/^\s+|\s+$/g,"");

		if (x==c_name)
		{
			return unescape(y);
		}
	}
}

function checkCookie(c_name)
{
	var cookie_value = getCookie(c_name);
	return cookie_value;
}
