DEFAULT_ANIMATION_TIME=500;$.fn.clickToAnother=function(method,$except){var $bodyElement=$(document.body);if($except.length){$except.each(function(){var $this=$(this);if(!$this.hasClass("clickToAnotherExcept")){$this.click(function(event){event.stopPropagation()}).addClass("clickToAnotherExcept")}})}return this.each(function(){var self=this;$bodyElement.one("click",function(event){if(event.target!=self){method.call(self)}})})};$.fn.textReplace=function(content){return this.each(function(){var i=0;var childLength=this.childNodes.length;while(i<childLength){if(this.childNodes[i].nodeType==3){this.childNodes[i].nodeValue=content;break}i++}})};$.fn.lookingFor=function(selector){var $foundedArray=$();this.each(function(){var $current=$(this);for(var i=0;i<10;i++){var $siblings=$current.siblings(selector);if($siblings.length){$foundedArray=$foundedArray.add($siblings);break}var $children=$current.find(selector);if($children.length){$foundedArray=$foundedArray.add($children);break}$current=$current.parent()}});return $foundedArray};$(function(){var $header=$("#body > section > header");var $h2=$header.find("h2");$h2.css({top:$header.height()/2-$h2.height()/2});$(".GetMore").click(function(){var $this=$(this);$this.lookingFor(".More").stop(true,true).slideToggle(DEFAULT_ANIMATION_TIME);$this.toggleClass("Open");return false});function DatePickerHide(){var $this=$(this);$this.html($this.find(".DatePickerWrap").html());$this.removeData("DatePickerInput")}var currentDate=new Date();function zeroFirst(number){var zero="";if(number<10){zero="0"}return zero+number}function dateToString(DateObject){return zeroFirst(DateObject.getDate())+"."+zeroFirst(DateObject.getMonth()+1)+"."+String(DateObject.getFullYear()).substring(2,4)}$(".Today").each(function(){var $this=$(this);$this.textReplace(dateToString(currentDate));var relation=$this.attr("rel");$this.closest("form").find("input[name='"+relation+"']").val(dateToString(currentDate))});$(".Datepicker").click(function(){$(document.body).click();var $this=$(this).css({position:"relative"});if($this.data("DatePickerInput")){return false}$this.wrapInner("<span class='DatePickerWrap'/>");var $input=$("<input/>").css({width:$this.width(),position:"absolute",padding:"3px",top:"-4px",left:"-5px"}).val($this.text());$input.appendTo($this);$this.data("DatePickerInput",true);if($this.hasClass("DoNothing")){$input.css({visibility:"hidden"});$input.datepicker({minDate:new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate()),onSelect:function(dateText,inst){$(document.body).click()}})}else{$input.datepicker({minDate:new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate()),onSelect:function(dateText,inst){$this.find(".DatePickerWrap").textReplace(dateText);var $form=$this.closest("form");var relation=$this.attr("rel");if(relation){$form.find("input[name='"+relation+"']").val(dateText)}if($this.attr("data-separated")&&$this.attr("data-separated").split("|").length){var separatedArray=$this.attr("data-separated").split("|");var separatedArrayLength=separatedArray.length;var i=0;var currentDateArray=[inst.selectedDay,inst.selectedMonth+1,inst.selectedYear];while(i<separatedArrayLength){$form.find("input[name='"+separatedArray[i]+"']").val(currentDateArray[i]);i++}}$this.addClass("Changed");$(document.body).click()}})}$input.datepicker("show");$this.clickToAnother(DatePickerHide,$("#ui-datepicker-div"));return false});$("#show-about").click(function(){if($.support.opacity){$("#popup-about").fadeIn(DEFAULT_ANIMATION_TIME)}else{$("#popup-about").show()}return false});$(".Popup .Close").click(function(){if($.support.opacity){$(this).closest(".Popup").fadeOut(DEFAULT_ANIMATION_TIME)}else{$(this).closest(".Popup").hide()}});var $popup=$(".Popup"),$window=$(window);$window.bind("resize scroll",function(){$popup.each(function(){var $this=$(this);$this.css({top:($window.height()/2-$this.height()/2)+$window.scrollTop()})})}).resize()});
