// Easing equation, borrowed from jQuery easing plugin
// http://gsgd.co.uk/sandbox/jquery/easing/
jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

$(document).ready(function(){
     $('.contactForm select').fcSelect({'className': 'formcontrols_select_195'});
     //$(':radio').fcRadio();
     $('.checkbox-ss').fcCheckbox();

     Cufon.replace('.cufon-orange', {fontSize:'24px', color:'#F76200'});
     Cufon.replace('h3.cufon-blue', {fontSize:'24px', color:'#3474a8'});
     Cufon.replace('.cufon');
     Cufon.replace('.cufonh1');
	 
    $( ".select_normal, .select_61, .select_65, .select_81, .select_95, .select_133, .select_160, .select_162, .select_195" ).select_skin();

     /*$( ".datepicker" ).datepicker({
            showOn: "button",
            buttonImage: '/graph/choose-date.gif',
            buttonImageOnly: true,
            buttonText: "Wybierz...",
            dateFormat: "dd-mm-y"
     });*/
     /*
     $('a[rel*=facebox]').facebox({
        loading_image : '/js/loading.gif',
        close_image   : '/js/closelabel.png'
     });
     $(document).bind('afterReveal.facebox', function() {
        var windowHeight = $(window).height();
        var faceboxHeight = $('#facebox').height();
        if(faceboxHeight < windowHeight) {
            $('#facebox').css('top', (Math.floor((windowHeight - faceboxHeight) / 2) + $(window).scrollTop()) );
        }
    });
    */

    $('.advanced').toggle();
    var amount = 0;
    $('#chk-premium').click(function() {
         if( $(this).attr('checked') ) {
             $('#premium-options').removeClass('hide');
             $('#platnosci-form').removeClass('hide');
             $('#platnosci-payment').removeClass('hide');
             $('#normal-payment').addClass('hide');
             //alert( $("input[name='premium']:checked").attr('id') );
             amount = $("input[name='premium']:checked").attr('id')*100;
         } else {
             $('#premium-options').addClass('hide')
             $('#platnosci-form').addClass('hide');
             $('#platnosci-payment').addClass('hide');
             $('#normal-payment').removeClass('hide');
             amount = 0;
         }
         $("#amount").val(amount);
     });
    if( $('#chk-premium').attr('checked') ) {
         $('#premium-options').removeClass('hide');
         $('#platnosci-form').removeClass('hide');
         $('#platnosci-payment').removeClass('hide');
         $('#normal-payment').addClass('hide');
     } else {
         $('#premium-options').addClass('hide');
         $('#platnosci-form').addClass('hide');
         $('#platnosci-payment').addClass('hide');
         $('#normal-payment').removeClass('hide');
     }
     
     
     $('#chk-invoice').click(function() {
         if( $(this).attr('checked') ) {
             $('#invoice-form').removeClass('hide');
         } else {
             $('#invoice-form').addClass('hide')
         }
     });
    if( $('#chk-invoice').attr('checked') ) {
         $('#invoice-form').removeClass('hide');
     } else {
         $('#invoice-form').addClass('hide')
     }

    });
    


function removeDefaultValue(inputToSwap, defaultValue) {
    var inputValue = $('#' + inputToSwap).val();
    if (inputValue == defaultValue) {
            $('#' + inputToSwap).val("");
    }
}
function replaceDefaultValue(inputToSwap, defaultValue) {
    var inputValue = $('#' + inputToSwap).val();
    if (inputValue == "") {
            $('#' + inputToSwap).val(defaultValue);
    }
}

