/*----------------------------------------------------*/
/* Common Function
/*----------------------------------------------------*/
function shuffle(inputArr) {
// example 1: ini_set('phpjs.strictForIn', true);
// example 1: shuffle(data);
// example 1: $result = data;
// returns 1: {5:'a', 4:5, 'q':5, 3:'c', 2:'3'}
// example 2: var data = {5:'a', 2:'3', 3:'c', 4:5, 'q':5};
// example 2: ini_set('phpjs.strictForIn', true);
// example 2: var data = {5:'a', 2:'3', 3:'c', 4:5, 'q':5};
// example 2: shuffle(data);
// example 2: $result = data;
// returns 2: {5:'a', 'q':5, 3:'c', 2:'3', 4:5}
var valArr = [],
k = '',
i = 0,
strictForIn = false,
populateArr = [];
for (k in inputArr) { // Get key and value arrays
if (inputArr.hasOwnProperty(k)) {
valArr.push(inputArr[k]);
if (strictForIn) {
delete inputArr[k];
}
}
}
valArr.sort(function() {
return 0.5 - Math.random();
});
// BEGIN REDUNDANT
this.php_js = this.php_js || {};
this.php_js.ini = this.php_js.ini || {};
// END REDUNDANT
strictForIn = this.php_js.ini['phpjs.strictForIn'] && this.php_js.ini['phpjs.strictForIn'].local_value && this.php_js
.ini['phpjs.strictForIn'].local_value !== 'off';
populateArr = strictForIn ? inputArr : populateArr;
for (i = 0; i < valArr.length; i++) { // Repopulate the old array
populateArr[i] = valArr[i];
}
return strictForIn || populateArr;
}
function str_pad(e, t, n, r) {
var i = "",
s;
var o = function (e, t) {
var n = "",
r;
while (n.length < t) {
n += e
}
n = n.substr(0, t);
return n
};
e += "";
n = n !== undefined ? n : " ";
if (r != "STR_PAD_LEFT" && r != "STR_PAD_RIGHT" && r != "STR_PAD_BOTH") {
r = "STR_PAD_RIGHT"
}
if ((s = t - e.length) > 0) {
if (r == "STR_PAD_LEFT") {
e = o(n, s) + e
} else if (r == "STR_PAD_RIGHT") {
e = e + o(n, s)
} else if (r == "STR_PAD_BOTH") {
i = o(n, Math.ceil(s / 2));
e = i + e + i;
e = e.substr(0, t)
}
}
return e
}
function is_array(e) {
return typeof e == "object" && e instanceof Array
}
function showLinkGiorni() {
var today = new Date;
var yesterday = new Date;
var twodaysago = new Date;
yesterday.setTime(today.getTime() - 8642e4);
twodaysago.setTime(yesterday.getTime() - 8642e4);
var linkoggi = "/" + today.getFullYear() + "/" + str_pad(eval(today.getMonth() + 1), 2, "0", "STR_PAD_LEFT") + "/" + str_pad(today.getDate(), 2, "0", "STR_PAD_LEFT") + "/";
var linkieri = "/" + yesterday.getFullYear() + "/" + str_pad(eval(yesterday.getMonth() + 1), 2, "0", "STR_PAD_LEFT") + "/" + str_pad(yesterday.getDate(), 2, "0", "STR_PAD_LEFT") + "/";
//var linklalt = "/" + twodaysago.getFullYear() + "/" + str_pad(eval(twodaysago.getMonth() + 1), 2, "0", "STR_PAD_LEFT") + "/" + str_pad(twodaysago.getDate(), 2, "0", "STR_PAD_LEFT") + "/";
var returnvalue = '
Notizie di OggiNotizie di Ieri';
return returnvalue
}
function showLinkNews24() {
var today = new Date;
var yesterday = new Date;
var twodaysago = new Date;
yesterday.setTime(today.getTime() - 8642e4);
twodaysago.setTime(yesterday.getTime() - 8642e4);
var linkoggi = "/" + today.getFullYear() + "/" + str_pad(eval(today.getMonth() + 1), 2, "0", "STR_PAD_LEFT") + "/" + str_pad(today.getDate(), 2, "0", "STR_PAD_LEFT") + "/";
//var linklalt = "/" + twodaysago.getFullYear() + "/" + str_pad(eval(twodaysago.getMonth() + 1), 2, "0", "STR_PAD_LEFT") + "/" + str_pad(twodaysago.getDate(), 2, "0", "STR_PAD_LEFT") + "/";
var returnvalue = 'Tutte le news';
return returnvalue
}
function WebDate() {
var e = new Date;
var t = e.getYear();
if (t < 1e3) {
t += 1900
}
var n = new Array("Domenica", "Lunedi", "Martedi", "Mercoledi", "Giovedi", "Venerdi", "Sabato");
var r = new Array("Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre");
var i = ' ' + n[e.getDay()] + " , " + e.getDate() + " " + r[e.getMonth()] + " " + t + "";
return i
}
jQuery(document).ready(function(){
is_mobile = jQuery.cookie('X-UA-Device-force');
if (typeof is_mobile != 'undefined' && is_mobile == 'pc' ) {
jQuery('body').append('');
jQuery('.back-to-mobile').click( function(){
// jQuery.cookie('X-UA-Device-force','mobile-generic', { path: '/', domain: '.www.bergamonews.it' } );
jQuery.cookie('X-UA-Device-force','mobile-generic', { path: '/' } );
location.reload();
});
}
/* START: Barra "VAI AL SITO IN MODALITA MOBILE" */
if (jQuery.cookie('cookiebar') === "hide") {
jQuery('.back-to-mobile').css({"bottom": "0px"});
}else{
var cookie_height = jQuery('.cookie-message').height();
jQuery('.back-to-mobile').css("bottom", cookie_height);
}
jQuery('.cookie-message a.cookiebar-close').on('click', function(){
jQuery('.back-to-mobile').css("bottom", "0px");
});
/* END: Barra Barra "VAI AL SITO IN MODALITA MOBILE" */
/*----------------------------------------------------*/
/* Cookie Logged In Check
/*----------------------------------------------------*/
user_info = jQuery.cookie('wordpress_logged_in_usercache');
jQuery(".registration-info").hide();
//console.log(user_info);
if ( user_info != null){
var user_info_splitted = user_info.split("|");
var user_name = user_info_splitted[0];
var user_surname = user_info_splitted[1];
var user_displayname = user_info_splitted[2];
var user_nicename = user_info_splitted[3];
jQuery(".wrap-nickname").hide();
jQuery(".wrap-eta").hide();
jQuery(".wrap-residenza").hide();
jQuery("body").addClass('cookie-logged-in');
jQuery(".registration-info").show();
jQuery(".registration-box").hide();
jQuery("#sub-profilemenu-02").hide();
jQuery(".user-menu-link").html(user_name+' '+user_surname);
jQuery("#profilemenu .title").html('Il tuo profilo');
jQuery(".go-to-profile").attr('href','/author/'+user_displayname+'/');
if ((typeof user_displayname != 'undefined')){
jQuery(".wrap-nickname").show();
jQuery(".nickname").html(user_displayname);
}
//jQuery(".user-menu-link").attr('title','profilo');
};
/*----------------------------------------------------*/
/* Get Datepicker
/*----------------------------------------------------*/
if ((jQuery('.dpicker').length > 0)){
jQuery('.dpicker').datepicker({
dateFormat : 'dd-mm-yy',
changeMonth: true,
changeYear: true,
numberOfMonths: 2,
showButtonPanel: true
});
}
/*----------------------------------------------------*/
/* Last Screen in Photogallery
/*----------------------------------------------------*/
if ((jQuery('.lastone').length > 0)){
jQuery( ".lastone" ).click(function() {
jQuery( "#final-screen" ).addClass('active');
jQuery( "#photogallery-content" ).addClass('disable');
});
}
/*----------------------------------------------------*/
/* Entry Height Switcher in WEBTV
/*----------------------------------------------------*/
if ((jQuery('.inner-height').length > 0)){
var entryInnerHeight = jQuery('.inner-height').height();
if(entryInnerHeight < 128){
jQuery('.read-more').hide();
// jQuery('.webtv-apertura-content .banner').addClass('absolute');
}
else
{
// jQuery('.webtv-apertura-content .banner').removeClass('absolute');
document.getElementById('entry').style.height = '128px';
jQuery('.read-more').click(function() {
jQuery( "#entry" ).css('height',entryInnerHeight);
jQuery('.read-less').css('display','block');
jQuery('.read-more').hide();
});
jQuery('.read-less').click(function() {
jQuery( "#entry" ).css('height','127');
jQuery('.read-more').show();
jQuery('.read-less').hide();
});
}
}
/*----------------------------------------------------*/
/* Home Trick
/*----------------------------------------------------*/
if ((jQuery('.home-apertura-content').length > 0)){
var hapertura1 = jQuery(".apertura-1 header").height();
var hapertura2 = jQuery(".apertura-2 header").height();
var hapertura3 = jQuery(".apertura-3 header").height();
if(hapertura1 < 80){ jQuery(".apertura-1").addClass("short")};
if(hapertura2 < 80){ jQuery(".apertura-2").addClass("short") };
if(hapertura3 < 80){ jQuery(".apertura-3").addClass("short") };
}
/*----------------------------------------------------*/
/* Body RSWD for Photogallery
/*----------------------------------------------------*/
if ((jQuery('#photogallery-content').length > 0)){
if ( jQuery('body').css('background-image') != 'none' || currentWidth < 1170 ) {
jQuery('body').addClass('nofull');
} else {
jQuery('body').removeClass('nofull');
};
jQuery(window).resize(function() {
var ResizeCurrentWidth = window.innerWidth || document.documentElement.clientWidth;
if ( jQuery('body').css('background-image') != 'none' || ResizeCurrentWidth < 1170 ) {
jQuery('body').addClass('nofull');
} else {
jQuery('body').removeClass('nofull');
};
});
}
/*----------------------------------------------------*/
/* Hide MegaBox Sport if NewsAlte is Short
/*----------------------------------------------------*/
if ((jQuery('.news-top').length > 0)){
var newstopheight = jQuery('.news-top').height();
//console.log(newstopheight);
if ((jQuery('.megabox.sport').length > 0)){
if (newstopheight < 1500){
//jQuery('.megabox.sport').hide();
}
}
}
/*----------------------------------------------------*/
/* Get Share Bar
/*----------------------------------------------------*/
if ((jQuery('.multimedia-sidebar').length > 0)){
jQuery('.multimedia-sidebar .shareme').sharrre({
share: {
twitter: true,
facebook: true,
},
template: ' {total}
',
enableHover: false,
enableTracking: true,
render: function(api, options){
jQuery(api.element).on('click', '.twitter', function() {
api.openPopup('twitter');
});
jQuery(api.element).on('click', '.facebook', function() {
api.openPopup('facebook');
});
}
});
};
/*----------------------------------------------------*/
/* Get Windows Width for Submenu Width
/*----------------------------------------------------*/
var currentWidth = window.innerWidth || document.documentElement.clientWidth;
jQuery("#topbar .full" ).css('width',currentWidth);
var ResizeWindow = function() {
var WinWidth = jQuery(window).width();
jQuery("#topbar .full" ).css('width',WinWidth);
};
jQuery(window).resize(function() {
ResizeWindow();
});
/*----------------------------------------------------*/
/* GetToday and Yesterday Link
/*----------------------------------------------------*/
var a = showLinkGiorni();
jQuery(a).prependTo("#sub-cercamenu-01 ul");
var b = showLinkNews24();
jQuery(b).appendTo(".news24 .action");
/*----------------------------------------------------*/
/* GetToday
/*----------------------------------------------------*/
var e = WebDate();
jQuery(e).hide().appendTo(".today").fadeIn()
/*----------------------------------------------------*/
/* ScrollingTO
/*----------------------------------------------------*/
jQuery('.today').click(function(){
jQuery('html, body').animate({scrollTop:0}, 'slow');
return false;
});
if ((jQuery('#comments').length > 0)){
var getcommentposition = jQuery("#comments").offset();
var commentpositiontop = getcommentposition.top;
jQuery('#comment-now').click(function(){
jQuery('html, body').animate({scrollTop:commentpositiontop}, 'slow');
return false;
});
};
if ((jQuery('#mm-link-foto').length > 0)){
var getcommentposition = jQuery(".thumb.gallery").offset();
var commentpositiontop = getcommentposition.top;
jQuery('#mm-link-foto').click(function(){
jQuery('html, body').animate({scrollTop:commentpositiontop}, 'slow');
return false;
});
};
if ((jQuery('#webtv-commentbtn-fb').length > 0)){
var getcommentposition = jQuery(".facebook-comment").offset();
var commentpositiontop = getcommentposition.top;
jQuery('#webtv-commentbtn-fb').click(function(){
jQuery('html, body').animate({scrollTop:commentpositiontop}, 'slow');
return false;
});
}
if (window.location.href.indexOf("#scrolling-phototarget") > -1) {
var getposition = jQuery('#scrolling-phototarget').offset();
var positiontop = getposition.top - 150;
jQuery('html, body').animate({scrollTop:positiontop}, 'slow');
}
/*
* Exit on intent : bioep.js
* */
if(jQuery('#bio_ep_inner').length){
bioEp.init({
showOnDelay: false,
cookieExp: 1,
width: 980,
// onPopup: function () {
// myLazyLoadBackground.update();
// }
});
}
/*----------------------------------------------------*/
/* Create a stick nav
/*----------------------------------------------------*/
//console.log(currentWidth);
var headerH = jQuery('#topbar').height();
jQuery(document).bind('ready scroll', function() {
var docScroll = jQuery(document).scrollTop();
if((jQuery('#topbar').hasClass('header')) && docScroll >= headerH) {
if (!jQuery('#topbar').hasClass('header-animate')) {
jQuery('#topbar').addClass('header-animate').css({ top: '0' }).stop().animate({ top: 0 }, 500);
}
} else {
jQuery('#topbar').removeClass('header-animate').removeAttr('style');
}
});
/*----------------------------------------------------*/
/* Toggle Menu Background
/*----------------------------------------------------*/
var switchon =setInterval(function(){ jQuery("#main-menu-01").addClass('on'); }, 4000);
var switchoff = setInterval(function(){ jQuery("#main-menu-01").removeClass('on'); }, 6000);
setInterval(function(){ clearInterval(switchon); }, 12000);
/*----------------------------------------------------*/
/* Jcarousel
/*----------------------------------------------------*/
if ((jQuery('.jcarousel').length > 0)){
jQuery('.jcarousel').jcarousel({ wrap: 'circular'})
.on('jcarousel:createend', function() {
// Arguments:
// 1. The method to call
// 2. The index of the item (note that indexes are 0-based)
// 3. A flag telling jCarousel jumping to the index without animation
jQuery(this).jcarousel('scroll', 1, false);
})
.jcarousel();
jQuery('.jcarousel-control-prev')
.on('jcarouselcontrol:active', function() {
jQuery(this).removeClass('inactive');
})
.on('jcarouselcontrol:inactive', function() {
jQuery(this).addClass('inactive');
})
.jcarouselControl({target: '-=1'});
jQuery('.jcarousel-control-next')
.on('jcarouselcontrol:active', function() {jQuery(this).removeClass('inactive');})
.on('jcarouselcontrol:inactive', function() {jQuery(this).addClass('inactive');})
.jcarouselControl({target: '+=1'});
};
/*----------------------------------------------------*/
/* Feed
/*----------------------------------------------------*/
var win = null;
jQuery.extend({
jGFeed: function (e, t, n, r) {
if (e == null) {
return false
}
var i = "//ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q=" + e;
if (n != null) {
i += "&num=" + n
}
if (r != null) {
i += "&key=" + r
}
jQuery.getJSON(i, function (e) {
if (typeof t == "function") {
t.call(this, e.responseData.feed)
} else {
return false
}
})
}
});
var orariofeed = new Date;
var feedcachebuster = Math.floor(orariofeed.getTime() / (5 * 60 * 1e3));
/*----------------------------------------------------*/
/* Tabs
/*----------------------------------------------------*/
if ((jQuery('#tabs').length > 0)){
jQuery('#tabs div').hide();
jQuery('#tabs div:first').show();
jQuery('#tabs .menu li:first').addClass('current');
jQuery('#tabs .menu li a').click(function(){
jQuery('#tabs .menu li').removeClass('current');
jQuery(this).parent().addClass('current');
var currentTab = jQuery(this).attr('href');
jQuery('#tabs .tabs-content').hide();
jQuery(currentTab).show();
return false;
});
}
/*----------------------------------------------------*/
/* Sticky Share Column solo in sngle
/*----------------------------------------------------*/
if ((jQuery('.badge-share').length > 0)){
jQuery(".badge-share").click(function() {
switch (true) {
case jQuery(this).hasClass('badge-share-facebook'):
MyVar = 1;
break;
case jQuery(this).hasClass('badge-share-twitter'):
MyVar = 2;
break;
case jQuery(this).hasClass('badge-share-gplus'):
MyVar = 3;
break;
case jQuery(this).hasClass('badge-share-linkedin'):
MyVar = 4;
break;
case jQuery(this).hasClass('badge-share-pinterest'):
MyVar = 5;
break;
}
switch (MyVar)
{
case 1:
var b = jQuery(".badge-share-facebook").attr("data-share");
socialurl = "https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(b)
break;
case 2:
var b = jQuery(".badge-share-twitter").attr("data-share");
var c = jQuery(".badge-share-twitter").attr("data-title");
var d = jQuery(".badge-share-twitter").attr("data-shortlink");
socialurl = "https://twitter.com/intent/tweet?source=tweetbutton&original_referer=" + encodeURIComponent(b) + "&text=" + encodeURIComponent(c) + "&url=" + encodeURIComponent(d);
break;
case 3:
var b = jQuery(".badge-share-twitter").attr("data-share");
socialurl = "https://plus.google.com/share?url=" + encodeURIComponent(b);
break;
case 4:
var b = jQuery(".badge-share-linkedin").attr("data-share");
socialurl = "https://www.linkedin.com/shareArticle?mini=true&url=" + encodeURIComponent(b);
break;
case 5:
var b = jQuery(".badge-share-pinterest").attr("data-share");
var c = jQuery(".badge-share-pinterest").attr("data-title");
var d = jQuery(".badge-share-pinterest").attr("data-media");
socialurl = "http://www.pinterest.com/pin/create/button/?url=" + encodeURIComponent(b) + "&description=" + encodeURIComponent(c)+ "&media=" + encodeURIComponent(d);
break;
default:
socialurl = "Foo";
}
function showShareWindow() {
{
var b = 640,
//z = jQuery(".btn-facebook").attr("data-share");
c = 460,
a = socialurl;
d = window.screen.height / 2 - c / 2,
e = window.screen.width / 2 - b / 2;
window.open(socialurl, "Share", "status=1,height=" + c + ",width=" + b + ",top=" + d + ",left=" + e + ",resizable=0")
}
};
showShareWindow();
});
}
/*----------------------------------------------------*/
/* iLightbox
/*----------------------------------------------------*/
jQuery(function(jQuery){
jQuery('.pirobox_gall').iLightBox(
{
skin: 'metro-black'
}
);
});
});
/* START: Barra "VAI AL SITO IN MODALITA MOBILE" */
jQuery(window).on('resize', function(){
var cookie_height = jQuery('.cookie-message').height();
if(jQuery.cookie('cookiebar') != "hide") {
jQuery('.back-to-mobile').css("bottom", cookie_height+"px")
} else {
jQuery('.back-to-mobile').css("bottom", "0px");
}
});
/* END: Barra Barra "VAI AL SITO IN MODALITA MOBILE" */
// if(jQuery('.single-post #entry').length > 0 || jQuery('.single-pubbliredazionale #entry').length > 0 || jQuery('.single-young #entry').length > 0 || jQuery('.single-campionato #entry').length > 0){
if(jQuery('.single #entry').length > 0 ){
var getmenuposition = jQuery("#entry").offset();
// var getcommentposition = jQuery(".tag.bottom").offset();
var getcommentposition = jQuery('#post-entry').offset().top + jQuery('#post-entry').height();
var socialposition1 = getmenuposition.top + 35;
// var socialposition2 = getcommentposition - 280;
var socialposition2 = getcommentposition + 200;
}
jQuery(window).scroll(function () {
if(jQuery('.social-column').length > 0){
if (jQuery(document).scrollTop() < socialposition1)
{
jQuery('.social-column').fadeIn('slow');
jQuery('.social-column').removeClass('fixed');
} else if (jQuery(document).scrollTop() > socialposition2)
{
jQuery('.social-column').fadeOut('slow');
}
else
{
jQuery('.social-column').fadeIn('slow');
jQuery('.social-column').addClass('fixed');
}
}
});
jQuery(document).ready(function(){
myPressnewsMenu();
});
/*! jCarousel - v0.3.1 - 2014-04-26
* http://sorgalla.com/jcarousel
* Copyright (c) 2006- Jan Sorgalla; Licensed MIT */
(function(t){"use strict";var i=t.jCarousel={};i.version="0.3.1";var s=/^([+\-]=)?(.+)$/;i.parseTarget=function(t){var i=!1,e="object"!=typeof t?s.exec(t):null;return e?(t=parseInt(e[2],10)||0,e[1]&&(i=!0,"-="===e[1]&&(t*=-1))):"object"!=typeof t&&(t=parseInt(t,10)||0),{target:t,relative:i}},i.detectCarousel=function(t){for(var i;t.length>0;){if(i=t.filter("[data-jcarousel]"),i.length>0)return i;if(i=t.find("[data-jcarousel]"),i.length>0)return i;t=t.parent()}return null},i.base=function(s){return{version:i.version,_options:{},_element:null,_carousel:null,_init:t.noop,_create:t.noop,_destroy:t.noop,_reload:t.noop,create:function(){return this._element.attr("data-"+s.toLowerCase(),!0).data(s,this),!1===this._trigger("create")?this:(this._create(),this._trigger("createend"),this)},destroy:function(){return!1===this._trigger("destroy")?this:(this._destroy(),this._trigger("destroyend"),this._element.removeData(s).removeAttr("data-"+s.toLowerCase()),this)},reload:function(t){return!1===this._trigger("reload")?this:(t&&this.options(t),this._reload(),this._trigger("reloadend"),this)},element:function(){return this._element},options:function(i,s){if(0===arguments.length)return t.extend({},this._options);if("string"==typeof i){if(s===void 0)return this._options[i]===void 0?null:this._options[i];this._options[i]=s}else this._options=t.extend({},this._options,i);return this},carousel:function(){return this._carousel||(this._carousel=i.detectCarousel(this.options("carousel")||this._element),this._carousel||t.error('Could not detect carousel for plugin "'+s+'"')),this._carousel},_trigger:function(i,e,r){var n,o=!1;return r=[this].concat(r||[]),(e||this._element).each(function(){n=t.Event((s+":"+i).toLowerCase()),t(this).trigger(n,r),n.isDefaultPrevented()&&(o=!0)}),!o}}},i.plugin=function(s,e){var r=t[s]=function(i,s){this._element=t(i),this.options(s),this._init(),this.create()};return r.fn=r.prototype=t.extend({},i.base(s),e),t.fn[s]=function(i){var e=Array.prototype.slice.call(arguments,1),n=this;return"string"==typeof i?this.each(function(){var r=t(this).data(s);if(!r)return t.error("Cannot call methods on "+s+" prior to initialization; "+'attempted to call method "'+i+'"');if(!t.isFunction(r[i])||"_"===i.charAt(0))return t.error('No such method "'+i+'" for '+s+" instance");var o=r[i].apply(r,e);return o!==r&&o!==void 0?(n=o,!1):void 0}):this.each(function(){var e=t(this).data(s);e instanceof r?e.reload(i):new r(this,i)}),n},r}})(jQuery),function(t,i){"use strict";var s=function(t){return parseFloat(t)||0};t.jCarousel.plugin("jcarousel",{animating:!1,tail:0,inTail:!1,resizeTimer:null,lt:null,vertical:!1,rtl:!1,circular:!1,underflow:!1,relative:!1,_options:{list:function(){return this.element().children().eq(0)},items:function(){return this.list().children()},animation:400,transitions:!1,wrap:null,vertical:null,rtl:null,center:!1},_list:null,_items:null,_target:null,_first:null,_last:null,_visible:null,_fullyvisible:null,_init:function(){var t=this;return this.onWindowResize=function(){t.resizeTimer&&clearTimeout(t.resizeTimer),t.resizeTimer=setTimeout(function(){t.reload()},100)},this},_create:function(){this._reload(),t(i).on("resize.jcarousel",this.onWindowResize)},_destroy:function(){t(i).off("resize.jcarousel",this.onWindowResize)},_reload:function(){this.vertical=this.options("vertical"),null==this.vertical&&(this.vertical=this.list().height()>this.list().width()),this.rtl=this.options("rtl"),null==this.rtl&&(this.rtl=function(i){if("rtl"===(""+i.attr("dir")).toLowerCase())return!0;var s=!1;return i.parents("[dir]").each(function(){return/rtl/i.test(t(this).attr("dir"))?(s=!0,!1):void 0}),s}(this._element)),this.lt=this.vertical?"top":"left",this.relative="relative"===this.list().css("position"),this._list=null,this._items=null;var i=this._target&&this.index(this._target)>=0?this._target:this.closest();this.circular="circular"===this.options("wrap"),this.underflow=!1;var s={left:0,top:0};return i.length>0&&(this._prepare(i),this.list().find("[data-jcarousel-clone]").remove(),this._items=null,this.underflow=this._fullyvisible.length>=this.items().length,this.circular=this.circular&&!this.underflow,s[this.lt]=this._position(i)+"px"),this.move(s),this},list:function(){if(null===this._list){var i=this.options("list");this._list=t.isFunction(i)?i.call(this):this._element.find(i)}return this._list},items:function(){if(null===this._items){var i=this.options("items");this._items=(t.isFunction(i)?i.call(this):this.list().find(i)).not("[data-jcarousel-clone]")}return this._items},index:function(t){return this.items().index(t)},closest:function(){var i,e=this,r=this.list().position()[this.lt],n=t(),o=!1,l=this.vertical?"bottom":this.rtl&&!this.relative?"left":"right";return this.rtl&&this.relative&&!this.vertical&&(r+=this.list().width()-this.clipping()),this.items().each(function(){if(n=t(this),o)return!1;var a=e.dimension(n);if(r+=a,r>=0){if(i=a-s(n.css("margin-"+l)),!(0>=Math.abs(r)-a+i/2))return!1;o=!0}}),n},target:function(){return this._target},first:function(){return this._first},last:function(){return this._last},visible:function(){return this._visible},fullyvisible:function(){return this._fullyvisible},hasNext:function(){if(!1===this._trigger("hasnext"))return!0;var t=this.options("wrap"),i=this.items().length-1;return i>=0&&!this.underflow&&(t&&"first"!==t||i>this.index(this._last)||this.tail&&!this.inTail)?!0:!1},hasPrev:function(){if(!1===this._trigger("hasprev"))return!0;var t=this.options("wrap");return this.items().length>0&&!this.underflow&&(t&&"last"!==t||this.index(this._first)>0||this.tail&&this.inTail)?!0:!1},clipping:function(){return this._element["inner"+(this.vertical?"Height":"Width")]()},dimension:function(t){return t["outer"+(this.vertical?"Height":"Width")](!0)},scroll:function(i,s,e){if(this.animating)return this;if(!1===this._trigger("scroll",null,[i,s]))return this;t.isFunction(s)&&(e=s,s=!0);var r=t.jCarousel.parseTarget(i);if(r.relative){var n,o,l,a,h,u,c,f,d=this.items().length-1,_=Math.abs(r.target),p=this.options("wrap");if(r.target>0){var g=this.index(this._last);if(g>=d&&this.tail)this.inTail?"both"===p||"last"===p?this._scroll(0,s,e):t.isFunction(e)&&e.call(this,!1):this._scrollTail(s,e);else if(n=this.index(this._target),this.underflow&&n===d&&("circular"===p||"both"===p||"last"===p)||!this.underflow&&g===d&&("both"===p||"last"===p))this._scroll(0,s,e);else if(l=n+_,this.circular&&l>d){for(f=d,h=this.items().get(-1);l>f++;)h=this.items().eq(0),u=this._visible.index(h)>=0,u&&h.after(h.clone(!0).attr("data-jcarousel-clone",!0)),this.list().append(h),u||(c={},c[this.lt]=this.dimension(h),this.moveBy(c)),this._items=null;this._scroll(h,s,e)}else this._scroll(Math.min(l,d),s,e)}else if(this.inTail)this._scroll(Math.max(this.index(this._first)-_+1,0),s,e);else if(o=this.index(this._first),n=this.index(this._target),a=this.underflow?n:o,l=a-_,0>=a&&(this.underflow&&"circular"===p||"both"===p||"first"===p))this._scroll(d,s,e);else if(this.circular&&0>l){for(f=l,h=this.items().get(0);0>f++;){h=this.items().eq(-1),u=this._visible.index(h)>=0,u&&h.after(h.clone(!0).attr("data-jcarousel-clone",!0)),this.list().prepend(h),this._items=null;var v=this.dimension(h);c={},c[this.lt]=-v,this.moveBy(c)}this._scroll(h,s,e)}else this._scroll(Math.max(l,0),s,e)}else this._scroll(r.target,s,e);return this._trigger("scrollend"),this},moveBy:function(t,i){var e=this.list().position(),r=1,n=0;return this.rtl&&!this.vertical&&(r=-1,this.relative&&(n=this.list().width()-this.clipping())),t.left&&(t.left=e.left+n+s(t.left)*r+"px"),t.top&&(t.top=e.top+n+s(t.top)*r+"px"),this.move(t,i)},move:function(i,s){s=s||{};var e=this.options("transitions"),r=!!e,n=!!e.transforms,o=!!e.transforms3d,l=s.duration||0,a=this.list();if(!r&&l>0)return a.animate(i,s),void 0;var h=s.complete||t.noop,u={};if(r){var c=a.css(["transitionDuration","transitionTimingFunction","transitionProperty"]),f=h;h=function(){t(this).css(c),f.call(this)},u={transitionDuration:(l>0?l/1e3:0)+"s",transitionTimingFunction:e.easing||s.easing,transitionProperty:l>0?function(){return n||o?"all":i.left?"left":"top"}():"none",transform:"none"}}o?u.transform="translate3d("+(i.left||0)+","+(i.top||0)+",0)":n?u.transform="translate("+(i.left||0)+","+(i.top||0)+")":t.extend(u,i),r&&l>0&&a.one("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd",h),a.css(u),0>=l&&a.each(function(){h.call(this)})},_scroll:function(i,s,e){if(this.animating)return t.isFunction(e)&&e.call(this,!1),this;if("object"!=typeof i?i=this.items().eq(i):i.jquery===void 0&&(i=t(i)),0===i.length)return t.isFunction(e)&&e.call(this,!1),this;this.inTail=!1,this._prepare(i);var r=this._position(i),n=this.list().position()[this.lt];if(r===n)return t.isFunction(e)&&e.call(this,!1),this;var o={};return o[this.lt]=r+"px",this._animate(o,s,e),this},_scrollTail:function(i,s){if(this.animating||!this.tail)return t.isFunction(s)&&s.call(this,!1),this;var e=this.list().position()[this.lt];this.rtl&&this.relative&&!this.vertical&&(e+=this.list().width()-this.clipping()),this.rtl&&!this.vertical?e+=this.tail:e-=this.tail,this.inTail=!0;var r={};return r[this.lt]=e+"px",this._update({target:this._target.next(),fullyvisible:this._fullyvisible.slice(1).add(this._visible.last())}),this._animate(r,i,s),this},_animate:function(i,s,e){if(e=e||t.noop,!1===this._trigger("animate"))return e.call(this,!1),this;this.animating=!0;var r=this.options("animation"),n=t.proxy(function(){this.animating=!1;var t=this.list().find("[data-jcarousel-clone]");t.length>0&&(t.remove(),this._reload()),this._trigger("animateend"),e.call(this,!0)},this),o="object"==typeof r?t.extend({},r):{duration:r},l=o.complete||t.noop;return s===!1?o.duration=0:t.fx.speeds[o.duration]!==void 0&&(o.duration=t.fx.speeds[o.duration]),o.complete=function(){n(),l.call(this)},this.move(i,o),this},_prepare:function(i){var e,r,n,o,l=this.index(i),a=l,h=this.dimension(i),u=this.clipping(),c=this.vertical?"bottom":this.rtl?"left":"right",f=this.options("center"),d={target:i,first:i,last:i,visible:i,fullyvisible:u>=h?i:t()};if(f&&(h/=2,u/=2),u>h)for(;;){if(e=this.items().eq(++a),0===e.length){if(!this.circular)break;if(e=this.items().eq(0),i.get(0)===e.get(0))break;if(r=this._visible.index(e)>=0,r&&e.after(e.clone(!0).attr("data-jcarousel-clone",!0)),this.list().append(e),!r){var _={};_[this.lt]=this.dimension(e),this.moveBy(_)}this._items=null}if(o=this.dimension(e),0===o)break;if(h+=o,d.last=e,d.visible=d.visible.add(e),n=s(e.css("margin-"+c)),u>=h-n&&(d.fullyvisible=d.fullyvisible.add(e)),h>=u)break}if(!this.circular&&!f&&u>h)for(a=l;;){if(0>--a)break;if(e=this.items().eq(a),0===e.length)break;if(o=this.dimension(e),0===o)break;if(h+=o,d.first=e,d.visible=d.visible.add(e),n=s(e.css("margin-"+c)),u>=h-n&&(d.fullyvisible=d.fullyvisible.add(e)),h>=u)break}return this._update(d),this.tail=0,f||"circular"===this.options("wrap")||"custom"===this.options("wrap")||this.index(d.last)!==this.items().length-1||(h-=s(d.last.css("margin-"+c)),h>u&&(this.tail=h-u)),this},_position:function(t){var i=this._first,s=i.position()[this.lt],e=this.options("center"),r=e?this.clipping()/2-this.dimension(i)/2:0;return this.rtl&&!this.vertical?(s-=this.relative?this.list().width()-this.dimension(i):this.clipping()-this.dimension(i),s+=r):s-=r,!e&&(this.index(t)>this.index(i)||this.inTail)&&this.tail?(s=this.rtl&&!this.vertical?s-this.tail:s+this.tail,this.inTail=!0):this.inTail=!1,-s},_update:function(i){var s,e=this,r={target:this._target||t(),first:this._first||t(),last:this._last||t(),visible:this._visible||t(),fullyvisible:this._fullyvisible||t()},n=this.index(i.first||r.first)r[s].index(this)&&o.push(this)}),r[s].each(function(){0>i[s].index(this)&&l.push(this)}),n?o=o.reverse():l=l.reverse(),e._trigger(s+"in",t(o)),e._trigger(s+"out",t(l)),e["_"+s]=i[s]};for(s in i)o(s);return this}})}(jQuery,window),function(t){"use strict";t.jcarousel.fn.scrollIntoView=function(i,s,e){var r,n=t.jCarousel.parseTarget(i),o=this.index(this._fullyvisible.first()),l=this.index(this._fullyvisible.last());if(r=n.relative?0>n.target?Math.max(0,o+n.target):l+n.target:"object"!=typeof n.target?n.target:this.index(n.target),o>r)return this.scroll(r,s,e);if(r>=o&&l>=r)return t.isFunction(e)&&e.call(this,!1),this;for(var a,h=this.items(),u=this.clipping(),c=this.vertical?"bottom":this.rtl?"left":"right",f=0;;){if(a=h.eq(r),0===a.length)break;if(f+=this.dimension(a),f>=u){var d=parseFloat(a.css("margin-"+c))||0;f-d!==u&&r++;break}if(0>=r)break;r--}return this.scroll(r,s,e)}}(jQuery),function(t){"use strict";t.jCarousel.plugin("jcarouselControl",{_options:{target:"+=1",event:"click",method:"scroll"},_active:null,_init:function(){this.onDestroy=t.proxy(function(){this._destroy(),this.carousel().one("jcarousel:createend",t.proxy(this._create,this))},this),this.onReload=t.proxy(this._reload,this),this.onEvent=t.proxy(function(i){i.preventDefault();var s=this.options("method");t.isFunction(s)?s.call(this):this.carousel().jcarousel(this.options("method"),this.options("target"))},this)},_create:function(){this.carousel().one("jcarousel:destroy",this.onDestroy).on("jcarousel:reloadend jcarousel:scrollend",this.onReload),this._element.on(this.options("event")+".jcarouselcontrol",this.onEvent),this._reload()},_destroy:function(){this._element.off(".jcarouselcontrol",this.onEvent),this.carousel().off("jcarousel:destroy",this.onDestroy).off("jcarousel:reloadend jcarousel:scrollend",this.onReload)},_reload:function(){var i,s=t.jCarousel.parseTarget(this.options("target")),e=this.carousel();if(s.relative)i=e.jcarousel(s.target>0?"hasNext":"hasPrev");else{var r="object"!=typeof s.target?e.jcarousel("items").eq(s.target):s.target;i=e.jcarousel("target").index(r)>=0}return this._active!==i&&(this._trigger(i?"active":"inactive"),this._active=i),this}})}(jQuery),function(t){"use strict";t.jCarousel.plugin("jcarouselPagination",{_options:{perPage:null,item:function(t){return''+t+""},event:"click",method:"scroll"},_carouselItems:null,_pages:{},_items:{},_currentPage:null,_init:function(){this.onDestroy=t.proxy(function(){this._destroy(),this.carousel().one("jcarousel:createend",t.proxy(this._create,this))},this),this.onReload=t.proxy(this._reload,this),this.onScroll=t.proxy(this._update,this)},_create:function(){this.carousel().one("jcarousel:destroy",this.onDestroy).on("jcarousel:reloadend",this.onReload).on("jcarousel:scrollend",this.onScroll),this._reload()},_destroy:function(){this._clear(),this.carousel().off("jcarousel:destroy",this.onDestroy).off("jcarousel:reloadend",this.onReload).off("jcarousel:scrollend",this.onScroll),this._carouselItems=null},_reload:function(){var i=this.options("perPage");if(this._pages={},this._items={},t.isFunction(i)&&(i=i.call(this)),null==i)this._pages=this._calculatePages();else for(var s,e=parseInt(i,10)||0,r=this._getCarouselItems(),n=1,o=0;;){if(s=r.eq(o++),0===s.length)break;this._pages[n]=this._pages[n]?this._pages[n].add(s):s,0===o%e&&n++}this._clear();var l=this,a=this.carousel().data("jcarousel"),h=this._element,u=this.options("item"),c=this._getCarouselItems().length;t.each(this._pages,function(i,s){var e=l._items[i]=t(u.call(l,i,s));e.on(l.options("event")+".jcarouselpagination",t.proxy(function(){var t=s.eq(0);if(a.circular){var e=a.index(a.target()),r=a.index(t);parseFloat(i)>parseFloat(l._currentPage)?e>r&&(t="+="+(c-e+r)):r>e&&(t="-="+(e+(c-r)))}a[this.options("method")](t)},l)),h.append(e)}),this._update()},_update:function(){var i,s=this.carousel().jcarousel("target");t.each(this._pages,function(t,e){return e.each(function(){return s.is(this)?(i=t,!1):void 0}),i?!1:void 0}),this._currentPage!==i&&(this._trigger("inactive",this._items[this._currentPage]),this._trigger("active",this._items[i])),this._currentPage=i},items:function(){return this._items},reloadCarouselItems:function(){return this._carouselItems=null,this},_clear:function(){this._element.empty(),this._currentPage=null},_calculatePages:function(){for(var t,i=this.carousel().data("jcarousel"),s=this._getCarouselItems(),e=i.clipping(),r=0,n=0,o=1,l={};;){if(t=s.eq(n++),0===t.length)break;l[o]=l[o]?l[o].add(t):t,r+=i.dimension(t),r>=e&&(o++,r=0)}return l},_getCarouselItems:function(){return this._carouselItems||(this._carouselItems=this.carousel().jcarousel("items")),this._carouselItems}})}(jQuery),function(t){"use strict";t.jCarousel.plugin("jcarouselAutoscroll",{_options:{target:"+=1",interval:3e3,autostart:!0},_timer:null,_init:function(){this.onDestroy=t.proxy(function(){this._destroy(),this.carousel().one("jcarousel:createend",t.proxy(this._create,this))},this),this.onAnimateEnd=t.proxy(this.start,this)},_create:function(){this.carousel().one("jcarousel:destroy",this.onDestroy),this.options("autostart")&&this.start()},_destroy:function(){this.stop(),this.carousel().off("jcarousel:destroy",this.onDestroy)},start:function(){return this.stop(),this.carousel().one("jcarousel:animateend",this.onAnimateEnd),this._timer=setTimeout(t.proxy(function(){this.carousel().jcarousel("scroll",this.options("target"))},this),this.options("interval")),this},stop:function(){return this._timer&&(this._timer=clearTimeout(this._timer)),this.carousel().off("jcarousel:animateend",this.onAnimateEnd),this}})}(jQuery);
/*! jCookie */
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e){function n(e){return u.raw?e:encodeURIComponent(e)}function o(e){return u.raw?e:decodeURIComponent(e)}function i(e){return n(u.json?JSON.stringify(e):String(e))}function r(e){0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return e=decodeURIComponent(e.replace(c," ")),u.json?JSON.parse(e):e}catch(n){}}function t(n,o){var i=u.raw?n:r(n);return e.isFunction(o)?o(i):i}var c=/\+/g,u=e.cookie=function(r,c,a){if(arguments.length>1&&!e.isFunction(c)){if(a=e.extend({},u.defaults,a),"number"==typeof a.expires){var f=a.expires,s=a.expires=new Date;s.setTime(+s+864e5*f)}return document.cookie=[n(r),"=",i(c),a.expires?"; expires="+a.expires.toUTCString():"",a.path?"; path="+a.path:"",a.domain?"; domain="+a.domain:"",a.secure?"; secure":""].join("")}for(var d=r?void 0:{},p=document.cookie?document.cookie.split("; "):[],m=0,x=p.length;x>m;m++){var l=p[m].split("="),g=o(l.shift()),k=l.join("=");if(r&&r===g){d=t(k,c);break}r||void 0===(k=t(k))||(d[g]=k)}return d};u.defaults={},e.removeCookie=function(n,o){return void 0===e.cookie(n)?!1:(e.cookie(n,"",e.extend({},o,{expires:-1})),!e.cookie(n))}});
/*! XMLtoJSON */
(function(a,b){if(typeof define==="function"&&define.amd){define([],b);}else{if(typeof exports==="object"){module.exports=b();}else{a.X2JS=b();}}}(this,function(){return function(z){var t="1.2.0";z=z||{};i();u();function i(){if(z.escapeMode===undefined){z.escapeMode=true;}z.attributePrefix=z.attributePrefix||"_";z.arrayAccessForm=z.arrayAccessForm||"none";z.emptyNodeForm=z.emptyNodeForm||"text";if(z.enableToStringFunc===undefined){z.enableToStringFunc=true;}z.arrayAccessFormPaths=z.arrayAccessFormPaths||[];if(z.skipEmptyTextNodesForObj===undefined){z.skipEmptyTextNodesForObj=true;}if(z.stripWhitespaces===undefined){z.stripWhitespaces=true;}z.datetimeAccessFormPaths=z.datetimeAccessFormPaths||[];if(z.useDoubleQuotes===undefined){z.useDoubleQuotes=false;}z.xmlElementsFilter=z.xmlElementsFilter||[];z.jsonPropertiesFilter=z.jsonPropertiesFilter||[];if(z.keepCData===undefined){z.keepCData=false;}}var h={ELEMENT_NODE:1,TEXT_NODE:3,CDATA_SECTION_NODE:4,COMMENT_NODE:8,DOCUMENT_NODE:9};function u(){}function x(B){var C=B.localName;if(C==null){C=B.baseName;}if(C==null||C==""){C=B.nodeName;}return C;}function r(B){return B.prefix;}function s(B){if(typeof(B)=="string"){return B.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'");}else{return B;}}function k(B){return B.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&");}function w(C,F,D,E){var B=0;for(;B0){if(w(z.arrayAccessFormPaths,D,B,C)){D[B]=[D[B]];}}}function a(G){var E=G.split(/[-T:+Z]/g);var F=new Date(E[0],E[1]-1,E[2]);var D=E[5].split(".");F.setHours(E[3],E[4],D[0]);if(D.length>1){F.setMilliseconds(D[1]);}if(E[6]&&E[7]){var C=E[6]*60+Number(E[7]);var B=/\d\d-\d\d:\d\d$/.test(G)?"-":"+";C=0+(B=="-"?-1*C:C);F.setMinutes(F.getMinutes()-C-F.getTimezoneOffset());}else{if(G.indexOf("Z",G.length-1)!==-1){F=new Date(Date.UTC(F.getFullYear(),F.getMonth(),F.getDate(),F.getHours(),F.getMinutes(),F.getSeconds(),F.getMilliseconds()));}}return F;}function q(D,B,C){if(z.datetimeAccessFormPaths.length>0){var E=C.split(".#")[0];if(w(z.datetimeAccessFormPaths,D,B,E)){return a(D);}else{return D;}}else{return D;}}function b(E,C,B,D){if(C==h.ELEMENT_NODE&&z.xmlElementsFilter.length>0){return w(z.xmlElementsFilter,E,B,D);}else{return true;}}function A(D,J){if(D.nodeType==h.DOCUMENT_NODE){var K=new Object;var B=D.childNodes;for(var L=0;L1&&K.__text!=null&&z.skipEmptyTextNodesForObj){if((z.stripWhitespaces&&K.__text=="")||(K.__text.trim()=="")){delete K.__text;}}}}}delete K.__cnt;if(z.enableToStringFunc&&(K.__text!=null||K.__cdata!=null)){K.toString=function(){return(this.__text!=null?this.__text:"")+(this.__cdata!=null?this.__cdata:"");};}return K;}else{if(D.nodeType==h.TEXT_NODE||D.nodeType==h.CDATA_SECTION_NODE){return D.nodeValue;}}}}function o(I,F,H,C){var E="<"+((I!=null&&I.__prefix!=null)?(I.__prefix+":"):"")+F;if(H!=null){for(var G=0;G";}else{E+="/>";}return E;}function j(C,B){return""+(C.__prefix!=null?(C.__prefix+":"):"")+B+">";}function v(C,B){return C.indexOf(B,C.length-B.length)!==-1;}function y(C,B){if((z.arrayAccessForm=="property"&&v(B.toString(),("_asArray")))||B.toString().indexOf(z.attributePrefix)==0||B.toString().indexOf("__")==0||(C[B] instanceof Function)){return true;}else{return false;}}function m(D){var C=0;if(D instanceof Object){for(var B in D){if(y(D,B)){continue;}C++;}}return C;}function l(D,B,C){return z.jsonPropertiesFilter.length==0||C==""||w(z.jsonPropertiesFilter,D,B,C);}function c(D){var C=[];if(D instanceof Object){for(var B in D){if(B.toString().indexOf("__")==-1&&B.toString().indexOf(z.attributePrefix)==0){C.push(B);}}}return C;}function g(C){var B="";if(C.__cdata!=null){B+="";}if(C.__text!=null){if(z.escapeMode){B+=s(C.__text);}else{B+=C.__text;}}return B;}function d(C){var B="";if(C instanceof Object){B+=g(C);}else{if(C!=null){if(z.escapeMode){B+=s(C);}else{B+=C;}}}return B;}function p(C,B){if(C===""){return B;}else{return C+"."+B;}}function f(D,G,F,E){var B="";if(D.length==0){B+=o(D,G,F,true);}else{for(var C=0;C0){for(var E in I){if(y(I,E)||(H!=""&&!l(I,E,p(H,E)))){continue;}var D=I[E];var G=c(D);if(D==null||D==undefined){B+=o(D,E,G,true);}else{if(D instanceof Object){if(D instanceof Array){B+=f(D,E,G,H);}else{if(D instanceof Date){B+=o(D,E,G,false);B+=D.toISOString();B+=j(D,E);}else{var C=m(D);if(C>0||D.__text!=null||D.__cdata!=null){B+=o(D,E,G,false);B+=e(D,p(H,E));B+=j(D,E);}else{B+=o(D,E,G,true);}}}}else{B+=o(D,E,G,false);B+=d(D);B+=j(D,E);}}}}B+=d(I);return B;}this.parseXmlString=function(D){var F=window.ActiveXObject||"ActiveXObject" in window;if(D===undefined){return null;}var E;if(window.DOMParser){var G=new window.DOMParser();var B=null;if(!F){try{B=G.parseFromString("INVALID","text/xml").getElementsByTagName("parsererror")[0].namespaceURI;}catch(C){B=null;}}try{E=G.parseFromString(D,"text/xml");if(B!=null&&E.getElementsByTagNameNS(B,"parsererror").length>0){E=null;}}catch(C){E=null;}}else{if(D.indexOf("")==0){D=D.substr(D.indexOf("?>")+2);}E=new ActiveXObject("Microsoft.XMLDOM");E.async="false";E.loadXML(D);}return E;};this.asArray=function(B){if(B===undefined||B==null){return[];}else{if(B instanceof Array){return B;}else{return[B];}}};this.toXmlDateTime=function(B){if(B instanceof Date){return B.toISOString();}else{if(typeof(B)==="number"){return new Date(B).toISOString();}else{return null;}}};this.asDateTime=function(B){if(typeof(B)=="string"){return a(B);}else{return B;}};this.xml2json=function(B){return A(B);};this.xml_str2json=function(B){var C=this.parseXmlString(B);if(C!=null){return this.xml2json(C);}else{return null;}};this.json2xml_str=function(B){return e(B,"");};this.json2xml=function(C){var B=this.json2xml_str(C);return this.parseXmlString(B);};this.getVersion=function(){return t;};};}));
window.bioEp = {
// Private variables
bgEl: {},
popupEl: {},
closeBtnEl: {},
shown: false,
overflowDefault: "visible",
transformDefault: "",
// Popup options
width: 400,
height: 220,
html: "",
css: "",
fonts: [],
delay: 5,
showOnDelay: false,
cookieExp: 30,
showOncePerSession: false,
onPopup: null,
// Object for handling cookies, taken from QuirksMode
// http://www.quirksmode.org/js/cookies.html
cookieManager: {
// Create a cookie
create: function(name, value, days, sessionOnly) {
var expires = "";
if(sessionOnly)
expires = "; expires=0"
else if(days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toGMTString();
}
document.cookie = name + "=" + value + expires + "; path=/";
//console.log(name+" expires "+expires);
},
// Get the value of a cookie
get: function(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(";");
for(var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == " ") c = c.substring(1, c.length);
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
}
return null;
},
// Delete a cookie
erase: function(name) {
this.create(name, "", -1);
}
},
// Handle the bioep_shown cookie
// If present and true, return true
// If not present or false, create and return false
checkCookie: function() {
// Handle cookie reset
if(this.cookieExp <= 0) {
// Handle showing pop up once per browser session.
if(this.showOncePerSession && this.cookieManager.get("bioep_shown_session") == "true")
return true;
this.cookieManager.erase("bioep_shown");
return false;
}
// If cookie is set to true
if(this.cookieManager.get("bioep_shown") == "true")
return true;
return false;
},
// Add font stylesheets and CSS for the popup
addCSS: function() {
// Add font stylesheets
for(var i = 0; i < this.fonts.length; i++) {
var font = document.createElement("link");
font.href = this.fonts[i];
font.type = "text/css";
font.rel = "stylesheet";
document.head.appendChild(font);
}
// Base CSS styles for the popup
var css = document.createTextNode(
"#bio_ep_bg {display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #000; opacity: 0.3; z-index: 10001;}" +
"#bio_ep {display: none; position: fixed; width: " + this.width + "px; height: " + this.height + "px; font-family: 'Titillium Web', sans-serif; font-size: 16px; left: 50%; top: 50%; transform: translateX(-50%) translateY(-50%); -webkit-transform: translateX(-50%) translateY(-50%); -ms-transform: translateX(-50%) translateY(-50%); background-color: #fff; box-shadow: 0px 1px 4px 0 rgba(0,0,0,0.5); z-index: 10002;}" +
"#bio_ep_close {position: absolute; left: 100%; margin: -8px 0 0 -12px; width: 20px; height: 20px; color: #fff; font-size: 12px; font-weight: bold; text-align: center; border-radius: 50%; background-color: #5c5c5c; cursor: pointer;}" +
this.css
);
// Create the style element
var style = document.createElement("style");
style.type = "text/css";
style.appendChild(css);
// Insert it before other existing style
// elements so user CSS isn't overwritten
// document.head.insertBefore(style, document.getElementsByTagName("style")[0]);
document.head.appendChild(style);
},
// Add the popup to the page
addPopup: function() {
// Add the background div
this.bgEl = document.createElement("div");
this.bgEl.id = "bio_ep_bg";
document.body.appendChild(this.bgEl);
// Add the popup
if(document.getElementById("bio_ep"))
this.popupEl = document.getElementById("bio_ep");
else {
this.popupEl = document.createElement("div");
this.popupEl.id = "bio_ep";
this.popupEl.innerHTML = this.html;
document.body.appendChild(this.popupEl);
}
// Add the close button
if(document.getElementById("bio_ep_close"))
this.closeBtnEl = document.getElementById("bio_ep_close");
else {
this.closeBtnEl = document.createElement("div");
this.closeBtnEl.id = "bio_ep_close";
this.iconClose=document.createElement("i");
this.iconClose.className="fa fa-times";
this.closeBtnEl.appendChild(this.iconClose);
this.popupEl.insertBefore(this.closeBtnEl, this.popupEl.firstChild);
}
},
// Show the popup
showPopup: function() {
if(this.shown) return;
this.bgEl.style.display = "block";
this.popupEl.style.display = "block";
// Handle scaling
this.scalePopup();
// Save body overflow value and hide scrollbars
this.overflowDefault = document.body.style.overflow;
document.body.style.overflow = "hidden";
this.shown = true;
//console.log(this.cookieExp);;
this.cookieManager.create("bioep_shown", "true", this.cookieExp, false);
this.cookieManager.create("bioep_shown_session", "true", 0, true);
if(typeof this.onPopup === "function") {
this.onPopup();
}
},
// Hide the popup
hidePopup: function() {
this.bgEl.style.display = "none";
this.popupEl.style.display = "none";
// Set body overflow back to default to show scrollbars
document.body.style.overflow = this.overflowDefault;
},
// Handle scaling the popup
scalePopup: function() {
var margins = { width: 40, height: 40 };
var popupSize = { width: bioEp.popupEl.offsetWidth, height: bioEp.popupEl.offsetHeight };
var windowSize = { width: window.innerWidth, height: window.innerHeight };
var newSize = { width: 0, height: 0 };
var aspectRatio = popupSize.width / popupSize.height;
// First go by width, if the popup is larger than the window, scale it
if(popupSize.width > (windowSize.width - margins.width)) {
newSize.width = windowSize.width - margins.width;
newSize.height = newSize.width / aspectRatio;
// If the height is still too big, scale again
if(newSize.height > (windowSize.height - margins.height)) {
newSize.height = windowSize.height - margins.height;
newSize.width = newSize.height * aspectRatio;
}
}
// If width is fine, check for height
if(newSize.height === 0) {
if(popupSize.height > (windowSize.height - margins.height)) {
newSize.height = windowSize.height - margins.height;
newSize.width = newSize.height * aspectRatio;
}
}
// Set the scale amount
var scaleTo = newSize.width / popupSize.width;
// If the scale ratio is 0 or is going to enlarge (over 1) set it to 1
if(scaleTo <= 0 || scaleTo > 1) scaleTo = 1;
// Save current transform style
if(this.transformDefault === "")
this.transformDefault = window.getComputedStyle(this.popupEl, null).getPropertyValue("transform");
// Apply the scale transformation
this.popupEl.style.transform = this.transformDefault + " scale(" + scaleTo + ")";
},
// Event listener initialisation for all browsers
addEvent: function (obj, event, callback) {
if(obj.addEventListener)
obj.addEventListener(event, callback, false);
else if(obj.attachEvent)
obj.attachEvent("on" + event, callback);
},
// Load event listeners for the popup
loadEvents: function() {
// Track mouseout event on document
this.addEvent(document, "mouseout", function(e) {
e = e ? e : window.event;
// If this is an autocomplete element.
if(e.target.tagName.toLowerCase() == "input")
return;
// Get the current viewport width.
var vpWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
// If the current mouse X position is within 50px of the right edge
// of the viewport, return.
if(e.clientX >= (vpWidth - 50))
return;
// If the current mouse Y position is not within 50px of the top
// edge of the viewport, return.
if(e.clientY >= 50)
return;
// Reliable, works on mouse exiting window and
// user switching active program
var from = e.relatedTarget || e.toElement;
if(!from)
bioEp.showPopup();
}.bind(this));
// Handle the popup close button
this.addEvent(this.closeBtnEl, "click", function() {
bioEp.hidePopup();
});
// Handle window resizing
this.addEvent(window, "resize", function() {
bioEp.scalePopup();
});
},
// Set user defined options for the popup
setOptions: function(opts) {
this.width = (typeof opts.width === 'undefined') ? this.width : opts.width;
this.height = (typeof opts.height === 'undefined') ? this.height : opts.height;
this.html = (typeof opts.html === 'undefined') ? this.html : opts.html;
this.css = (typeof opts.css === 'undefined') ? this.css : opts.css;
this.fonts = (typeof opts.fonts === 'undefined') ? this.fonts : opts.fonts;
this.delay = (typeof opts.delay === 'undefined') ? this.delay : opts.delay;
this.showOnDelay = (typeof opts.showOnDelay === 'undefined') ? this.showOnDelay : opts.showOnDelay;
this.cookieExp = (typeof opts.cookieExp === 'undefined') ? this.cookieExp : opts.cookieExp;
this.showOncePerSession = (typeof opts.showOncePerSession === 'undefined') ? this.showOncePerSession : opts.showOncePerSession;
this.onPopup = (typeof opts.onPopup === 'undefined') ? this.onPopup : opts.onPopup;
},
// Ensure the DOM has loaded
domReady: function(callback) {
(document.readyState === "interactive" || document.readyState === "complete") ? callback() : this.addEvent(document, "DOMContentLoaded", callback);
},
// Initialize
init: function(opts) {
// Handle options
if(typeof opts !== 'undefined')
this.setOptions(opts);
// Add CSS here to make sure user HTML is hidden regardless of cookie
this.addCSS();
// Once the DOM has fully loaded
this.domReady(function() {
// Handle the cookie
if(bioEp.checkCookie()) return;
// Add the popup
bioEp.addPopup();
// Load events
setTimeout(function() {
bioEp.loadEvents();
if(bioEp.showOnDelay)
bioEp.showPopup();
}, bioEp.delay * 1000);
});
}
}