function changeBorderLine(element) {
        	$("img.addToCartChoice").css({ 'border' : '3px solid #eee' });
        	$(element).css({ 'border' : '3px solid #777' });
}

$(document).ready(
	function()
	{	
		$('a[rel*=facebox]').each(function(index) {
			var url = $(this).attr("href");
			var url = url.replace("#pages", "/pages");
			$(this).attr("href", url);
			$(this).facebox({
				loading_image : 'loading.gif',
	        	close_image   : 'closelabel.gif'
	        });
		});
		
		$("#menuContainer").children("a").hover(function(){
			var offsetLeft = $(this).position().left - 10;
			var contentWidth = $(this).width() + 52;
			var textContent = $(this).html();
			var menuLink = $(this).attr("href");

			//alert(offsetLeft);
			$("#menuContainer").children("#overlay").children("a").attr({ href: menuLink } );
			$("#menuContainer").children("#overlay").children("a").children("span").html(textContent);
			$("#menuContainer").children("#overlay").css( { left : offsetLeft + "px", display : "block", width : contentWidth } );
		});
		
		$("#menuContainer").children("#overlay").hover(function(){
		
		},
		function(){
			if (typeof(activePage) != 'undefined'){
			 if ($("a." + activePage).position() != null){
				var offsetLeft = $("a." + activePage).position().left - 10;
				var contentWidth = $("a." + activePage).width() + 52;
				var textContent = $("a." + activePage).html();
				var menuLink = $("a." + activePage).attr("href");

				$("#menuContainer").children("#overlay").children("a").attr({ href: menuLink } );
				$("#menuContainer").children("#overlay").children("a").children("span").html(textContent);
				$("#menuContainer").children("#overlay").css( { left : offsetLeft + "px", display : "block", width : contentWidth } );
				}
			} else {
				$("#menuContainer").children("#overlay").css( { display : "none" } );
			}
		});
		
		$("#iconLabels").children(".iconLabel").hover(function(){
			$(this).stop();
			$(this).animate( { marginLeft : "5px" }, 100 );
		},
		function(){
			$(this).stop();
			$(this).animate( { marginLeft : "0px" }, 300 );
		});
		
		if (typeof(activePage) != 'undefined'){
		 if ($("a." + activePage).position() != null){
			var offsetLeft = $("a." + activePage).position().left - 10;
			var contentWidth = $("a." + activePage).width() + 52;
			var textContent = $("a." + activePage).html();
			var menuLink = $("a." + activePage).attr("href");

			$("#menuContainer").children("#overlay").children("a").attr({ href: menuLink } );
			$("#menuContainer").children("#overlay").children("a").children("span").html(textContent);
			$("#menuContainer").children("#overlay").css( { left : offsetLeft + "px", display : "block", width : contentWidth } );
			}
		} else {
			$("#menuContainer").children("#overlay").css( { display : "none" } );
		}
	}
);
