$(function () { if ($(window).width() >= 960) { $('.menu .main_items li ul').hide(); $('.menu .main_items li').hover( function () { $('#menu .main_items li').not($('ul', this)).stop(); $('ul', this).slideDown(); }, function () { $('ul', this).stop(true, true).hide(); } ); } }); $(document).ready(function () { var blogpage = 1; $('.jq_blog_more').click(function () { blogpage += 1; $(this).attr('href', $(this).attr('href').replace(/([?|&]page=)[^\&]+/, '&page=' + blogpage)); $.get($(this).attr('href'), function (data) { $('.blogarticles').append(data); initAddthis(); }); return false; }); }); $(window).resize(function () { if ($(window).width() >= 960) { rowheights(); templatefeaturesfade(); $('#mainmenu .menu_mainlink').css('display','block'); } else { $('#mainmenu .menu_mainlink').css('display','none'); } centerVidSlides(); }); function isScrolledIntoView(elem) { var docViewTop = $(window).scrollTop(); var docViewBottom = docViewTop + $(window).height(); var elemTop = $(elem).offset().top; var elemBottom = elemTop + $(elem).outerHeight(); return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop)); } function templatefeaturesfade() { $(window).scroll( function() { $('.fademein').each ( function() { if (isScrolledIntoView($(this))) { $(this).fadeIn('slow'); } else { $(this).stop().fadeOut('fast'); } }); }) } function centerVidSlides() { var screenWidth = $( document ).width(); var obWidth = $('.videoSlide .wrap960').width(); var leftShift = (screenWidth/2) - (obWidth/2); $('.videoSlide .wrap960').css('left',leftShift); } $.fn.equalHeights = function (px) { $(this).each(function () { var currentTallest = 0; $(this).children().each(function (i) { if ($(this).height() > currentTallest) { currentTallest = $(this).height(); } }); if (!px && Number.prototype.pxToEm) currentTallest = currentTallest.pxToEm(); //use ems unless px is specified // for ie6, set height since min-height isn't supported if ($.support.boxModel && $.browser.version == 6.0) { $(this).children().css({ 'height': currentTallest }); } $(this).children().css({ 'min-height': currentTallest }); }); return this; }; function rowheights() { $('.equalheight').equalHeights(); $('.column .columnpadd').each(function () { var parentHeight = $(this).parent().height(); var thisPaddTop = $(this).css('padding-top'); var thisPaddBottom = $(this).css('padding-bottom'); var thisPaddTop = thisPaddTop.replace('px', ''); var thisPaddBottom = thisPaddBottom.replace('px', ''); $(this).css('min-height', parentHeight - thisPaddTop - thisPaddBottom); }); } $(document).ready(function () { $('#quotationform').submit(function(e){ var iserror = false; $('#quoteform .required').each( function () { if($(this).val() == '') { $(this).css('border','1px solid #FF0000'); iserror = true; } else { $(this).css('border','1px solid #FFFFFF'); } }); var callmename = $('input#callmename').val(); var callmecname = $('input#callmecompany').val(); var callmetel = $('input#callmetel').val(); var customertype = $('#customertype').val(); var enquirytype = $('#enquirytype').val(); var callmeemail = $('#callmeemail').val(); if (iserror == true) { e.preventDefault(); } else { e.preventDefault(); $.ajax({ url: "/p.dtx?f=captcha_validate.tem&t=page&a="+$("#captcha_answer").val(), dataType: "html", success:function(data){ if(data.search("true") !== -1){ $('#quotationform').html('
Submitting your request...
'); var dataString = 'name=' + callmename + '&cname=' + callmecname + '&tel=' + callmetel + '&customertype=' + customertype + '&enquirytype=' + enquirytype + "&email=" + callmeemail; $.ajax({ type: "POST", url: "/p.dtx?t=page&f=callmebacksubmit.tem", data: dataString, success: function () { $('#quotationform').html("
"); $('#message').html("

Thank you for your request.

") .append("

We will be in touch as soon as possible.

") .hide() .fadeIn(1500); } }); e.preventDefault(); } else{ alert("Please try answering the captcha again."); } } }); } }); $(function () { function gradRotate() { delayspeed = 1000; transitionspeed = 10000; $('.grad-rotate').delay(delayspeed).animate({ backgroundColor: '#d7df21' }, transitionspeed).animate({ backgroundColor: '#39b54a' }, transitionspeed).animate({ backgroundColor: '#8dc63f' }, transitionspeed).animate({ backgroundColor: '#13a89e' }, transitionspeed, gradRotate); } gradRotate(); }); $('.videoSlide .wrap960 img').fadeIn(3500); $('.videoSlide .wrap960 img').css('display','block'); $('#quotebutton').click(function () { $('#quoteform').slideToggle("fast", function () { // Animation complete. }); }); var slider = $('.bxslider').bxSlider({ adaptiveHeight: false, auto: true, pager: false, autoHover: true, pause: 6000 }); $("a[href='#top']").click(function () { $('html, body').animate({ scrollTop: 0 }, 'slow'); return false; }); $('#mobilemenu').click ( function() { $('.menu_mainlink').slideToggle(); }); $(window).resize(); });