	$(document).ready(function() {
		$("div#links a[href='/industrial-air-cleaners.php']").hover(
			function() {
				//show dat drop-down
				var offset = $(this).offset();
				var left = offset.left;
				var top = offset.top+38;
				$("#OurUnitsDrop").css("left",left+"px").css("top",top+"px").show( 'blind', '', 500, '' );
			},
			function() {
				//hide the drop-down
				$("#OurUnitsDrop").hide();
			}
		);
		$("#OurUnitsDrop").hover(
			function() {
				//show dat drop-down
				$("#OurUnitsDrop").show();
			},
			function() {
				//hide the drop-down
				$("#OurUnitsDrop").hide();
			}
		);
		$('#thumbs > img').click(function() {
			var src = convertThumbSrc( $(this).attr('src') );
			$('#imgHolder').html('<img src="'+src+'">');
		});
		preloadLargeImages();
	});
	var cache = [];
	function preloadImage( src ) {
		var cacheImage = document.createElement('img');
		cacheImage.src = src;
		cache.push(cacheImage);
	}
	function convertThumbSrc( src )
	{
		return src.replace( "-thumb" , "" );
	}
	function preloadLargeImages()
	{
		var x = 0;
		$('#thumbs > img').each(function(index) {
			x++;
			//skip the first one
			if ( x > 1 )
			{
				var src = convertThumbSrc( $(this).attr('src') );
				preloadImage( src );
			}
		});
	}
	
	
	/*RFQ FUNCTIONS*/
	function doRFQSubmit()
	{
		var frm = document.forms[0];
		
		//check name
		if ( frm["Name"].value == "" )
		{
			alert( "Please enter your name" );
			frm["Name"].focus();
			return false
		}
		//check email or phone
		if ( !IsEmail( frm["Email"].value ) && !IsPhoneAdv( frm["Phone"].value ) )
		{
			alert( "Please enter your email address and/or your phone number" );
			frm["Email"].focus();
			return false;
		}
		
		frm.submit();
	}

	function CFMCalc()
	{
		var frm = document.frmCFMCalc;
		var l = parseFloat( frm.length.value );
		var w = parseFloat( frm.width.value );
		var h = parseFloat( frm.height.value );
		var acsel = frm.air_changes;
		var ac = parseInt( acsel.options[ acsel.selectedIndex ].value );
		var cfm = Math.round( (l*w*h*ac)/60 );
		
		$('#CFM_REQ').html( l+'x'+w+'x'+h+'x'+ac+' = ' + cfm + ' cfm' );
		$.fn.colorbox.close();
		$.get("popups/cfm_calc.php?save=true", { length: l, width: w , height: h, changes: ac, cfm: cfm } );
	}
