$(document).ready(function() {
	$("a.fancybox").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'overlayOpacity':	0.7,
		'speedIn'		:	300, 
		'speedOut'		:	300, 
		'titlePosition'	:	'over'
	});
	
	$(".change_filter").change(function(){
		var theLink = "/products.php?category=" + $("#category").val();
		theLink = theLink + "&m=" + $("#m").val();
		theLink = theLink + "&s=" + $("#s").val();
		theLink = theLink + "&c=" + $("#c").val();
		theLink = theLink + "&f=" + $("#f").val();
		
		location.href = theLink;
	});
	
	// NAV ---------- /
	$(".menu a").hover(function() {
		$(this).next("em").show();
	}, function() {
		$(this).next("em").hide();
	});
	
	$("em.sub01").hover(function() {
		$("em.sub01").show();
	}, function() {
		$(this).hide();
	});
	
	$("em.sub02").hover(function() {
		$("em.sub02").show();
	}, function() {
		$(this).hide();
	});
	
	$("em.sub03").hover(function() {
		$("em.sub03").show();
	}, function() {
		$(this).hide();
	});
	
	$("em.sub04").hover(function() {
		$("em.sub04").show();
	}, function() {
		$(this).hide();
	});
	
	$("em.sub05").hover(function() {
		$("em.sub05").show();
	}, function() {
		$(this).hide();
	});
	
	$("#meter_product").change(function(){
		location.href = "report_meters.php?id=" + $(this).val();
	});
});

$.fn.preloadImages = function() {
    this.each(function(){
        $('<img/>')[0].src = this;
    });
}
