(function(){
  // if firefox 3.5+, hide content till load (or 3 seconds) to prevent FOUT
  var d = document, e = d.documentElement, s = d.createElement('style');
  if (e.style.MozTransform === ''){ // gecko 1.9.1 inference
    s.textContent = 'body{visibility:hidden}';
    e.firstChild.appendChild(s);
    function f(){ s.parentNode && s.parentNode.removeChild(s); }
    addEventListener('load',f,false);
    setTimeout(f,3000); 
  }
})();

$(function() {
	setupMenu();
	$('.btn-find-retailer').hover(function() {
		$('#find-retail-search').show();
	}, function() {
		$('#find-retail-search').hide();
	});
	$('#find-retail-search').hover(function() {
		$(this).show();
		$('.btn-find-retailer a').addClass('active');
	}, function() {
		$(this).hide();
		$('.btn-find-retailer a').removeClass('active');
	});
	$('.searchzip').click(function() {
		if($(this).val() == "Enter zip code or city & state") $(this).css('color','#000').val('');
	});
});
/******************************/
function setupMenu() {
	$('div#menu ul li').hover(function() {
		$('ul#' + $(this).attr('id') + '-menu').show();
	}, function() {
		$('ul#' + $(this).attr('id') + '-menu').hide();
	});
	$('div#submenus ul').hover(function() { 
		$(this).show(); 
		thisid = $(this).attr('id');
		parentid = thisid.substring(0,(thisid.length-5));
		$("#"+parentid+" a").addClass('hover');
	}, function() { 
		$(this).hide(); 
		$("#"+parentid+" a").removeClass('hover');
	});
	$('div#submenus ul ul').hover(function() { $(this).show(); }, function() { $(this).show(); });	
}

function goTo(url) {
	window.location = url;
}
function trackVideo(time, paused) {
	if(Math.round(paused/2) == paused/2) status = "Pause";
	else status = "Play";
	_gaq.push(['_trackEvent', 'Videos', status, $('title').html(),Math.round(time)]);
}
$(function(){

// Accordion
$("#accordion").accordion({ header: "p.title", autoHeight: false, active: false  });

$(".scrollContainer div:last-child").addClass('last-child') 

});
