/* #On Document Ready ================================================== */ jQuery(document).ready(function() { var mobileAgent = navigator.userAgent.toLowerCase(); var mobileID = mobileAgent.match(/(iphone|ipod|ipad|android)/); /* Responsive Select Menu */ jQuery("#responsive-menu select").change(function() { window.location = jQuery(this).find("option:selected").val(); }); jQuery(".scalevid").fitVids(); menuHandler(); /* NAVIGATION INITALISATION */ initNav(); /* Footer Position Calculator */ footerHandler(); /* INIT THE QUOTES */ initQuotes(); /* CALLING TOOLTIPPS */ jQuery(".colexbutton").punchtip({}); /* INIT THE TOP SOCIALS */ initTopExpander(); /* INIT THE EXPAND COLLAPSE BUTTONS IN THE CONTENT */ initCollexButtons(); /* CALL TWITTER PLUGIN */ //initTwitter(); /* HOVERING ON ITEMS */ initHovering(); /* INIT SEARCH FIELD */ initSearchField(); /* INIT SOCIAL EXPANDER */ initSocialExpander(); /* INIT AUDIO PLAYER*/ initAudio(); /* INIT ACCORDION TOGGLES */ initAccordion(); /* Contact Form */ if(jQuery('#contactform').length != 0){ addForm('#contactform'); } /* Quick Contact */ if(jQuery('#quickcontact').length != 0){ addForm('#quickcontact'); } /* Blog Comments */ if(jQuery('#replyform').length != 0){ addForm('#replyform'); } /* FIXED HEIGHT FOR IMAGES */ if (jQuery.browser.msie && jQuery.browser.version<9) { // NO HEIGHT FIX IS NEEDED } else { //if (!mobileID) initFixedHeight(); } /* INIT LIGHTBOX **/ initLightboxPlugin(); /* TABS INIT */ tabsInit(); jQuery('.cont').find('.social_wrapper').each(function() { var wp=jQuery(this); var w=0; wp.find('a').each(function(i) { w=w+jQuery(this).outerWidth(true); }); wp.css({'width':w+"px"}); }); }); //////////////////////////////// // INITIALISATION OF LIGHTBOX // /////////////////////////////// function initLightboxPlugin() { jQuery(".lightbox").tplightboxsolo({ // Which Style should be used in the LightBox style:"dark-lightbox", // Which Social Items should be used on the Lightbox showGoogle:"off", showFB:"off", showTwitter:"off", // Which Divider should be used by Deep Link http://www.yourwebsite.com?id=1 deepLink:"true", urlDivider:"?", // YOUTUBE / VIMEO MARKUP - iframe example vimeo_markup:'', youtube_markup:'', flvmarkup:' ', flvplayer:'wp-content/themes/escalation/js/flowplayer_plugins/flowplayer-3.2.7.swf' }); } /////////////////////// // INIT FIXED HEIGHT // ////////////////////// function initFixedHeight() { jQuery('.portfolio .bordered, .teaser_div').each(function() { var bordered=jQuery(this); var img=bordered.find('img'); bordered.waitForImages(function() { setInterval(function() { if (bordered.height()>0 && bordered.data('adjusted') != "done") { bordered.height(Math.round(bordered.height())); bordered.data('adjusted','done'); } },100); }); }); } /////////////////////////// // INIT SOCIALEXPANDER // ////////////////////////// function initSocialExpander() { jQuery('.socialshare_wrap').each(function() { var wrap=jQuery(this); wrap.click(function() { var chef = jQuery(this).parent(); var expand=chef.find('.socialexpander'); chef.find('.sharings').each(function() { var soc=jQuery(this); if (soc.data('w') == undefined) soc.data('w',soc.outerWidth()); if (soc.data('ml')==undefined) soc.data('ml',soc.css('margin-left')); if (soc.data('mr')==undefined) soc.data('mr',soc.css('margin-right')); if (soc.hasClass('hidden')) { expand.addClass('selected'); soc.stop(); setTimeout(function() {soc.css({'display':'block'})},10); soc.animate({'margin-right':soc.data('mr'),'margin-left':soc.data('ml'),width:soc.data('w')+"px",'opacity':1},{duration:300,queue:false}); soc.removeClass('hidden'); } else { expand.removeClass('selected'); soc.stop(); soc.animate({'margin-left':'0px', 'margin-right':'0px', width:'1px','opacity':0.0},{duration:300,queue:false}); setTimeout(function() {soc.css({'display':'none'})},290); soc.addClass('hidden'); } }); }); wrap.click(); setTimeout(function() { wrap.css({'opacity':1});},300); }); } /////////////////////// // INIT SEARCH FIELD // ////////////////////// function initSearchField() { // Check the Search value on Standard jQuery("#Form_Search, #commentfields .InputBox, #commentfields .TextBox").each(function() { var field=jQuery(this); field.data('standard',field.val()); }); jQuery("#Form_Search, #commentfields .InputBox, #commentfields .TextBox").focus(function(){ var $this = jQuery(this); $this.val($this.val()== $this.data('standard') ? "" : $this.val()); }); jQuery("#Form_Search, #commentfields .InputBox, #commentfields .TextBox").blur(function(){ var $this = jQuery(this); $this.val($this.val()== "" ? $this.data('standard') : $this.val()); }); } ////////////////////////////// // ADD THE HOVERING EFFECTS // ///////////////////////////// ////////////////////////////// // ADD THE HOVERING EFFECTS // ///////////////////////////// function initHovering() { jQuery('.hovering').live("mouseenter", function() { var a = jQuery(this); var item=a.parent(); var img = item.find('img'); var src = img.attr('src'); var w = img.innerWidth(); var h = img.innerHeight();//+parseInt(img.css('marginBottom'),0); if (jQuery(window).width()>0) { if (w>30 && !a.hasClass("zoomanimon")) { // CLEAR THE REMOVEMENT IF THERE IS ANY ALREADY clearTimeout(item.data('timeout')); // IF THERE IS NO IMAGE YET, WE NEED TO ADD IT if (a.find('.himage').length==0) a.append('
'); // CATCH THE ITEMS WE NEED var newimg = item.find('.newimg'); var doverlay = item.find('.darker_overlay'); // STOP ANIMATION IF THERE IS ANY newimg.stop(true,true); doverlay.stop(true,true); // ANIMATE THE ITEM HERE doverlay.css({'opacity':0}).animate({'opacity':1},{duration:400,queue:false}); var factor = 1.10; if (w<150) factor=1.10; var factor=factor-1; var sp=w*(factor*2); // SPEED DEPENDING ON SIZING DIFFERENTS if (sp<50) sp=sp*8; else if (sp<200) sp=sp*3; else if (sp>400) sp=sp/1.5; newimg.data('ww',w); newimg.data('hh',h); newimg.data('sp',sp); //if (!jQuery('body').hasClass('nozoom')) // newimg.animate({'top':(-h*factor)+"px",'left':(-w*factor)+'px','width':(w*(1 + factor*2))+'px','height':(h*(1+factor*2))+"px"},{duration:(sp),queue:false, easing:"linear"}); // ADD LINK AND PLUS BUTTONS HERE var plus=""; var link=""; var tt=""; var delay=0; if (a.hasClass("lightbox") && (w>80 || a.attr('href').length==0)) { if (doverlay.find('.hover_plus').length==0) doverlay.append('
'); plus=doverlay.find('.hover_plus'); plus.css({'opacity':0}); } if (a.attr('href').length>0 ) { if (doverlay.find('.hover_link').length==0) doverlay.append(''); link=doverlay.find('.hover_link'); link.css({'opacity':0}); } if (plus!="" && link!="") { var pl = plus.position().left; var ll = link.position().left; plus.css({'left':(pl-23)+"px"}); link.css({'left':(ll+23)+'px'}); a.css({'cursor':'default'}); plus.css({'cursor':'pointer'}); link.css({'cursor':'pointer'}); } // ADD THE TITLE IF THERE IS ANY if (a.data('title')!=undefined && a.data('title').length>0 && w>80) { if (doverlay.find('.teaser_title').length==0) doverlay.append('
'+a.data('title')+'
'); tt = doverlay.find('.teaser_title'); tt.css({'opacity':0}); var tth=tt.outerHeight(); var dif = h/2 - (h/2 - tth/2); if (plus!="") var pt = plus.position().top; else var pt=500; if (link!="") { var lt = link.position().top; if (link!="") link.css({'top':(lt-dif)+"px"}); } if (plus!="") plus.css({'top':(pt-dif)+"px"}); } // Animate the small Parts as well if (tt!="") { tt.css({'bottom':'-='+tt.outerHeight()}); setTimeout(function() {tt.animate({'bottom':'0px','opacity':1},{duration:300,queue:false})},delay); delay=delay+0; } if (plus!="") { pt = plus.position().top; plus.css({'top':(pt-10)+'px'}); setTimeout(function() {plus.animate({'top':(pt)+'px','opacity':0.75},{duration:300,queue:false})},delay); delay=delay+0; setTimeout(function() { plus.hover( function() { var button=jQuery(this); button.stop(); button.animate({'opacity':1},{duration:300,queue:false}); }, function() { var button=jQuery(this); button.stop(); button.animate({'opacity':0.75},{duration:300,queue:false}); }); },300); } if (link!="") { lt = link.position().top; link.css({'top':(lt-10)+'px'}); setTimeout(function() {link.animate({'top':(lt)+'px','opacity':0.75},{duration:300,queue:false})},delay); delay=delay+0; setTimeout(function() { link.hover( function() { var button=jQuery(this); button.stop(); button.animate({'opacity':1},{duration:300,queue:false}); }, function() { var button=jQuery(this); button.stop(); button.animate({'opacity':0.75},{duration:300,queue:false}); }); link.click(function() { if (a.attr('target') == undefined) window.location.href = a.attr('href') else window.open(a.attr('href'),a.attr('target')); }); },300); } } else { if (!jQuery(this).hasClass("zoomanimon")) { jQuery(this).closest('.bordered').stop(); jQuery(this).closest('.bordered').animate({ borderColor: "#fff" },{duration:600,queue:false}); } } } else { a.css({'cursor':'pointer'}); a.click(function() { if (a.attr('target') == undefined) window.location.href = a.attr('href') else window.open(a.attr('href'),a.attr('target')); }); } }); // REMOVE THE ZOOMED IMAGE FROM TEASER jQuery('.hovering').live("mouseleave", function() { // CATCH THE ITEMS WE NEED var item = jQuery(this).parent(); var img = item.find('img'); var newimg = item.find('.newimg'); var doverlay = item.find('.darker_overlay'); // STOP THE ANIMATION IS THERE ANY newimg.stop(); doverlay.stop(); doverlay.find('.teaser_title').remove(); doverlay.find('.hover_link').remove(); doverlay.find('.hover_plus').remove(); // ZOOM BACK, AND THAN REMOVE WHAT WE DONT NEED ANY MORE var ww=newimg.data('ww'); var hh=newimg.data('hh'); var sp=newimg.data('sp'); doverlay.animate({'opacity':0},{duration:sp,queue:false}); //if (!jQuery('body').hasClass('nozoom')) // newimg.animate({'top':"0px",'left':'0px','width':ww+'px','height':hh+"px"},{duration:sp,queue:false, easing:"linear"}); item.data('timeout',setTimeout(function() {item.find('.himage').remove()},sp)); jQuery(this).closest('.bordered').stop(); jQuery(this).closest('.bordered').animate({ borderColor: "#1e1e1e" },{duration:600,queue:false}); }); } ////////////////////////////// // NAVIGATION INITALISATION // ////////////////////////////// function initNav() { var nav = jQuery('#nav'); nav.find('ul li ul').each(function() { var li=jQuery(this).find('>li').last(); li.addClass('last'); }); nav.find(' li ul li ul').each(function() { jQuery(this).addClass("subsub"); }); nav.find('ul').each(function(i) { var ul =jQuery(this); ul.data('height',ul.outerHeight()); if (!ul.hasClass('subsub')) { ul.animate({'height':'0px'},{duration:230,queue:false}); } else { } }); /* NAVIGATION */ nav.find('li').each(function() { jQuery(this).hover( function() { var ul=jQuery(this).find('ul:first'); if (!ul.hasClass('subsub')) { ul.stop(); clearTimeout(ul.data('timeout')); clearTimeout(ul.data('timeout2')); ul.css({'display':'block','overflow':'visible'}); ul.animate({'height':ul.data('height')+"px", 'opacity':1.0},{duration:ul.data('height')*4,queue:false,easing:"easeOutExpo"}); } else { //alert((ul.parent().offset().left+ul.parent().width()+ul.width())+" "+jQuery(window).width()); if ((ul.parent().offset().left+ul.parent().width()+ul.width())>jQuery(window).width()) ul.css({'left':'-232px'}) else ul.css({'left':'170px'}) } }, function() { var ul=jQuery(this).find('ul:first'); ul.stop(); if (!ul.hasClass('subsub')) { ul.animate({'height':'0px','opacity':1},{duration:10,queue:false}); ul.data('timeout2',setTimeout(function() { ul.css({'display':'none'}); },10)); } else { } }); }); } /*********************/ /* Footer Handler */ /********************/ function footerHandler() { jQuery(window).resize(function() { organiseBgs(); setQuotePosition(); }); setInterval(function() { var maxh=0; jQuery('#footer').find('.four.columns').each(function() { if (jQuery(this).height()>maxh) maxh=jQuery(this).innerHeight(); }); jQuery('#footer').find('.four.columns').each(function() { if (jQuery(this).width()<300) jQuery(this).height(maxh) else jQuery(this).css({'height':'100%'}); }); organiseBgs(); },1500); } //////////////////////////////////////// // CALL BACK A FUNCTION x MANY Times // /////////////////////////////////////// function callBackBgs(times) { var countme=0; var CallBackBg = setInterval(function() { organiseBgs(); countme=countme+10; if (countme>=times) { clearInterval(CallBackBg); } },10); } ////////////////////////////////////////////////////////// // PUT THE FOOTER,CONTAINER ETC. IN THE RIGHT POSITION // ///////////////////////////////////////////////////////// function organiseBgs() { var mainh = 0; jQuery('#content_container.container, .calc_container').each(function(i) { mainh=mainh+jQuery(this).outerHeight(); }); var footer = jQuery('#footer'); var footerh = footer.find('div:first').outerHeight(); var windowh = jQuery(window).height(); var windoww = jQuery(window).width(); var topbg=jQuery('#topholder_bg'); var contbg=jQuery('#container_bg'); var footerbg = jQuery('#footer_bg'); var bottombg = jQuery('#bottomholder_bg'); contbg.css({'left':(windoww/2 - contbg.width()/2)+"px"}); contbg.height(windowh*2); footerbg.stop(); footerbg.height(footerh); var dif = windowh - (mainh+footerh); if (dif>0) { footer.animate({'marginTop':dif+"px"},{duration:600,queue:false}); } if (dif<0) { footer.stop(); footer.animate({'marginTop':"0px"},{duration:600,queue:false}); } } ////////////////// // INIT TWITTER // ////////////////// function initTwitter() { jQuery('#twitter_feed').twitterReader({ user:'envato', count:3 }); } /////////////////////////////// // TOP EXPANDER FUNCTION // ///////////////////////////// function initTopExpander() { jQuery('#topwrapper .expander').click(function() { var exp = jQuery(this); var th = jQuery('#topwrapper .expandable'); var thbg = jQuery('#topholder_bg'); th.slideToggle(400); thbg.slideToggle(400); if (exp.hasClass('selected')) { exp.removeClass('selected') } else { exp.addClass('selected'); } }); jQuery('#bottomwrapper .expander').click(function() { var exp = jQuery(this); var th = jQuery('#bottomwrapper .expandable'); var bg = jQuery('#bottomholder_bg'); th.slideToggle(400); bg.slideToggle(400); jQuery("html").animate({ scrollTop: jQuery(document).height() }, 400); if (exp.hasClass('selected')) exp.removeClass('selected') else exp.addClass('selected'); return false; }); } //////////////////////////////////////////// // COLLAPSE / EXPANDABLE CONTENT FUNCTION // //////////////////////////////////////////// function initCollexButtons() { jQuery('.colexbutton').each(function() { var button=jQuery(this); var par=button.parent().parent(); par.css({'cursor':'pointer'}); var excontent = jQuery('#'+button.data('idlink')); var fdiv=button.closest('.divide'); if (par.data('mb')==undefined) par.data('mb',par.css('marginBottom')); par.click(function() { var but=jQuery(this).find('.colexbutton'); var mobileAgent = navigator.userAgent.toLowerCase(); var mobileID = mobileAgent.match(/(iphone|ipod|ipad|android)/); var speed=400; if (mobileID) speed=10; if (but.hasClass("expand")) { but.addClass("collapse").removeClass("expand") but.data('title','Collapse'); //jQuery('#tooltip').html(''+but.data('title')+''); excontent.find('div:first').delay(200).slideDown(speed,function() {organiseBgs();}); if (!mobileID) callBackBgs(600); //if (par.hasClass("last")) par.animate({'margin-bottom':par.data('mb')+"px"},{duration:speed/2,queue:false}); } else { but.addClass("expand").removeClass("collapse") but.data('title','Expand'); jQuery('#tooltip').html(''+but.data('title')+''); /*if (parseInt(fdiv.css('marginBottom'),0)!=10) button.closest('.divide').delay(speed).animate({'margin-bottom':'-55px'},{duration:speed}); */ excontent.find('div:first').slideUp(speed,function() {organiseBgs();}); if (!mobileID) callBackBgs(800); //if (par.hasClass("last")) setTimeout(function() { par.animate({'margin-bottom':"1px"},{duration:speed/2,queue:false}); },speed); } return false; }); }); } //////////////////////////// // QUOTES CORRECTION // ////////////////////////// function setQuotePosition() { jQuery("#quotes_carousel").each(function() { var ca=jQuery(this); ca.find('li').each(function(i){ var li=jQuery(this); var quo=li.find('.quote') quo.css({'paddingTop':(li.height()-quo.height())/2+"px"}); }); }); } ////////////// // QUOTES // ///////////// function initQuotes() { setQuotePosition(); jQuery("#quotes_carousel").each(function() { var qspeed = 10000000; qspeed=700; var qdelay = 30000000; if (qdelay==0) qdelay=99999999999999; var ca=jQuery(this); ca.find('li').each(function(i){ var li=jQuery(this); li.css({'position':'absolute','top':'-30px', 'opacity':0,'display':'block'}); if (i==0) { li.addClass('selectedquote'); setTimeout(function() { var endt = 0; ca.find('.selectedquote').css({'top':'-50px','opacity':0}).animate({'top':endt+'px','opacity':1},{duration:qspeed,queue:false}); setTimeout(function() { setQuotePosition(); var actli=ca.find('.selectedquote').index(); var nextli=actli+1; if (nextli==ca.find('li').length) nextli=0; ca.find('.selectedquote').addClass('oldquote').removeClass('selectedquote') ca.find('li:eq('+nextli+')').addClass('selectedquote'); },10); },2000); } }); setInterval(function() { var endt = 0; if (jQuery.browser.msie && jQuery.browser.version<9) { ca.find('.oldquote').animate({'top':'230px','opacity':0},{duration:(qspeed-300),queue:false}); } else { ca.find('.oldquote').animate({'top':'30px','opacity':0},{duration:(qspeed-300),queue:false}); } ca.find('.selectedquote').css({'top':'-30px'}).animate({'top':endt+'px','opacity':1},{duration:qspeed,queue:false}); setTimeout(function() { setQuotePosition(); var actli=ca.find('.selectedquote').index(); var nextli=actli+1; if (nextli==ca.find('li').length) nextli=0; ca.find('.selectedquote').addClass('oldquote').removeClass('selectedquote') ca.find('li:eq('+nextli+')').addClass('selectedquote'); },10); },qdelay); }); } /*********************/ /* Menu Handler */ /*******************/ function menuHandler() { var defpar = jQuery('#nav').parents().length; jQuery('#nav li >a').each(function() { var a=jQuery(this); var par= a.parents().length-defpar -3; if (par==0) var newtxt=jQuery("
"+a.text()+"
").text(); else if (par==2) var newtxt=jQuery("
   "+a.text()+"
").text(); else if (par==4) var newtxt=jQuery("
      "+a.text()+"
").text(); jQuery('#responsive-menu select').append(new Option(newtxt,a.attr('href')) ); }); var aktmenu=jQuery('.current_page_item a:first').text(); jQuery('#responsive-menu-button').html(aktmenu); /*jQuery('#responsive-menu-button').click(function() { var drop=jQuery('#responsive-menu select'); if (!drop.hasClass('selected')) { drop.addClass('selected'); jQuery(this).css({'marginBottom':'0px','opacity':1}); } else { drop.removeClass('selected'); jQuery(this).css({'marginBottom':'0px'});//,'opacity':0}); } });*/ var deviceAgent = navigator.userAgent.toLowerCase(); var agentID = deviceAgent.match(/(iphone|ipod|ipad)/); if (agentID) { jQuery('#responsive-menu select').addClass('apple'); } } function initAudio(){ jQuery('audio,video').mediaelementplayer({ pluginPath: 'wp-content/themes/escalation/js/default.htm', // name of flash file flashName: 'flashmediaelement.swf', // name of silverlight file silverlightName: 'silverlightmediaelement.xap', success: function(player, node) { jQuery('#' + node.id + '-mode').html('mode: ' + player.pluginType); } }); } /* * Skeleton V1.1 * Copyright 2011, Dave Gamache * www.getskeleton.com * Free to use under the MIT license. * http://www.opensource.org/licenses/mit-license.php * 8/17/2011 */ jQuery('body').on('click', 'ul.tabs > li > a', function(e) { //Get Location of tab's content var contentLocation = $(this).attr('href'); //Let go if not a hashed one if(contentLocation.charAt(0)=="#") { e.preventDefault(); //Make Tab Active $(this).parent().siblings().children('a').removeClass('active'); $(this).addClass('active'); //Show Tab Content & add active class $(contentLocation).show().addClass('active').siblings().hide().removeClass('active'); } }); ////////////////////// // INIT ACCORDION // ///////////////////// function initAccordion() { jQuery('.accordion-item').each(function(i) { var item=jQuery(this); item.find('.togglecontent').slideUp(0); item.find('.accordion_down, .accordionopen').click(function() { var displ = item.find('.togglecontent').css('display'); item.closest('ul').find('.toggleswitch').each(function() { var li = jQuery(this).closest('li'); li.find('.togglecontent').slideUp(300); li.find('.toggleswitch').removeClass("selected"); li.removeClass('highlight'); }); if (displ=="block") { item.find('.togglecontent').slideUp(300) item.find('.toggleswitch').removeClass("selected"); item.removeClass('highlight'); } else { item.find('.togglecontent').slideDown(300) item.find('.toggleswitch').addClass("selected"); item.addClass('highlight'); } }); }); } function tabsInit() { /* * Skeleton V1.1 * Copyright 2011, Dave Gamache * www.getskeleton.com * Free to use under the MIT license. * http://www.opensource.org/licenses/mit-license.php * 8/17/2011 */ /* Tabs Activiation ================================================== */ var tabs = jQuery('ul.tabs'); tabs.each(function(i) { //Get all tabs var tab = jQuery(this).find('> li > a'); tab.click(function(e) { //Get Location of tab's content var contentLocation = jQuery(this).attr('href'); //Let go if not a hashed one if(contentLocation.charAt(0)=="#") { e.preventDefault(); //Make Tab Active tab.removeClass('active'); jQuery(this).addClass('active'); //Show Tab Content & add active class jQuery(contentLocation).show().addClass('active').siblings().hide().removeClass('active'); } }); }); } /* #Forms ================================================== */ function addForm(formtype) { var formid = jQuery(formtype); var emailsend = false; formid.find("a[name=send]").click(sendemail); function validator() { var emailcheck = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; var othercheck = /.{4}/; var noerror = true; formid.find(".requiredfield").each(function () { var fieldname = jQuery(this).attr('name'); var value = jQuery(this).val(); if(value == "Name *" || value == "Email *" || value == "Message *"){ value = ""; } if(fieldname == "email"){ if (!emailcheck.test(value)) { jQuery(this).addClass("formerror"); noerror = false; } else { jQuery(this).removeClass("formerror"); } }else{ if (!othercheck.test(value)) { jQuery(this).addClass("formerror"); noerror = false; } else { jQuery(this).removeClass("formerror"); } } }) if(!noerror){ formid.find(".errormessage").fadeIn(); } return noerror; } function resetform() { formid.find("input").each(function () { jQuery(this).val(""); }) formid.find("textarea").val(""); emailsend = false; } function sendemail() { formid.find(".successmessage").hide(); var phpfile = ""; if(formtype=="#contactform"){ phpfile = "wp-content/themes/escalation/forms/contact.php"; }else if(formtype=="#quickcontact"){ phpfile = "wp-content/themes/escalation/forms/quickcontact.php"; }else{ phpfile = ""; } if (validator()) { if(!emailsend){ emailsend = true; formid.find(".errormessage").hide(); formid.find(".sendingmessage").show(); jQuery.post(phpfile, formid.serialize(), function() { formid.find(".sendingmessage").hide(); formid.find(".successmessage").fadeIn(); resetform(); }); } } return false } } jQuery(window).load(function(){ (function(d, s, id) { if(jQuery(".fb-like").length) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "../../connect.facebook.net/en_US/all.js"; fjs.parentNode.insertBefore(js, fjs); } }(document, 'script', 'facebook-jssdk')); });