var backgroundListIndex = 0;
var backgroundList = [['1','/uploads/71020/pagetemplates/DesignCreated201901161709/images/abstract-008.jpg'],['2','/uploads/71020/pagetemplates/DesignCreated201901161709/images/935b0340-29ab-4622-bca6-b8b8ce5728c5.jpg'],['3','/uploads/71020/pagetemplates/DesignCreated201901161709/images/b57c61c2-624a-4ce9-8085-7e179dddb8ed.jpg'],['4','/uploads/71020/pagetemplates/DesignCreated201901161709/images/c5453f8f-49a1-458e-af3b-02393252a7fe.jpg'],['5','/uploads/71020/pagetemplates/DesignCreated201901161709/images/2001b211-d475-43f7-9288-56e03c631b74.jpg'],['6','/uploads/71020/pagetemplates/DesignCreated201901161709/images/be38237c-4178-4fa4-898e-3d595269a207.jpg']];
$(document).ready(function () {
App.init();
$('.bg').css('background-color', '#ffffff');
$('.ts-section').css('min-height','50px');
$('.ts-section').each(function () {
var sectionId = $(this).attr('id');
var tsMsg = 'Section ' + sectionId +
': This divider is for your convenience while editing. Visitors to your site will not see it ' +
'
(swap background)';
$(this).find('.alert-warning').html(tsMsg);
$(this).find('.alert-warning').css('padding-top', '1px');
$(this).find('.alert-warning').css('padding-bottom', '1px');
});
var initial_backgroundPage = localStorage.getItem("backgroundPage");
// the string value of "null" was being stored/returned from getItem call, I expanded this if block to cover all potential values
if (initial_backgroundPage == 'undefined' || initial_backgroundPage == undefined || initial_backgroundPage == null || initial_backgroundPage == "null") {
initial_backgroundPage = '1';
};
var targetTagId = convertBackgroundPageToTagId(initial_backgroundPage);
$('#pnlPageContent .menuItem').addClass('page-scroll');
$('#pnlPageContent .tsTxtButton').addClass('page-scroll'); // used by the single page layouts
$('a.page-scroll').click(function(e) {
var $anchor = $(this);
var href = $anchor.attr('href');
var target = $anchor.attr('target');
if (target == '_blank') {
return true;
}
e.preventDefault();
try {
var msgid = $(this).attr('data-msgid');
if (typeof msgid == "undefined" || msgid == '') {
}
else {
if (publicMsgid == msgid) {
}
else {
location.assign(href);
return false;
}
}
}
catch(err) {
}
// get the part after the pound sign
var n = href.indexOf("#");
if (n < 0) {
var tsSection = $(this).attr('ts_section');
if (typeof tsSection == "undefined" || tsSection == '') {
}
else {
href += '#' + tsSection;
}
location.assign(href);
return false;
}
href = href.substring(n, href.length);
//var backgroundPage = convertTargetTagIdToBackgroundPage(href);
if (href == "#a") {
$('html, body').stop().animate({
scrollTop: 0
}, 1000, 'easeInOutExpo').promise().done(function () {
/* see if there is a background pic for this page */
//setBackgroundPage(backgroundPage);
});
return false;
}
$('html, body').stop().animate({
scrollTop: $(href).offset().top
}, 1000, 'easeInOutExpo').promise().done(function () {
/* see if there is a background pic for this page */
//setBackgroundPage(backgroundPage);
});
return false;
});
$("#talkspot-footer").css('background-color', 'black');
$("#talkspot-footer").css('padding', '1px 1px 1px 1px');
$("#talkspot-footer *").css('color', 'white');
$("#talkspot-footer *").css('font-size', 'x-small');
for (i = 0; i < backgroundList.length; i++) {
var targetId = convertBackgroundPageToTagId(backgroundList[i][0]);
$(targetId).css('background-image', 'url(' + backgroundList[i][1] + ')');
$(targetId).css('background-size', 'cover');
}
setTimeout(function () {
/* see if there is a background pic for this page */
setBackgroundPage(initial_backgroundPage);
}, 500);
}); // end doc.ready
function setBackgroundPage(target_backgroundPage) {
localStorage.setItem("backgroundPage", target_backgroundPage);
return;
}
function convertBackgroundPageToTagId(backgroundPage) {
var targetTagId = '#a';
switch (backgroundPage) {
case '1':
targetTagId = '#a';
break;
case '2':
targetTagId = '#b';
break;
case '3':
targetTagId = '#c';
break;
case '4':
targetTagId = '#d';
break;
case '5':
targetTagId = '#e';
break;
case '6':
targetTagId = '#f';
break;
}
return targetTagId;
}
function convertTargetTagIdToBackgroundPage(targetTagId) {
var backgroundPage = '1';
switch (targetTagId) {
case '#a':
backgroundPage = '1';
break;
case '#b':
backgroundPage = '2';
break;
case '#c':
backgroundPage = '3';
break;
case '#d':
backgroundPage = '4';
break;
case '#e':
backgroundPage = '5';
break;
case '#f':
backgroundPage = '6';
break;
}
return backgroundPage;
}