var mq = window.matchMedia( "(min-width: 58.75em)" ); // Vertically Align $(document).ready(function() { (function ($) { $.fn.vAlign = function() { return this.each(function(i){ var ah = $(this).height(); var ph = $(this).parent().height(); var mh = Math.ceil((ph-ah) / 2); $(this).css('margin-top', mh); }); }; })(jQuery); if (mq.matches) { $(window).load(function() { $('.ff-valign').vAlign(); }); $(window).resize(function(){ $('.ff-valign').vAlign(); }); } else { // window width is less than 58.75em } }); // Back to Top $('a[href=#ff-back-top-link]').on('click', function(){ $('html, body').animate({scrollTop:0}, 'slow'); return false; }); // Remove Class $(document).ready(function() { $('#uName').removeClass('ccm-input-text'); $('#uEmail').removeClass('ccm-input-text'); }); // Add Class $(document).ready(function() { $('.ccm-search-block-submit').addClass('button secondary small'); $('.formBlockSubmitButton').addClass('button secondary small'); $('.guestBook-formBlock .button').addClass('button secondary small ff-mar-top-medium'); $('.poll input[type="submit"]').addClass('button secondary small ff-mar-top-small'); }); // Show Back To Top when height > 100% $(document).ready(function() { if ($("body").height() > $(window).height()) { $('#ff-back-top').show(); } }); // Remove Element $(document).ready(function() { $('.guestBook-formBlock br').remove(); }); // Better Contact Form $(document).ready(function() { if ($('.formBlockSurveyTable').length > 0){ $('table.formBlockSurveyTable').replaceWith( $('table').html() .replace(//gi, "
") .replace(//gi, "
") .replace(/<\/tr>/gi, "
") .replace(//gi, "") .replace(/<\/td>/gi, "") .replace(/<\/tbody>/gi, "<\/div>") ); } }); $( document ).ready(function() { // Equal Height equalheight = function(container){ var currentTallest = 0, currentRowStart = 0, rowDivs = new Array(), $el, topPosition = 0; $(container).each(function() { $el = $(this); $($el).height('auto') topPostion = $el.position().top; if (currentRowStart != topPostion) { for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { rowDivs[currentDiv].height(currentTallest); } rowDivs.length = 0; // empty the array currentRowStart = topPostion; currentTallest = $el.height(); rowDivs.push($el); } else { rowDivs.push($el); currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest); } for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { rowDivs[currentDiv].height(currentTallest); } }); } if (mq.matches) { $(window).load(function() { equalheight('.ff-equal'); }); $(window).resize(function(){ equalheight('.ff-equal'); }); } else { // window width is less than 58.75em } }); //Transparency var rRgba = /^rgba\((\d+),\s*(\d+),\s*(\d+)\,\s*(\d+(\.\d+)?)\)$/, rRgb = /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/ function getRgbaColorValue(el) { var bg = $.css(el, 'background-color'); if (bg.indexOf('rgba') !== -1) { bg = rRgba.exec (bg); } else { bg = rRgb.exec (bg); bg[4] = 1; } return bg; }; $.cssNumber.backgroundColorAlpha = true; $.cssHooks.backgroundColorAlpha = { get: function(el) { var rgba = getRgbaColorValue(el); return rgba[4]; }, set: function(el, value) { var rgba = getRgbaColorValue(el); el.style.backgroundColor = 'rgba(' + rgba[1] + ',' + rgba[2] + ',' + rgba[3] + ',' + value + ')'; } }; $.fx.step.backgroundColorAlpha = function(fx) { $.cssHooks.backgroundColorAlpha.set(fx.elem, fx.now + fx.unit); }; var $main = $('.ff-transparent'); $main.animate({ 'background-color-alpha': 0.9 }, 0); //Labels $(document).ready(function(){ //Success $('.success-label').addClass('label'); $('.success-label').addClass('success'); $('.success-label').removeClass('success-label'); //Alert $('.alert-label').addClass('label'); $('.alert-label').addClass('alert'); $('.alert-label').removeClass('alert-label'); //Secondary $('.secondary-label').addClass('label'); $('.secondary-label').addClass('secondary'); $('.secondary-label').removeClass('secondary-label'); }); //Keystrokes $(document).ready('each', function(){ $(".keystroke").replaceWith('' + $(".keystroke").html() + ""); });