    $(document).ready(function(){
		var withGoogleAnalytics = function(fn){
			try{
				if(typeof _gaq === 'object'){
					fn(_gaq);
				}
			}catch(e){
			}
		}

          tb_init('.thickbox');
		  
		  $('a[href^="/d/9/Price_Match.html"]').click(function(evt){
			  withGoogleAnalytics(function(_gaq){
				  _gaq.push(['_trackEvent','Price Match','Click']);
				  evt.preventDefault();
				  setTimeout(function(){
					  window.location = "/d/9/Price_Match.html";
				  },100);
			  });
		  });

		  $('a[title$="Brochure"]').click(function(evt){
			  var href = $(this).attr("href"),
			  	title = $(this).attr("title");

			  withGoogleAnalytics(function(_gaq){
				  _gaq.push(['_trackEvent','Brochure',title]);
				  evt.preventDefault();

				  setTimeout(function(){
					  window.location = href;
				  },100);
			  });
		  });

          function addMega(){
             $(this).addClass("hovering");
          }
          
          function removeMega(){
            $(this).removeClass("hovering");
          }
          
          var megaConfig = {
               interval: 0,
               sensitivity: 7,
               over: addMega,
               timeout: 0,
               out: removeMega
          };
		  
		  var test = jQuery("li.mega");
		  if(typeof test.hoverIntent == "function"){
			  test.hoverIntent(megaConfig);
		  }
		  
          
          jQuery('.fix-z-index').bgiframe();
		  
          jQuery('.video').fancybox({
            "width"				: 540,
            "height"			: 340,
            "autoScale"     	: false,
            "autoDimensions"     	: false,
            "transitionIn"		: "none",
            "transitionOut"		: "none",
            "scrolling"           : "no",
			"onComplete"		: function(){
				withGoogleAnalytics(function(_gaq){
					_gaq.push(['_trackEvent','Videos','Play','Product Video Vancouver Petite']);
				});
			},
			"onClosed"			: function(){
				withGoogleAnalytics(function(_gaq){
					_gaq.push(['_trackEvent','Videos','Close','Product Video Vancouver Petite']);
				});
			},
            "titleShow"           : false
          });

		  $(".isis, .idis").click(function(evt){
			  var href = "";

			  evt.preventDefault();
			  href = $(this).attr("href");

			  window.open(href,null,'height=340,width=514');
		  });
		
		$(".rounded-box").not(".exclude").hover(
			function(){
				$(this).addClass("hover");
			},
			function(){
				$(this).removeClass("hover");
			}
		);
		
		$(".content-rounded-box").not(".exclude").each(function(){
			  $(this).css("display","none");
		});
		
		$(".rounded-box").not(".exclude").each(function(){
			$(this).find("h2").click(function(){
					
				if($(this).parents(".rounded-box").find(".content-rounded-box").css("display")=="none"){
					$(this).addClass("open");
					//$(this).parents(".rounded-box").addClass("open");
					$.ajax({ url: "/ajax/submenu-display.php?menu-open="+$(this).parents(".rounded-box").find(".content-rounded-box").attr("id") });
				}else{
					$(this).removeClass("open");
					//$(this).parents(".rounded-box").removeClass("open");
					$.ajax({ url: "/ajax/submenu-display.php?menu-closed="+$(this).parents(".rounded-box").find(".content-rounded-box").attr("id") });                      
				}
				$(this).parents(".rounded-box").find(".content-rounded-box").slideToggle("slow");                    

			  });
		});

		$("div#makeMeScrollable").smoothDivScroll({});

    }); 
	$(window).load(function(){
		var now = new Date(),
			pageReg = /\/(\w)\/(\d+)\//,
			append = "",
			matches = false;

		try{

			matches = pageReg.exec(window.location);

			if(matches){
				append = "&t=" + matches[1] + "&v=" + matches[2];
			}

			$("#jsLoadTime").html('<img src = "/media/image/design/stat/dot_clear.gif?ltime=' + (now - __start_load_time) + '&segment=' + __segment + append + '"/>');
		}catch(e){
		}
	});

