');
var litebg = jQuery('');
var rightBtn = jQuery('');
var closeBtn = jQuery('');
// add lightbox first image
jQuery('body').append(litebg).append(lightbox);
jQuery('#lightbox').css({"background": "url(/bundles/twsite/images/tour/tour-1.jpg) no-repeat", 'width': '100%',
'background-size':' cover'});
jQuery('#lightbox').append(rightBtn).append(closeBtn);
jQuery('#right-btn').wrap("
");
jQuery('#close-btn').wrap("");
}
jQuery('#lightbox-bg').click(function(e){
jQuery('#lightbox').hide();
jQuery('#lightbox-bg').hide();
jQuery('.tour-btn').hide();
console.log('iwork');
});
jQuery('#lightbox').show();
jQuery('#lightbox-bg').show();
jQuery('.tour-btn').show();
}
function buttonSet(){}
// light box left button
function leftBtn(){
if (imgIndex === 2) {
//jQuery('#lightbox img').remove();
jQuery('#lightbox').css({"background": "url(/bundles/twsite/images/tour/tour-1.jpg) no-repeat", 'width': '100%',
'background-size':' cover'});
//jQuery('#lightbox').prepend('');
jQuery('#left-btn').remove();
imgIndex = 1;
console.log(imgIndex);
} else if (imgIndex === 3) {
//jQuery('#lightbox img').remove();
jQuery('.3-btn').remove();
jQuery('#lightbox').css({"background": "url(/bundles/twsite/images/tour/tour-2.jpg) no-repeat", 'width': '100%',
'background-size':' cover'});
//jQuery('#lightbox').prepend('');
jQuery('#lightbox').append('');
jQuery('#right-btn').wrap("");
imgIndex = 2;
console.log(imgIndex);
}
}
// light box right button
function rightBtn(){
if (imgIndex === 1) {
//jQuery('#lightbox img').remove();
jQuery('#lightbox').css({"background": "url(/bundles/twsite/images/tour/tour-2.jpg) no-repeat", 'width': '100%',
'background-size':' cover'});
//jQuery('#lightbox').prepend('');
jQuery('#lightbox').append('');
jQuery('#left-btn').wrap("");
imgIndex = 2;
console.log(imgIndex);
//document.getElementById("lightbox").style.backgroundSize="100% auto";
} else if (imgIndex === 2) {
//jQuery('#lightbox img').remove();
jQuery('#lightbox').css({"background": "url(/bundles/twsite/images/tour/tour-3.jpg) no-repeat", 'width': '100%',
'background-size':' cover'});
//jQuery('#lightbox').prepend('');
jQuery('#lightbox').append('');
jQuery('#select-box').append('');
jQuery('#close-btn2').wrap("");
jQuery('#select-box').append('');
jQuery('#editor-btn').wrap("");
jQuery('#select-box').append('');
jQuery('#msg-btn').wrap("");
jQuery('#right-btn').remove();
imgIndex = 3;
console.log(imgIndex);
document.getElementById("lightbox").style.backgroundSize="100% auto";
}
}
// close lightbox
function closeBtn(){
jQuery('#lightbox').hide();
jQuery('#lightbox-bg').hide();
jQuery('.tour-btn').hide();
}
jQuery('#lightbox-bg').click(function(){
jQuery(this).closeBtn();
})
//End code for the lightbox
//Show Geico
function showGeico(){
if( TheWeek.getCurrentDevice() == 'desktop'){
//get the currentDate
var fullDate = new Date();
var twoDigitMonth = fullDate.getMonth()+1+"";if(twoDigitMonth.length==1) twoDigitMonth="0" +twoDigitMonth;
var twoDigitDate = fullDate.getDate()+"";if(twoDigitDate.length==1) twoDigitDate="0" +twoDigitDate;
var currentDate = fullDate.getFullYear()+"-"+ twoDigitMonth +"-"+ twoDigitDate;
//Dates when Geico shouldn't show up
var geicoCalendar= [
'2015-01-15',
'2015-01-16',
'2015-01-20',
'2015-01-22',
'2015-01-26',
'2015-02-03',
'2015-02-11',
'2015-02-12',]
//if it's homepage show it only if it's not one of those days
if(jQuery('.homepage-articles').length){
if( (jQuery.inArray( currentDate, geicoCalendar)) == -1 ){
var Geicopixel = new Image();
Geicopixel.src="http://ad.doubleclick.net/ad/N6595.126161THEWEEKMAGAZINE/B8452320.114491333;sz=1x1;ord=[timestamp]?";
Geicopixel.width="1px"; Geicopixel.height="1px";
Geicopixel.alt="Advertisement";
jQuery('#tour-container').append('');
jQuery('#tour-container').show();
}
}
//the rest of the pages
else{
var Geicopixel = new Image();
Geicopixel.src="http://ad.doubleclick.net/ad/N6595.126161THEWEEKMAGAZINE/B8452320.114491333;sz=1x1;ord=[timestamp]?";
Geicopixel.width="1px"; Geicopixel.height="1px";
Geicopixel.alt="Advertisement";
jQuery('#tour-container').append('
');
jQuery('#tour-container').show();
}
}
}
//set a cookie for the Geico tour
jQuery(function(){
if ( (jQuery.cookie("t_cookie") ) == null) {
jQuery.cookie("t_cookie", "first_time", { path: '/', expires: 365 });
showGeico();
}else{
if( jQuery.cookie("t_cookie") == "first_time"){
jQuery.cookie("t_cookie", "second_time", {expires: 365, path: '/' });
showGeico();
}else if( jQuery.cookie("t_cookie") == "second_time"){
jQuery.cookie("t_cookie", "third_time", { expires: 365, path: '/' });
showGeico();
}else if( jQuery.cookie("t_cookie") == "third_time"){
jQuery('#tour-container').hide();
}
}
});
',
});
});
function activateLeftbarSR(){
if((TheWeek.getCurrentDevice() == 'desktop') || (TheWeek.getCurrentDevice() == 'tablet') ){
var cutoff_top = ( (jQuery(window).scrollTop()+1) + jQuery('#header').height()+ 33 );
var cutoff_bottom = (jQuery(window).scrollTop()+1 + jQuery(window).height());
jQuery('.sp-article').removeClass('top').each(function() {
if ( ( (jQuery(this).offset().top + (jQuery(this).height() - 100 )) > ( (jQuery(window).scrollTop()+1) + jQuery('#header').height()+ 33 ))) {
//console.log('The new id is' + jQuery(this).attr('id'));
jQuery(this).addClass('top');
id=jQuery(this).attr('id');
console.log(id);
jQuery('.scroller li').removeClass('active').each(function() {
if(jQuery(this).attr('id') == 'sr-'+id){
jQuery(this).prevUntil('.first-ad').css('display', 'none');
jQuery('.first-ad').css('display', 'block');
jQuery(this).addClass('active');
jQuery(this).nextAll().css('display', 'block');
}
});
return false;
}
});
}
}
Read more