(function(){
window.top.LiveRailParameters = {
COMP: 0,
POSITION: 3,
BG: '1',
MANUAL_HOUR_LIMIT: 10,
MANUAL_SET_SIZE: 25,
MANUAL_STRIKE_IMPRESSION: 1,
CAP_TYPE: 'time',
AE_CLOSE_WAIT: 2,
AE_VOLUME: 0.10,
LR_PUBLISHER_ID: 10327,
LR_PARTNERS: 707373,
LR_LAYOUT_SKIN_ID: 2,
LR_VERTICALS: 'vslider',
LR_AUTOPLAY:1,
LR_URL: 'http://www.examiner.com/article/sandy-hackett-s-rat-pack-turns-back-the-clock-at-the-cobb-energy-centre',
LR_CONTENT:6,
LR_TITLE:'adexcitecontent',
LR_VIDEO_ID:'adexcitecontent',
LR_LAYOUT_LINEAR_PAUSEONCLICKTHRU: 0,
LR_TAGS: '',
IOS: 'no'
};
var q1Forward = false,
epochTime,
impressionCount,
q1Date,
/***localOrCookie,***/ /***uncommentMe when you are ready to track video end for desktop***/
q1DateObject = new Date(),
q1Day = q1DateObject.getDate(),
q1Month = q1DateObject.getMonth(),
q1Year = q1DateObject.getFullYear(),
q1Expiry = new Date(q1DateObject.getTime() + 365 * 24 * 3600 * 1000),
HourLimit,
StrikeImpression,
CapType,
storType = "localStorage",
SetSize;
q1Date = q1Day+" "+q1Month+" "+q1Year;
epochTime = q1DateObject.getTime();
LiveRailParameters = window.top.LiveRailParameters;
/***Get Frequency Cap Params***/
HourLimit = LiveRailParameters.MANUAL_HOUR_LIMIT? LiveRailParameters.MANUAL_HOUR_LIMIT : 24;
StrikeImpression = LiveRailParameters.MANUAL_STRIKE_IMPRESSION? LiveRailParameters.MANUAL_STRIKE_IMPRESSION : 2;
CapType = LiveRailParameters.CAP_TYPE? LiveRailParameters.CAP_TYPE : "impressions";
SetSize = LiveRailParameters.MANUAL_SET_SIZE? LiveRailParameters.MANUAL_SET_SIZE : 7;
function adImpression (storType){
if (!impressionCount) impressionCount = 1;
if (storType == "cookie"){
setCookie('q1impressionCount',impressionCount);
setCookie("Q1-Date", q1Date);
setCookie('Q1-Hours', epochTime);
}else{
localStorage.setItem('Q1-Date', q1Date);
localStorage.setItem('Q1-impressionCount',impressionCount);
localStorage.setItem('Q1-Hours', epochTime);
}
}
if (CapType == "none"){
q1Forward = true;
}else{
if (localStorage) {
/***begin date reset***/
if(localStorage.getItem("Q1-Date")){
if (localStorage.getItem("Q1-Date") != q1Date) {
q1Forward = true;
}
}else{
q1Forward= true;
}
/***end date reset***/
if (CapType == "impressions"){
impressionCount = localStorage.getItem('Q1-impressionCount') ? (parseInt(localStorage.getItem('Q1-impressionCount')) + 1) : 1;
if(localStorage.getItem("Q1-Date")){
if (localStorage.getItem("Q1-Date") != q1Date) {
impressionCount = 1;
}
}
if (impressionCount >= (SetSize + 1)) impressionCount = 1;
if (impressionCount == StrikeImpression){
q1Forward = true;
}
}else{
if (localStorage.getItem('Q1-Hours')){
if ((epochTime - localStorage.getItem('Q1-Hours')) > (HourLimit * 3600000)){
q1Forward = true;
}
}else{
q1Forward = true;
}
localStorage.setItem('Q1-Date', q1Date); //stays, not part of a trigger
}
}else{
storType = "cookie";
function setCookie(name, value) {
document.cookie=name + "=" + escape(value) + "; path=/; expires=" + q1Expiry.toGMTString();
}
function getCookie(name) {
var re = new RegExp(name + "=([^;]+)");
var value = re.exec(document.cookie);
return (value != null) ? unescape(value[1]) : null;
}
/***begin date reset***/
if(getCookie("Q1-Date")){
if (getCookie("Q1-Date") != q1Date) {
q1Forward = true;
}
}else{
q1Forward= true;
}
/***end date reset***/
if (CapType == "impressions"){
impressionCount = getCookie('q1impressionCount') ? (parseInt(getCookie('q1impressionCount')) + 1) : 1;
if(getCookie("Q1-Date")){
if (getCookie("Q1-Date") != q1Date){
impressionCount = 1;
}
if (impressionCount >= (SetSize + 1)) impressionCount = 1;
if (impressionCount == StrikeImpression ){
q1Forward = true;
}
}else{
impressionCount = 1;
/***setCookie("q1SeenAdCount", form.field1.value);***/ /***uncommentME when ready to begin tracking seen ad count***/
}
}else{
if (getCookie('Q1-Hours')){
if ((epochTime - getCookie('Q1-Hours')) > (HourLimit * 3600000)){
q1Forward = true;
}
}else{
q1Forward = true;
}
setCookie("Q1-Date", q1Date); //needs moved?
}
}
}
if (q1Forward === true) {
var LiveRailObject = {},
loaderElement,
initial,
customBackground = {},
customAdjustments = {},
cornerAdjust = {},
displayed,
targetDocument;
// Determine target document
try {
if (top === self) {
targetDocument = document;
} else {
targetDocument = window.top.document;
}
if (!targetDocument) {
// there is no valid document, fail
return;
}
} catch (e) {
// window.top is not accessible, fail
return;
}
function inclJS(source) {
var script = document.createElement("script");
script.src = source;
document.getElementsByTagName('head')[0].appendChild(script);
}
function pollJS() {
if (typeof jQuery == 'function') {
clearInterval(pollInt);
if (typeof $$$$ != 'undefined' && jQuery !== $$$$) {
jQuery.noConflict();
}
makeCustomAdjustments(window.top.LiveRailParameters.POSITION);
preloadCornerAd();
loadLiveRail(function () {
var width, height, creativeData = {}, environmentVars = {}, i;
LiveRailObject.subscribe(function () {
jQuery(targetDocument.getElementById('container-ad-excite')).css({
'bottom': -500
});
LiveRailObject.setAdVolume(LiveRailParameters.AE_VOLUME);
LiveRailObject.startAd();
}, 'AdLoaded');
LiveRailObject.subscribe(function () {}, 'AdStarted');
LiveRailObject.subscribe(function () {
generateCornerAd();
closeCountdown();
letEmKnow();
adImpression(storType);
}, 'AdImpression');
LiveRailObject.subscribe(function () {
unloadCornerAd();
}, 'AdStopped');
LiveRailObject.subscribe(function () {
unloadCornerAd();
}, 'AdError');
width = targetDocument.getElementById('vidPlayer').offsetWidth;
height = targetDocument.getElementById('vidPlayer').offsetHeight;
environmentVars = {
LR_ENVIRONMENT: 'flash',
LR_COMPANIONS: '300:250:corner-ad-excite|430:257:corner-ad-excite-2|430:318:corner-ad-excite-3|430:350:corner-ad-excite-4'
};
for (i in LiveRailParameters) {
if (LiveRailParameters.hasOwnProperty(i)) {
environmentVars[i] = LiveRailParameters[i];
}
}
environmentVars.slot = targetDocument.getElementById('vidPlayer');
LiveRailObject.initAd(width, height, '', '', creativeData, environmentVars);
});
}
}
function preloadCornerAd() {
// Establish ad layout elements
jQuery('
').css({
'position': 'fixed',
'z-index': 21e8,
'font': '12px "Trebuchet MS", Arial, Helvetica, sans-serif',
'-moz-box-shadow': '0px 2px 0px 0px #333',
'box-shadow': '0px 2px 0px 0px #333'
}).css(initial).css(customBackground).append(
jQuery('')).append(
jQuery('').append(
jQuery('').css({
'width': 430,
'height': 242
})).css({
'clear': 'right'
})).appendTo(targetDocument.body);
// *** Add companion
jQuery(targetDocument.getElementById('video-creative')).before(
jQuery('
'));
jQuery(targetDocument.getElementById('video-creative')).before(
jQuery('
'));
jQuery(targetDocument.getElementById('video-creative')).before(
jQuery('
'));
jQuery(targetDocument.getElementById('video-creative')).before(
jQuery('
'));
jQuery(targetDocument.getElementById('video-creative')).before(
jQuery('
'));
jQuery(targetDocument.getElementById('corner-ad-excite')).css('display', 'none');
jQuery(targetDocument.getElementById('corner-ad-excite-2')).css('display', 'none');
jQuery(targetDocument.getElementById('corner-ad-excite-3')).css('display', 'none');
jQuery(targetDocument.getElementById('corner-ad-excite-4')).css('display', 'none');
}
function letEmKnow() {
jQuery.post('http://174.143.186.215/count', {
eid: window.top.LiveRailParameters.LR_PUBLISHER_ID
});
}
function makeCustomAdjustments(position){
switch (position) {
case 1: //bottomRight
initial = {bottom:'-430px', right:0};
displayed = {bottom:0};
break;
case 2: //bottomMiddle
initial = {bottom:'-430px', right:'50%', marginRight:'-217px'};
displayed = {bottom:0};
break;
case 3: //bottomLeft
initial = {bottom:'-430px', left:0};
displayed = {bottom:0};
break;
case 4: //topLeft
initial = {top:'-380px', left:0};
displayed = {top:0};
break;
case 5: //topMiddle
initial = {top:'-380px', right:'50%', marginRight:'-217px'};
displayed = {top:0};
break;
case 6: //topRight
initial = {top:'-380px', right:0};
displayed = {top:0};
break;
}
if (window.top.LiveRailParameters.BG.length > 2){
customBackground = {
background: "url('"+window.top.LiveRailParameters.BG+"')",
height: '313px',
width: '450px'};
customAdjustments = {
background: 'transparent !important',
boxShadow: 'none',
border: '0px solid #000 !important',
marginLeft: '10px',
marginTop: '46px'
};
cornerAdjust = {
bottom: '10px',
right: '10px'
};
}
}
function generateCornerAd() {
// Add skin to add layout
jQuery(targetDocument.getElementById('close-corner-ad')).html('You may close this ad in
' + LiveRailParameters.AE_CLOSE_WAIT + ' second
s.').css({
'position': 'absolute',
'background': 'black url("http://c400517.r17.cf1.rackcdn.com/adexcite_x.png") 0 50px no-repeat',
'bottom': '0%',
'right': 1,
'padding': '0 3px',
'color': '#777'
});
if (window.top.LiveRailParameters.BG.length > 2){
jQuery("#video-creative").css(customAdjustments);
}else{
jQuery(targetDocument.getElementById('video-creative')).css({
'border-width': '1px 2px',
'border-style': 'solid',
'border-color': '#000',
'-moz-box-shadow': '0px 2px 0px 0px #333',
'box-shadow': '0px 2px 0px 0px #333',
'background': 'black'
});
}
jQuery(targetDocument.getElementById('corner-ad-excite')).css({
'z-index': 21e7,
'vertical-align': '45%',
'text-align': 'center',
'position': 'relative',
'float': 'right'
});
jQuery(targetDocument.getElementById('corner-ad-excite-2')).css({
'z-index': 21e7,
'vertical-align': '45%',
'text-align': 'center',
'position': 'absolute',
'float': 'right',
'bottom': 244,
'margin-right': '0px',
'border-width': '2px 2px 0px 2px',
'border-style': 'solid',
'border-color': '#000',
'-moz-box-shadow': '0 3px 0px 2px #777',
'background-color': '#000'
});
jQuery(targetDocument.getElementById('corner-ad-excite-3')).css({
'z-index': 21e7,
'vertical-align': '45%',
'text-align': 'center',
'position': 'relative',
'bottom': -14,
'float': 'right',
'margin-right': '0px',
'border-width': '1px 4px',
'border-style': 'solid',
'border-color': '#000',
'-moz-box-shadow': '1 3px 0px 2px #777',
'background-color': '#00142c',
'border-width': '2px 2px 0px 2px',
'box-shadow': '#333 0px 2px 0px 0px'
});
jQuery(targetDocument.getElementById('corner-ad-excite-4')).css({
'z-index': 21e7,
'vertical-align': '45%',
'text-align': 'center',
'position': 'relative',
'bottom': -18,
'float': 'right',
'margin-right': '0px',
'border-width': '1px 2px',
'border-style': 'solid',
'border-color': '#000',
'-moz-box-shadow': '0 3px 0px 2px #777',
'background-color': '#000'
});
jQuery(targetDocument.getElementById('vidPlayer')).children(':first-child').css({
'z-index': 21e8
});
if ((window.top.LiveRailParameters.BG.length > 2) || (window.top.LiveRailParameters.COMP == 0)) jQuery("#corner-ad-excite, #corner-ad-excite-2, #corner-ad-excite-3, #corner-ad-excite-4").remove();
jQuery(targetDocument.getElementById('container-ad-excite')).animate(displayed, 900, 'linear');
}
function closeCountdown() {
closeCountdown.intv = setInterval(function () {
var ctr = jQuery(targetDocument.getElementById('ctr')),
sec = parseInt(ctr.text()) - 1;
if (sec <= 0) { // *** show close buton
jQuery(targetDocument.getElementById('close-corner-ad')).css({
'width': 17,
'height': 17,
'background-position': '0 0',
'background-color': 'transparent',
'padding': 0,
'cursor': 'pointer'
}).css(cornerAdjust).html('').click(function () {
LiveRailObject.stopAd();
});
clearInterval(closeCountdown.intv);
return;
} else ctr.text(sec);
if (sec == 1) jQuery(targetDocument.getElementById('pl')).remove(); // *** De-pluralize 'seconds' if only 1 remaining.
}, 1000);
}
function unloadCornerAd() {
var container = targetDocument.getElementById('container-ad-excite');
jQuery(targetDocument.getElementById('close-corner-ad')).html('').css({
'display': 'none'
});
jQuery(targetDocument.getElementById('video-creative')).css({
'border-width': '0px 0px 0px 0px',
'border-style': 'none',
'border-color': 'transparent',
'background-color': 'transparent',
'bottom': -450
});
jQuery(container).css({
'display': 'none'
});
window.setTimeout(function () {
try {
jQuery(container).remove();
jQuery(loaderElement).remove();
} catch (e) {}
}, 2000);
}
function loadLiveRail(onload) {
var onFrameLoad;
loaderElement = targetDocument.createElement('iframe');
loaderElement.style.display = 'none';
onFrameLoad = function () {
var LiveRailAPI, onApiLoad, i, vpaidFrameDocument, vpaidFrameWindow;
try {
vpaidFrameWindow = loaderElement.contentWindow;
vpaidFrameDocument = vpaidFrameWindow.document;
} catch (e) {
vpaidFrameDocument = loaderElement.document;
vpaidFrameWindow = vpaidFrameDocument.parentWindow;
}
try {
LiveRailAPI = vpaidFrameDocument.createElement('script');
LiveRailAPI.src = 'http://cdn-static.liverail.com/js/LiveRail.AdManager-1.0.js';
onApiLoad = function () {
if (typeof vpaidFrameWindow.getVPAIDAd === 'function') {
LiveRailObject = vpaidFrameWindow.getVPAIDAd();
if (typeof onload === 'function') {
onload();
}
}
};
if (LiveRailAPI.readyState) {
LiveRailAPI.onreadystatechange = function () {
if (this.readyState === 'loaded' || this.readyState === 'complete') {
onApiLoad();
}
};
} else {
LiveRailAPI.onload = function () {
onApiLoad();
};
}
vpaidFrameDocument.body.appendChild(LiveRailAPI);
} catch (error) {}
};
loaderElement.onload = function () {
onFrameLoad();
}
if (typeof loaderElement.onload !== 'function') {
loaderElement.onreadystatechange = function () {
if (this.readyState === 'loaded' || this.readyState === 'complete') {
onFrameLoad();
}
};
}
targetDocument.body.appendChild(loaderElement);
}
// *** Include required Javascript before doing anything.
var jqueryScript = "http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js";
$$$$ = window.$;
if (window.jQuery && window.jQuery.fn.jquery) {
if (parseFloat(jQuery.fn.jquery) < 1.4) inclJS(jqueryScript);
} else {
inclJS(jqueryScript);
}
var pollInt = setInterval(pollJS, 200);
}else{
if (localStorage){
localStorage.setItem('Q1-Date', q1Date);
localStorage.setItem('Q1-impressionCount',impressionCount);
}else{
setCookie("Q1-Date", q1Date);
setCookie('q1impressionCount',impressionCount);
}
}
})();