$(document).ready(function(){
    $("a[@href*='http']:not([@href*='" + domain + "'])").click(function(){
        if (typeof(pageTracker) != 'undefined') {
            pageTracker._trackPageview('/outgoing/' + this.href);
        }
    });

    $('.player-full').flash(
            { 
              width: 450, 
              height: 350,
              flashvars: { width: 450, height: 350, searchbar: 'false', usefullscreen: 'false' }
            },
            null,
            function(htmlOptions) {
                $this = $(this);
                htmlOptions.src = $this.attr('href');
                $this.removeAttr('href');
                $this.empty().append($.fn.flash.transform(htmlOptions));
            }
        );

	   var max = parseInt($(".counter + .hint span").text());

	   $(".counter").charCounter(max, {
		container: ".hint span",
		format: "%1"
	    });

	   $("#copy_data").change(function() {
	       if (this.checked == true) {
	           $("#company_billing_name").val($("#company_name").val());
	           $("#company_billing_state_id").val($("#state_id").val());
	           $("#company_billing_city").val($("#company_city").val());
	           $("#company_billing_postal_code").val($("#company_postal_code").val());
	           $("#company_billing_street").val($("#company_street").val());
	           $("#company_billing_street_number").val($("#company_street_number").val());
	       }
	   });

      $('.truncate').jTruncate({  
          length: 50,  
          moreText: "więcej",  
          lessText: "   mniej"
      });

      $('#promo_from, #promo_to').datepicker();
});
