$(document).ready(function(){
	//if ($.browser.webkit) {$("body").addClass("webkit");}
	$(window).resize(function(){
		$("#header-bg img").css({"width":"100%"});
		if($("#header-bg img").height() < 142){
			$("#header-bg img").css({"width":"auto","height":"142px"});
		}
	})

	$("#discover-the-louvre li").click(function(){
		window.location = $(this).attr("rel");
	})

	$("#discover-the-louvre li").hover(function(){
		$(this).addClass("hoveredItem");
	},function(){
		$(this).removeClass("hoveredItem");
	})
	
	$("a.show-popup").click(function(){
		$(".support-popup").hide();
		var theID = $(this).attr("rel");
		$("#popup-"+theID).css({"top":$(window).scrollTop()-142});
		$("#popup-"+theID).show();
		return false;
	})
	
	$(".close").click(function(){
		$(".support-popup").hide();
	})

	$(".faq-page h3").append("<div class=\"backToTop\"><a href=\"#header-bg\" class=\"scroll\">To top ^</a></div>");
	$(".scroll").click(function(event){		
		event.preventDefault();
		$('html,body').animate({scrollTop:$(this.hash).offset().top}, 500);
	});
	
	$(".show-email").hover(function(){
		$(this).html("Send email");
	},function(){
		$(this).html("Join now");
	})
	
	$(".paypal-submit").hover(function(){$(this).addClass("paypal-submit-hover");},function(){$(this).removeClass("paypal-submit-hover");})
	$(".button-submit").hover(function(){$(this).addClass("button-submit-hover");},function(){$(this).removeClass("button-submit-hover");})
	
	$("#signup-input").focus(function(){
		if($(this).val()=="Receive our newsletter"){$(this).val("");}
		$(this).addClass("form-active");
	})
	$("#signup-input").blur(function(){
		if($(this).val()==""){$(this).val("Receive our newsletter");}
		$(this).removeClass("form-active");
	})
	
	$("#signup-submit").hover(function(){
		$(this).addClass("hover");
	},function(){
		$(this).removeClass("hover");
	})
	
	$("#donationtype").change(function(){
		var temp = $(this).val();
		$(".donationtype").each(function(){
			$(this).val(temp);
		})
	})
	
	$("#numTickets").change(function(){
		var temp = $(this).val();
		$("#totalTicketAmt").val(parseInt(temp)*2500);
		$("#formExtraText").val("Larry Gagosian Befefit tickets (x"+temp+")");
	})
	
})
