$(document).ready(function() {
    /*
    var packshotAnim = function () {
        if (pageHeight() <= 628) {
            $('#packshotsOrderFreeSample, #packshotsWith').animate({top:'-185'}, 1500);
        }
    };
    */
    
    /*****************************
    * Submit formularza
    *
    ******************************/
    $('._submitBtn').click(function() {
        $('#'+$(this).attr('rel')).submit();
        return false;
    });
    //select OPT by J. Kr�lewski
	$('.selectGrphBox').click(function() {
        $this=$(this);
        $looking=($this).find(".selectGrph");
        if (($looking).hasClass("show")){ 
                $($looking).slideUp("0.1");
                $($looking).removeClass("show");
            }
            else
            {
                $($looking).addClass("show");
                $($looking).slideDown("0.1");
            }
		return false;
	});
    $(".selectGrph li a").click(function () {
      $this=$(this);
      var htmlStr = $($this).html();
      $this.parent().parent().parent().find("span").text(htmlStr);
      
      var params = $(this).attr('rel');
      $('#params').attr('value', params);
		
    });

    $('#checkBoxArea').css('opacity', 0.8);
    
    /**
     * Setting the hidden input by "a" element
     * 
     */
    $('.dhtml_list').click(function() {
        var $this = $(this);
        var input_name = $this.parent().parent().attr('id');
        input_name = input_name.replace('dhtml_','');
        $('input[name="'+input_name+'"]').val($(this).html());
    });
    
    
    jQuery.each(jQuery.browser, function(i) {
    	  if($.browser.safari){
    	     $(".dataWidth li").css("width","32px");
    	     $(".yearWidth li").css("width","42px");
    	     
    	  }
    	  if($.browser.chrome){
     	     $(".dataWidth li").css("width","36px");
     	     $(".yearWidth li").css("width","62px");
     	     
     	  }
    	});
	$('.selectGrphBox').show();
});



jQuery.fn.packshotAnim = function(){
    if (pageHeight() <= 628) {
        $('#packshotsOrderFreeSample, #packshotsWith, #packshotsEmpty').animate({top:'-185'}, 1500);
    }
};

jQuery.fn.packshotAnimReverse = function(){
    $('#packshotsOrderFreeSample, #packshotsWith, #packshotsEmpty').animate({top:'-90'}, 1500);
};

function pageWidth() {return window.innerWidth != null? window.innerWidth: document.body != null? document.body.clientWidth:null;}
function pageHeight() {return window.innerHeight != null? window.innerHeight: document.body != null? document.body.clientHeight:null;}
