// JavaScript Document

function pageLoad() {

};


$(document).ready(function(){	 
	
	var rand_no = Math.random();
	rand_no = rand_no * 6;
	rand_no = Math.ceil(rand_no);
	//alert("img"+rand_no);
	
	$(".photos").children(".img"+rand_no).show().siblings("img").hide();
	
	
						   
	$(".search #dnn_dnnSearch_txtSearch").attr({ value: 'Site search...' }).focus(function(){
		if($(this).val()=="Site search..."){
		   $(this).val("");
		}
	}).blur(function(){
		if($(this).val()==""){
		   $(this).val("Site search...");
		}
	});		   
					   
	// Add image to tpo and bottom of Stations table
	$("table.stations").before('<div class="table_top">&nbsp;</div>');
	$("table.stations").after('<div class="table_bottom">&nbsp;</div>');
	
	
	// Left column active link of second level nav needs parent to be active also
	$(".left_col li li#houseMenuCurrentItem").parent("ul").parent("li").addClass("activechild");
	
	// action link list of links
	$(".action_link").parent("li").parent("ul").addClass("nobullet").css({"border-bottom":"1px solid #E5E5E5", "margin-bottom":"10px"});
	
	
	$(".nav ul#HouseMenuNav > li").children("ul").hide();
	
	$(".nav ul#HouseMenuNav > li").hover(function(){
		$(this).children("ul").show();
		$(this).children("a").addClass("active")
	},function(){
		$(this).children("ul").hide();
		$(this).children("a").removeClass("active")
	}); 
	
	/*$(".tab_c").hide();
	$(".tab_c:first").show();
	$(".tab_b a:first").addClass("active");
	
	$(".tab_b a").click(function(){
		var tab_open = $(this).attr("href");
		$(".content_wrapper").children(tab_open).show().siblings(".tab_c").hide();
		$(this).addClass("active").parent().siblings().children().removeClass("active");
		return false;
	});*/
	
	$("label.hidden").hide();
	$(".order_form .hidden").parent("td").next("td").attr("colSpan",2).prev("td").remove();
	$(".order_form .hidden2").parent("td").next("td").attr("colSpan",6).prev("td").remove();	
	$(".order_form .hidden3").parent("td").next("td").attr("colSpan",4).prev("td").remove();
	
	
	$(".n25").blur(function(){
		var number25 = $(this).val();
		var number25total = number25 * 25;
		$(".t25").val(number25total);
		total_calc();
	});
	
	$(".n50").blur(function(){
		var number50 = $(this).val();
		var number50total = number50 * 50;
		$(".t50").val(number50total);
		total_calc();
	});
	
	$(".n100").blur(function(){
		var number100 = $(this).val();
		var number100total = number100 * 100;
		$(".t100").val(number100total);
		total_calc();
	});	
	
	$(".n500").blur(function(){
		var number500 = $(this).val();
		var number500total = number500 * 500;
		$(".t500").val(number500total);
		total_calc();
	});	
	
	$(".n1000").blur(function(){
		var number1000 = $(this).val();
		var number1000total = number1000 * 1000;
		$(".t1000").val(number1000total);
		total_calc();
	});	
	
	total_calc = function (){
		var t25, t50, t100, t500, t1000;
		var total; 
		
		t25 = ($(".t25").val())*1;
		t50 = ($(".t50").val())*1;
		t100 = ($(".t100").val())*1;
		t500 = ($(".t500").val())*1;
		t1000 = ($(".t1000").val())*1;
		total = (t25 + t50 + t100 + t500 + t1000);

		$("#dnn_ctr439_FormMaster_ctl_eaa57842172349e8bc884d8c7813ab49").val(total);
	};
	
	
	$(".calc").click(total_calc);
	$(".calc").blur(total_calc);
	$(".Box2").click(total_calc);

});
