$(document).ready(function(){
var windowW = $(window).width();
var reg_fee = 0;
var paypal_price = 0;
windowW = windowW - 226;
$("#logo").animate({"left": "+="+windowW}, "slow").delay(800).animate({"left": "-="+windowW}, "slow", function() {
    $("#tagLine").fadeIn("slow");
});
    if (windowW <= 800 ){
        $('#wrap').css("left",0);
        $('#wrap').css("margin-left",0);
        $('#footer').css("left",0);
        $('#footer').css("margin-left",0);
    }

    
    $('select#team_type').live("change", function() {
        var current_value   = $("select#team_type option:selected").val();
        var team_choice     = $("select#team_type option:selected").attr("title");
        var current_balance = $('#payment_total').text();
        current_balance = parseInt(current_balance);

        if(current_value != "School Team" && current_value != "0" && current_balance < 250)
        {
            reg_fee = 250 + current_balance;
            jQuery('#expiry,#cardname,#csc').validate({
	                    expression: "if (VAL) return true; else return false;",
	                    message: "This field is required."
                     });
             jQuery("#ccnum").validate({
	                    expression: "if (VAL) return true; else return false;",
	                    message: "Payment is required to submit online."
            });
        }
        else if (current_value == "School Team" || current_value == "0")
        {
            if (current_balance > 100) {
                reg_fee = current_balance - 250;
            }
        }

        $('#payment_total').text(reg_fee);

    });

     $("input[name=buildrent]:radio").click(function()
     {
         var current_balance = $('#payment_total').text();
         current_balance = parseInt(current_balance);


         if($(this).val() == 'Need to Rent A Bed')
         {
            reg_fee = current_balance + 100;
         }
         else if (current_balance == 100 || current_balance > 250)
         {
            reg_fee = current_balance - 100;
         }

        $('#payment_total').text(reg_fee);

     });

});

//GOOGLE CODE
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-16903527-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();


