var mobile=function(){return{detect:function(){var a=navigator.userAgent.toLowerCase();var c=this.mobiles;var b=false;for(var e=0;e<c.length;e+=1){if(a.indexOf(c[e])!=-1){b=true}}return b},mobiles:["midp","240x320","blackberry","netfront","nokia","panasonic","portalmmm","sharp","sie-","sonyericsson","symbian","windows ce","benq","mda","mot-","opera mini","philips","pocket pc","sagem","samsung","sda","sgh-","vodafone","xda","palm","iphone","ipod","android"]}}();var isiPad=(navigator.userAgent.toLowerCase().match(/iPad/i)!=null)||(navigator.userAgent.toLowerCase().match(/iPhone/i)!=null)||(navigator.userAgent.toLowerCase().match(/android/i)!=null);if(isiPad){window.addEventListener("onorientationchange" in window?"orientationchange":"resize",resizeContent,false)}var isReady=false;var interval;var scroller;var jspApi;var iscroll;$(window).bind("load",function(){if(!isReady){interval=setInterval(function(){if(isReady){clearInterval(interval);pageLoaded()}},1000)}else{pageLoaded()}});function pageLoaded(){initLightbox();resizeContent()}function initScroll(){scroller=$("#scroller");if(!isiPad){scroller.jScrollPane();jspApi=scroller.data("jsp")}else{document.addEventListener("touchmove",function(a){a.preventDefault()});iscroll=new iScroll("scroller",{bounceLock:true,checkDOMChanges:false})}isReady=true}function initLightbox(){if(is_lightbox){$(".lightbox").lightbox({textClose:closeText})}}function reinitialiseScroll(){if(scroller.size()==0){return}if(!isiPad){jspApi.reinitialise();if(!jspApi.getIsScrollableV()){scroller.find(".jspPane").css({top:"0px"})}}else{iscroll.refresh()}}$(document).ready(function(){initScroll();if($("#collection").size()){var c=$("#collection .slider-image img").size();if(c>0){var d=getContentHeight();var b=getContentWidth();if(!isiPad){scroller.css("height",d)}else{$("#main").css("height",d)}var a=$("#collection .slider-image img");a.each(function(){if($(this)[0].complete){$(this).attr("height",d);$(this).animate({opacity:1},300);if($("#content").width()<b){scroller.css("width",b)}else{scroller.css("width",$("#content").width())}reinitialiseScroll()}else{$(this).load(function(){$(this).attr("height",d);$(this).animate({opacity:1},300);if($("#content").width()<b){scroller.css("width",b)}else{scroller.css("width",$("#content").width())}reinitialiseScroll()})}})}}if($(".collapse").size()){$("ul.collapse li a").each(function(){$(this).click(function(i){if(!$(this).parents(".opacity10").size()){var g=$(this).attr("rel").split("-");var h=$(this);var j=$.getUID();h.parent("div").append('<div class="information" id="'+j+'">');h.prev("span").addClass("ico_close");h.parent("div").addClass("opacity10");var f="mode="+g[0]+"&postID="+g[1];$.ajax({beforeSend:function(){h.next(".information").html(loadingText)},type:"POST",url:absPaht+"ajax.php",data:f,success:function(e){h.next(".information").html(e)},complete:function(){initLightbox();var l=$("#"+j).find("img").size();if(l>0){var k=0;var e=$("#"+j).find("img");e.each(function(){if($(this)[0].complete){k++;if(k>=l){resizeContent()}}else{$(this).load(function(){k++;if(k>=l){resizeContent()}})}})}else{resizeContent()}}})}xclose();i.preventDefault()})})}if($("#formcontact").size()){$("#formcontact").submit(function(i){var h=$(this).find(".obligatorio");var g=false;h.each(function(){var j=$(this).val();var e=+($(this).attr("name"))?$(this).attr("name"):$(this).attr("id");if(j==0||!j){$(this).focus();$(this).addClass("errorInput");g=true;return false}else{var k=$(this).attr("valid");switch(k){case"mail":if(!isEmailAddress(j)){g=true;$(this).focus();$(this).addClass("errorInput");return false}break;case"checkbox":if(!$(this).is(":checked")){g=true;$(this).focus();$(this).addClass("errorInput");$(this).css("border","red");return false}break}}$(this).removeClass("errorInput")});if(g){i.preventDefault()}else{var f="mode=contact";$("#formcontact :input").each(function(){if(!$(this).is(":submit")){var j=$(this).val();var e=+($(this).attr("name"))?$(this).attr("name"):$(this).attr("id");f+="&"+e+"="+j}});$.ajax({beforeSend:function(){$("#btnSubmit").hide()},type:"POST",url:absPaht+"ajax.php",data:f,success:function(e){$("#formcontact").css("opacity","0");$("#contact_info").html(e)}})}i.preventDefault()})}});$(window).resize(function(){resizeContent()});function resizeContent(){var b=getContentHeight();var a=getContentWidth();if(!isiPad){scroller.css("height",b)}else{$("#main").css("height",b)}$(".slider-image img").each(function(){$(this).attr("height",b)});if($("#content").width()<a){scroller.css("width",a)}else{scroller.css("width",$("#content").width())}reinitialiseScroll()}function getContentHeight(){return($(window).height()-$("#header").height())}function getContentWidth(){return $(window).width()}function xclose(){$(".ico_close").unbind("click");$(".ico_close").click(function(c){var b=$(this);var a=b.parents(".opacity10");a.find(".information").remove();b.removeClass("ico_close");a.removeClass("opacity10");resizeContent();c.preventDefault()})}function isEmailAddress(a){var c=a;var b=/^[A-Za-z-_.][A-Za-z0-9_.-]*@[A-Za-z0-9_-]+\.[A-Za-z0-9_.-]+[A-za-z]$/;if(c.length==0){return false}if(b.test(c)){return true}else{return false}}function get(a){return $("#"+a).val()}(function(b){var a=0;b.getUID=function(){a++;return"jQ-uid-"+Math.floor(Math.random()*11)};b.fn.getUID=function(){if(!this.length){return 0}var c=this.first(),d=c.attr("id");if(!d){d=b.getUID();c.attr("id",d)}return d}})(jQuery);$("<div>").getUID();
