(function ($) { $(document).ready(function () { $('.slider').cycle({ fx: 'fade', timeout: 0, height: 'auto', pause: '', next: '.comments' }); $('.frm form').validate(); $('.frmW form').validate(); $('.second form').validate(); $('.feedback form').validate(); $(".fancybox").fancybox(); //$(".iframe").fancybox(); // Grab the current date var currentDate = new Date(); // Set some date in the future var futureDate = new Date(apishopsActionDate('date')); // Calculate the difference in seconds between the future and current date var diff = futureDate.getTime() / 1000 - currentDate.getTime() / 1000; if (diff < 0) diff = 0; //Instantiate a coutdown FlipClock var clock = $('.clock').FlipClock(diff, { clockFace: 'DailyCounter', language: 'ru', countdown: true }); }); })(jQuery); (function ($) { $(document).ready(function(){ $('a[href*=youtube]').each(function () { // convert youtube swf href to embed for iframe var thisHref = this.href.replace(new RegExp("watch\\?v=", "i"), 'embed/').replace(new RegExp("&", "i"), '?'); // bind fancybox to each anchor $(this).fancybox({ "padding": 0, "type": 'iframe', // add trailing parameters to href (wmode) "href" : thisHref+"&wmode=opaque" }); // fancybox }); // each }); // ready })(jQuery); function apishopsActionDate(type) { var currentTimestamp=new Date().getTime() if(typeof apishopsActionGetCookie('apishopsActionDate') == 'undefined' || currentTimestamp > parseInt(apishopsActionGetCookie('apishopsActionDate'))){ endTimestamp=currentTimestamp + (1 * 24 * 60 * 60 * 1000); apishopsActionSetCookie('apishopsActionDate', endTimestamp); }else{ endTimestamp=parseInt(apishopsActionGetCookie('apishopsActionDate')) } if(type=='timestamp') return endTimestamp; else return new Date(endTimestamp); } function apishopsActionGetCookie(name) { var matches = document.cookie.match(new RegExp( "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" )); return matches ? decodeURIComponent(matches[1]) : undefined; } function apishopsActionSetCookie(name, value, options) { options = options || {}; var expires = options.expires; if (typeof expires == "number" && expires) { var d = new Date(); d.setTime(d.getTime() + expires*1000); expires = options.expires = d; } if (expires && expires.toUTCString) { options.expires = expires.toUTCString(); } value = encodeURIComponent(value); var updatedCookie = name + "=" + value; for(var propName in options) { updatedCookie += "; " + propName; var propValue = options[propName]; if (propValue !== true) { updatedCookie += "=" + propValue; } } document.cookie = updatedCookie; return value; }