destini = {
elementId: '',
associationId: false,
APO: false,
WTIT: false,
};
destini.loadIframe = function(elementId){
var host = 'destinilocators.com';
var client = 'bluebunny';
var clientIteration = 'pdpwidget';
var systemParameters = 'WTIT=Bunny+Tracks';
var locator = host + '/' + client + '/' + clientIteration + '/locator.php';
var referrer = '?RFR=' + window.location.protocol + '//' + window.location.hostname + window.location.pathname;
var customParameters = '';
if(destini.associationId !== false){
customParameters += 'ASSC=' + destini.associationId;
}
if (typeof destini.APO !== 'undefined') {
customParameters += '&APO=' + destini.APO;
}
if (typeof destini.WTIT !== 'undefined') {
customParameters += '&WTIT=' + destini.WTIT;
}
var search = location.search.substring(1);
var getQuery = false;
try {
var getQuery = JSON.parse('{"' + decodeURI(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g,'":"') + '"}');
} catch(e) {
}
var systemParametersQuery = false;
try {
var systemParametersQuery = JSON.parse('{"' + decodeURI(systemParameters).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g,'":"') + '"}');
} catch(e) {
}
if(systemParametersQuery!==false && getQuery !== false){
for(var k in getQuery){
systemParametersQuery[k] = getQuery[k];
}
} else if (getQuery!==false){
systemParametersQuery = getQuery;
}
function serialize(obj) {
return obj!==false ? ''+Object.keys(obj).reduce(function(a,k){a.push(k+'='+encodeURIComponent(obj[k]));return a},[]).join('&') : '';
}
systemParameters = serialize(systemParametersQuery);
var html = '';
// document.write(html);
document.getElementById(destini.elementId).innerHTML = html;
}
// destini.loadIframe();
destini.destroyIframe = function(){
document.getElementById(destini.elementId).innerHTML = '';
};
destini.init = function(containerId){
destini.elementId = containerId;
};
destini.loadWidget = function(associationId, APO, WTIT){
destini.associationId = associationId;
destini.APO = APO;
destini.WTIT = WTIT;
destini.loadIframe();
};
function loadScript(url, callback){
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
script.onreadystatechange = callback;
script.onload = callback;
head.appendChild(script);
}
function loadResizeScript(){
loadScript('//destinilocators.com/control/gtm.js', function(){ });
if(window.location.protocol=='http:'){
loadScript('//destinilocators.com/control/pscript.js', function(){ });
}else{
loadScript('//destinilocators.com/control/pscript_s.js', function(){ });
}
}
loadResizeScript();