
$(document).ready(function(){function contact(){if($("#contactForm").is(":hidden")){$("#contactForm").slideDown("slow");$("#backgroundPopup").css({"opacity":"0.7"});$("#backgroundPopup").fadeIn("slow");}
else{$("#contactForm").slideUp("slow");$("#backgroundPopup").fadeOut("slow");}}
$(".contact").click(function(){contact()});$('a[href*=#]').each(function(){if(location.pathname.replace(/^\//,'')==this.pathname.replace(/^\//,'')&&location.hostname==this.hostname&&this.hash.replace(/#/,'')){var $targetId=$(this.hash),$targetAnchor=$('[name='+this.hash.slice(1)+']');var $target=$targetId.length?$targetId:$targetAnchor.length?$targetAnchor:false;if($(this.hash).length){$(this).click(function(event){var targetOffset=$(this.hash).offset().top;var target=this.hash;event.preventDefault();$('html, body').animate({scrollTop:targetOffset},500);return false;});}}});$('.contactForm').submit(function(){var filter=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;var email=document.getElementById('e-mail');if(!filter.test(email.value)){$('.email-missing').show();}else{$('.email-missing').hide();}
if(trim(document.cform.name.value)==""){$('.name-missing').show();}else{$('.name-missing').hide();}
if(trim(document.cform.message.value)==""){$('.message-missing').show();}else{$('.message-missing').hide();}
if((trim(document.cform.name.value)=="")||(!filter.test(email.value))||(trim(document.cform.message.value)=="")){return false;}
if((document.cform.name.value!="")&&(filter.test(email.value))&&(document.cform.message.value!="")){$('.contactForm').hide();$('.loader').append($('.bar'));$('.bar').css({display:'block'});$.get('mail.php',{name:$('#name').val(),email:$('#e-mail').val(),message:$('#message').val()},function(data){if(data==0)
{$('.bar').css({display:'none'});$('.contactForm').show();$('.ap_content').hide();$('.err_msg').show();}
else
{$('.bar').css({display:'none'});$('.loader').append(data);setTimeout('$("#backgroundPopup").fadeOut("slow"); $("#contactForm").slideUp("slow")',1500);}});return false;}});$("#backgroundPopup").css({"height":document.documentElement.clientHeight});});function LTrim(value){var re=/\s*((\S+\s*)*)/;return value.replace(re,"$1");}
function RTrim(value){var re=/((\s*\S+)*)\s*/;return value.replace(re,"$1");}
function trim(value){return LTrim(RTrim(value));}