	/* Registration */
$(document).ready(function(){ 
		
	// Tabs
	$("#tabs").tabs();
	
	// countdown
	var austDay = new Date();
	$('#countdown').countdown({ 
    until: new Date(2011, 6, -4, 15, 1)}); 
	
	/* PNG FIX */
	$(document).pngFix(); 
	
	/* site map slide */
	$('a#sitemap-link').click(function(){
		if ($('#sitemap').is(':hidden')) {
		 $('#sitemap').slideDown('slow');
		 $('a#sitemap-link').addClass('down');
		 return false;
		} else {
		 $('#sitemap').slideUp('slow');
		 $('a#sitemap-link').removeClass('down');
		 return false;
		}
	}); 
	
	
		/* prettyphoto lightbox */

	
	$("a[rel^='prettyPhoto']").prettyPhoto();



     // BEGIN OWATONNA APP JS  
	$("#btnSubmit").click(function(){
								   
		// set the system default name to the card name
		//$("#FullName").val($("#CardName").val());
		
		// plug camper name into hidden camper name field
		var camperName = $("#CamperFirst").val()+" "+$("#CamperLast").val(); 
		$("#CAT_Custom_145810, #CAT_Custom_147718").val(camperName);
		
		
		if (document.location.href.indexOf("owatonna_application") != -1){    
           	if($("#camperSelectYes").attr("checked") == true){
				$("#FullName").val($("#CAT_Custom_143348").val());
			}
			if($("#camperSelectNo").attr("checked") == true){
				$("#FullName").val($("#CAT_Custom_143305").val());
			}
       }
	   
	   	if (document.location.href.indexOf("newfound_application") != -1){    
           	if($("#camperSelectYes").attr("checked") == true){
				$("#FullName").val($("#CAT_Custom_147707").val());
			}
			if($("#camperSelectNo").attr("checked") == true){
				$("#FullName").val($("#CAT_Custom_147668").val());
			}
       }

	

	
		
/* 
	// if we are on the creativity page use this total check
	if(document.location.href.indexOf("creativity_application") != -1){

		// check total against 100
		if($("#Amount").val() <= 99){
			$("#ammountError").show();
			return false;
		}
		if($("#Amount").val() >= 100){
			$("#ammountError").hide();
		}

	}else{ // else we use this 
	 
		// check total against 300
		if($("#Amount").val() <= 299){
			$("#ammountError").show();
			return false;
		}
		
		
		if($("#Amount").val() >= 299){
			$("#ammountError").hide();
		}
	}
*/
		
		
	});  // end submit 

	// Owatonna - define ammount upon session choice
	$("[name=CAT_Custom_143299]").change(function(){
		if($(this).val() == "1stSession"){
			$(".form_amount").text("2210.00");
		}
		
		if($(this).val() == "2ndSession"){
			$(".form_amount").text("3045.00");
		}
		
		if($(this).val() == "2Week"){
			$(".form_amount").text("1580.00");
		}
		
		if($(this).val() == "FullSession"){
			$(".form_amount").text("4585.00");
		}
		
		if($(this).val() == "CIT"){
			$(".form_amount").text("3900.00");
		}
		
	});
	
	
	// Newfound - define ammount upon session choice
	$("[name=CAT_Custom_147662]").change(function(){
												  
		if($(this).val() == "1stSession"){
			$(".form_amount").text("2210.00");
		}
		
		if($(this).val() == "2ndSession"){
			$(".form_amount").text("3045.00");
		}
		
		if($(this).val() == "2Week"){
			$(".form_amount").text("1580.00");
		}
		
		if($(this).val() == "FullSession"){
			$(".form_amount").text("4585.00");
		}
		
		if($(this).val() == "CIT"){
			$(".form_amount").text("3900.00");
		}
		
	});
	
	
	// date picker fixes
	$("#CAT_Custom_143344").blur(function(){

			$(this).removeClass("error");
			$(this).next().hide();

	});
	
	$("#DOB").blur(function(){

			$(this).removeClass("error");
			$(this).next().hide();

	});
	
	
	$("#commentForm").validate();
	
	// Owatonna show hide correct camper section
	$("#camperSelectYes").click(function(){
		$("#CAT_Custom_145810, #CAT_Custom_143348, #CAT_Custom_143305, #FullName, #CAT_Custom_147707, #CAT_Custom_147668").val("");//reset the camper name, parent names upon switch
		$("#familyDetailsLong").children().find("input").removeClass("required");
		$("#familyDetailsShort").children().find("input").addClass("required");
		// special non required folks
		$("#CAT_Custom_143308, #CAT_Custom_143313, #CAT_Custom_143351, #CAT_Custom_147671, #CAT_Custom_147676, #CAT_Custom_147710").removeClass("required");
		$("#familyDetailsShort").show();
		$("#familyDetailsLong").hide();
		$(".notRequired").children().find("input").removeClass("required");
		
	});

	$("#camperSelectNo").click(function(){
		$("#CAT_Custom_145810, #CAT_Custom_143348, #CAT_Custom_143305, #FullName, #CAT_Custom_147707, #CAT_Custom_147668").val(""); //reset the camper name, parent names upon switch
		$("#familyDetailsShort").children().find("input").removeClass("required");
		$("#familyDetailsLong").children().find("input").addClass("required");
		// special non required folks
		$("#CAT_Custom_143308, #CAT_Custom_143313, #CAT_Custom_143351, #CAT_Custom_147671, #CAT_Custom_147676, #CAT_Custom_147710").removeClass("required");
		$("#familyDetailsShort").hide();
		$("#familyDetailsLong").show();
		$(".notRequired").children().find("input").removeClass("required");
	});
	
	// Creativity Camp show/hide 
	$("#1stFullday").click(function(){
		$("#1stchoice-full").show();
		$("#1stchoice-half").hide();
		});
		
		$("#1stHalfday").click(function(){
		$("#1stchoice-half").show();
		$("#1stchoice-full").hide();
	});
	
	$("#2ndFullday").click(function(){
		$("#2ndchoice-full").show();
		$("#2ndchoice-half").hide();
		});
		
		$("#2ndHalfday").click(function(){
		$("#2ndchoice-half").show();
		$("#2ndchoice-full").hide();
	});
	
	// override required - 2nd guardian not required addon
	$(".notRequired").children().find("input").removeClass("required");


	   
	   
}); 
		// END OWATONNA APP JS


/* dropdown for ie6 to work */
sfHover = function() {
	var sfEls = document.getElementById("nav,utility-nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);



