$(document).ready(function() { 
	
	
		$("#productlist li a").mouseover(function(){
		$("#bubble").remove();
			var message= $(this).attr("alt");
$(this).parent("li").css({"position":"relative"}).append("<div id='bubble'><div class='top'></div><div class='message'>"+ message +"</div></div>");
			});
			
			
		$("#productlist li a").mouseout(function(){
				$("#bubble").animate({
					opacity: 0,
					top: "25px"
				
				}, 100)
					$("#bubble").remove();
					});
					
					
$("#breadcrumb li:first").css({"background-image":"url(graphics/breadcrumb_left.jpg)"});

$("ul.tabs").tabs("div.panes > div");

$("ul#section_nav li:last").css({"border-bottom":"none"});
$(".downloads_box ul").find("li:last").css({"border-bottom":"none"});

$("ul.footernav li a:first").css({"padding-left":"0"});
$("ul.footernav li a:last").css({"border-right":"none"});



$(".threefifths #completedownloadlist li:first").css({"border-top":"none"});


//$(".spec dt:even").addClass("even").next("dd").addClass("even");

//$("#footer .footerthirds:first").css({"margin-left":"5px"});
$("#footer .footerthirds:last").css({"margin-right":"0"});





	$("#newsletter_button").click(function(){
		$(".error").hide();
		var hasError = false;
		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
		
		var addressVal = $("#email").val();
		if(addressVal == '') {
			$("#email").after('<span class="error">Please enter the email address to send to.</span>');
			hasError = true;
		} else if(!emailReg.test(addressVal)) {	
			$("#email").after('<span class="error">Sorry, this email address is not valid.</span>');
			hasError = true;
		}
		
		var subjectVal = $("#name").val();
		if(subjectVal == '') {
			$("#name").after('<span class="error">You forgot to enter your name.</span>');
			hasError = true;
		}
		
		
		if(hasError == false) {
			$(this).hide();
			$("#emailsignupform").append('<img src="graphics/loading.gif" alt="Loading" id="loading" />');
			
			$.post("php/verify.php",
   				{ address: addressVal, subject: subjectVal },
   					function(data){
						$("#emailsignupform").slideUp("normal", function() {				   
							
							$("#emailsignupform").before('<h3>Thankyou,</h3><p>Your request is being processed.</p>');											
						});
   					}
				 );
		}
		
		return false;
	});	
	
	$("#emailsignupform input").focus(function(){
			$(this).next(".error").fadeOut("slow", function(){$(this).remove();
			});
	});
	
	
	$(".bigbutton").css({"cursor":"pointer"}).click(function(){
 window.location=$(this).find("a").attr("href");return false;
 });
	$("img[src^='siteimages/userimg_']").each(function(){
		var imgtext= $(this).attr("alt");
		$(this).wrap("<div class='img_box'></div>");
		$(this).after("<span class='caption'>" +imgtext+"</span>");

	});
	
	$('div.img_box:even').addClass("left");
	$('div.img_box:odd').addClass("right");
	
	//$(".threefifths img:even").wrap("<div class='left_img'></div>");
	//$(".threefifths img:odd").wrap("<div class='right_img'></div>");
	
	//.css({"border":"1px solid red"})
	
	
$(".reps_list dt:first").css({"border-top":"0"})




/* Begin Add/Remove Systems */



$(".filterform input[type='checkbox']").attr("checked", "checked"); //so we we know where we're starting from

$(".filterform input[name='Submit']").remove();

/*
$(".filterform input[type='checkbox']").click(function(){

 $(".range_panel").fadeTo(100, 0.2).each(function(){
 var address = $(this).attr("href");
		$(this).attr("temphref", address);
		$(this).removeAttr("href");

 		if($("#vDomestic").is(":checked")){
		$(".domestic").fadeTo(100, 1, function(){
			var address = $(this).attr("temphref");
			$(this).attr("href", address);
			$(this).removeAttr("temphref");
		});
		}
		if($("#vCommercial").is(":checked")){
		$(".commercial").fadeTo(100, 1, function(){
			var address = $(this).attr("temphref");
			$(this).attr("href", address);
			$(this).removeAttr("temphref");
		});
		}
		if($("#vIndustrial").is(":checked")){
		$(".industrial").fadeTo(100, 1, function(){
			var address = $(this).attr("temphref");
			$(this).attr("href", address);
			$(this).removeAttr("temphref");
		});
		}
		
		//alert($(this).attr("id"))
		
 
 });


}); // end filter form function 

*/




$(".filterform input[type='checkbox']").click(function(){

 $(".range_panel").each(function(){
 var address = $(this).attr("href");
		$(this).attr("temphref", address);
		$(this).removeAttr("href");
		
		if(
		$("#vDomestic").not(":checked"))
		{
		}
		else
		{
		$(".domestic").animate({
		"opacity": 0.1
		},100, 
		function(){
			var address = $(this).attr("temphref");
			$(this).attr("href", address);
			$(this).removeAttr("temphref");});
		}
		
		if(
		$("#vCommercial").not(":checked"))
		{
		}
		else
		{
		$(".commercial").animate({
		"opacity": 0.1
		},100, 
		function(){
			var address = $(this).attr("temphref");
			$(this).attr("href", address);
			$(this).removeAttr("temphref");});
		}
		
		if(
		$("#vIndustrial").not(":checked"))
		{
		}
		else
		{
		$(".industrial").animate({
		"opacity": 0.1
		},100, 
		function(){
			var address = $(this).attr("temphref");
			$(this).attr("href", address);
			$(this).removeAttr("temphref");});
		}
		
		
		//alert($(this).attr("id"))
		
 
 });


}); // end filter form function 


});