
var ARMLibrary = function()
{
function AdObject()	{}
AdObject.ClearTimerBasedEvents = function()
{
if (window.beginAdHandler)
{
window.clearInterval(beginAdHandler);
beginAdHandler = null;
}
}	
AdObject.ClearWindowEvents = function()
{
ARMLibrary.BrowserEvent.detachScrollEvents();
ARMRedirLib.Dom.RemoveEvent(window, 'error', handleError);
ARMRedirLib.Dom.RemoveEvent(window, 'unload', a4eunload);
ARMLibrary.BrowserEvent.detachResizeEvents();
ARMRedirLib.Dom.RemoveEvent(window, 'load', igniteAtlasRM);
}
AdObject.ClearGlobals = function()
{
USER_CLICK_CLOSE = undefined;
innerDebugMode = undefined;
AtlasPaTTestTab = undefined;
toplayer_debug_mode = undefined;
FLASH_EXTENSION = undefined;
ARM_TestMode = undefined;
ALTERNATE_MOVIE_NAME = undefined;
ARM_rtc = undefined;
}
AdObject.HandleFlashLoad = function(destObj)
{
sendDebugCall("adLoaded=1", "", "");
if ((innerDebugMode) && (AtlasPaTTestTab) && (!ARMRedirLib.ClientCapabilities.checkScreenResolution(destObj)))
{
if (!notifiedTrackingWindow)
sendDebugCall("screenresolution=noplay", "", "");
}
else
{
if (__AtlasRichMedia__.getModule("pageLoadDetector_a1").AtlasPageLoaded)
{
destObj.politeDownload = false;
}
if ( (innerDebugMode && (!AtlasPaTTestTab)) || ((!destObj.adEnd) && (!destObj.politeDownload) && (!destObj.paramonload)) )
{
AdRenderer.handleCacheSwfLoaded(destObj);
}
}
}
AdObject.updateParams = function(a4eObject, phaseID)
{
a4eObject.Place = RELATIVE;
a4eObject.Size = RELATIVE;
a4eObject.Left = 0;
a4eObject.Top = 0;
a4eObject.Height = 100;
a4eObject.Width = 100;
var phaseLocation = a4eObject.locationInfo[phaseID.toLowerCase()];
a4eObject.bOverlayAlternate = (phaseLocation.altoverlay == 1);
if ((phaseLocation.location_method > RELATIVE) &
(phaseLocation.location_method != NOT_DEFINED) &
(!(isNaN(phaseLocation.location_method))))
{
a4eObject.Place = phaseLocation.location_method;
}
if ((phaseLocation.size_method > RELATIVE) &
(phaseLocation.size_method != NOT_DEFINED) &
(!(isNaN(phaseLocation.size_method))))
{
a4eObject.Size = phaseLocation.size_method;
}
if ((phaseLocation.left != NOT_DEFINED) &
(!(isNaN(phaseLocation.left))))
{
a4eObject.Left = phaseLocation.left;
}
if ((phaseLocation.width > 0 ) &
(phaseLocation.width != NOT_DEFINED) &
(!(isNaN(phaseLocation.width))))
{
a4eObject.Width = phaseLocation.width;
}
if ((phaseLocation.top != NOT_DEFINED) &
(!(isNaN(phaseLocation.top))))
{
a4eObject.Top = phaseLocation.top;
}
if ((phaseLocation.height > 0 ) &
(phaseLocation.height != NOT_DEFINED) &
(!(isNaN(phaseLocation.height))))
{
a4eObject.Height = phaseLocation.height;
}
if ((phaseLocation.location_method == ABSOLUTE_RELATIVE) &
(phaseLocation.anchor != null) &
(phaseLocation.anchor != NOT_DEFINED))
{
a4eObject.m_Anchor = phaseLocation.anchor;
}
}
function ZindexPrivate()
{}
ZindexPrivate.ExpandZindex = 99999997;
ZindexPrivate.BannerZindex = 1150;
ZindexPrivate.change = function (destObj, newZindexValue)
{
if (destObj.nodes.positioningNode)
{
destObj.nodes.positioningNode.style.zIndex = (newZindexValue+1);
}
var Outterorange = ARMRedirLib.Dom.GetObj(destObj.SpanId);
if (Outterorange)
{
Outterorange.style.zIndex = (newZindexValue+1);
}
var orange = document.getElementById(destObj.SwfId);
if (orange)
{
orange.style.zIndex = (newZindexValue+2);
}	
}
ZindexPrivate.getBannerPhaseZindex = function(destObj)
{
var bannerZindex;
if (typeof(destObj.bannerZindex) == "undefined")
bannerZindex = ZindexPrivate.BannerZindex;
else
bannerZindex = destObj.bannerZindex;
if (document.domain.indexOf("aol.com") != -1 )
bannerZindex = 50;
else if (document.domain.indexOf("vh1.com") != -1 )
bannerZindex = 2050;
else if (document.domain.indexOf("winespectator.com") != -1 )
bannerZindex = 950;
else if (document.domain.indexOf("myspace.com") != -1 )
bannerZindex = 10001;
else if (document.domain.indexOf("forbes.com") != -1 )
bannerZindex = 0;
else if (document.domain.indexOf("thegolfchannel.com") != -1 )
bannerZindex = 50; 
else if (document.domain.indexOf("cnnmoney.com") != -1 )
bannerZindex = 50; 
return bannerZindex; 
}
function Zindex()
{}
Zindex.SetExpandZindex = function(destObj)
{
var expandZindex;
if (typeof(destObj.expandZindex) == "undefined")
expandZindex = ZindexPrivate.ExpandZindex;
else
expandZindex = destObj.expandZindex;
ZindexPrivate.change(destObj, expandZindex);
}
Zindex.SetBannerZindex = function(destObj)
{
var bannerZindex = ZindexPrivate.getBannerPhaseZindex(destObj);
ZindexPrivate.change(destObj, bannerZindex);
}
Zindex.SetDefaultZindex = function(paid, bannerZindex, expandZindex)
{
for (var index = 0; index < a4eAdsArray.length; index++)
{
if (a4eAdsArray[index].paid.toLowerCase() == paid.toLowerCase())
{
a4eAdsArray[index].bannerZindex = parseInt(bannerZindex);
a4eAdsArray[index].expandZindex = parseInt(expandZindex);
break;
}
}
}
function SurveyVendor()
{}
SurveyVendor.Call = function(destObj, A4EAdPhase)
{
A4EAdPhase = Phase.Convert(A4EAdPhase);
var objectPhaseSurveyVendorTag = destObj.surveyVendorTag[A4EAdPhase];
var bSurveyVendorTagCalled = destObj.surveyVendorTagCalled[A4EAdPhase];
if ((!bSurveyVendorTagCalled) && (objectPhaseSurveyVendorTag != ''))
{
objectPhaseSurveyVendorTag = SurveyVendorPrivate.replaceAliasesWithParams(objectPhaseSurveyVendorTag, destObj.atlasObject);
var oProcessedTag = SurveyVendorPrivate.getScriptSourceOrContents(objectPhaseSurveyVendorTag);
var processedTagText = new String(oProcessedTag[0]);
var sContentType = oProcessedTag[1];
if (!innerDebugMode)
{
var targetNode = document.getElementsByTagName("head")[0];
var scriptId = "arm_processedTagText_" + destObj.paid;
if (sContentType.toLowerCase() == "src")
{
ARMRedirLib.Dom.AddExternalScript(targetNode, processedTagText, scriptId);
}
else if (sContentType.toLowerCase() == "text")
{
ARMRedirLib.Dom.AddInlineScript(targetNode, processedTagText, scriptId);
}
}
sendDebugCall ("dl=1", processedTagText, "");
destObj.surveyVendorTagCalled[A4EAdPhase] = true;
}
}
SurveyVendor.Reset = function(destObj)
{
var phases = Phase.GetSupportedPhaseNames();
for(var i = 0; i < phases.length; i++)
destObj.surveyVendorTagCalled[phases[i]] = false;
}
function SurveyVendorPrivate() {}
SurveyVendorPrivate.getScriptSourceOrContents = function(sScriptString)
{
var re = new RegExp("<script\\b[^>]*src\\s*=\\s*([\"'])(.*?)\\1[^>]*>.*</\script>","i");
var matchArray = sScriptString.match(re);
if (matchArray != null)
return new Array(matchArray[2], "src");
re = new RegExp("<script\\b.*>(.*?)</\script>","i");
matchArray = sScriptString.match(re);
if (matchArray != null)
return new Array(matchArray[1], "text");
return new Array(sScriptString, "text");
}
SurveyVendorPrivate.replaceAliasesWithParams = function(sTextToReplace, atlasObject)
{
var returnString = sTextToReplace;
returnString = returnString.replace(/\%site_alias\%/g, atlasObject.site_alias);
returnString = returnString.replace(/\%ad_id\%/g, atlasObject.ad_id);
return returnString;
}
function Phase() {}
Phase.Convert = function(label)
{
var id;
if (label == 'banner')
{
id = 'reminder';
}
else if (label == 'expand' || label == 'maininteractive')
{
id = 'main';
}
else if (label == 'startmovie')
{
id = 'teaser';
}
else
{
id = label;
}
return (id);
}
Phase.GetSupportedPhaseNames = function()
{
return new Array("teaser", "reminder", "main");
}
function FlashObject(element)
{
if(!element || typeof(element) == "string") throw new Error('ARMLibrary.FlashObject : must pass in an HTML element');
this.style = null;
this.name = "";
this.m_oFlashObject = FlashObjectUtil.getActiveElement(element);
if(this.m_oFlashObject) {
if(this.m_oFlashObject.name != "")
{
this.name = this.m_oFlashObject.name;
}
else if(this.m_oFlashObject.id != "")
{
this.name = this.m_oFlashObject.id;
}
this.style = this.m_oFlashObject.style;
}
}
FlashObject.prototype.isReady = function() {
return (this.m_oFlashObject != null);
}
FlashObject.prototype.GetMovieSrc = function()
{
if(this.m_oFlashObject.movie)
{
return this.m_oFlashObject.movie;
}
else if(this.m_oFlashObject.attributes['src'])
{
return this.m_oFlashObject.attributes['src'].value;
}
else if(this.m_oFlashObject.attributes['data'])
{
return this.m_oFlashObject.attributes['data'].value;
}
return null;
}
FlashObject.prototype.SetMovieSrc = function(strMovieSrc)
{
var client = __AtlasRichMedia__.getModule('client_a1');
if(this.m_oFlashObject.movie)
{
this.m_oFlashObject.movie = strMovieSrc;
}
else if(this.m_oFlashObject.attributes['src'])
{
this.m_oFlashObject.attributes['src'].value = strMovieSrc;
}
else if(this.m_oFlashObject.attributes['data'])
{
this.m_oFlashObject.attributes['data'].value = strMovieSrc;
}
if(client.userAgent.isFirefox()) {
var parentNode = this.m_oFlashObject.parentNode;
var sibling = this.m_oFlashObject.nextSibling;
parentNode.insertBefore(this.m_oFlashObject,sibling);
this.m_oFlashObject = null;
}
}
FlashObject.prototype.GetObjectReference = function()
{
with(this)
{
return m_oFlashObject;
}
}
FlashObject.prototype.PercentLoaded = function()
{
try
{
return this.m_oFlashObject.PercentLoaded();
}
catch(e)
{
return 0;
}
}
FlashObject.prototype.IsPlaying = function()
{
with(this)
{
if(typeof(m_oFlashObject.IsPlaying) != 'undefined')
{
return m_oFlashObject.IsPlaying();
}
return null;
}
}
FlashObject.prototype.Stop = function()
{
with(this)
{
m_oFlashObject.StopPlay();
}
}
FlashObject.prototype.Play = function()
{
with(this)
{
if (typeof (m_oFlashObject.Play) == "function")
{
m_oFlashObject.Play();
}	
}
}
FlashObject.prototype.Show = function(bShow)
{
with(this)
{
var sVisibility = "visible";
if (!bShow)
{
sVisibility = "hidden";
}
style.visibility = sVisibility;
}
}
FlashObject.prototype.SetVariable = function(sVar, sValue)
{
with(this)
{
m_oFlashObject.SetVariable(sVar, sValue);
}
}
function Position(){}
Position.computeRectWidth = function (localWidth, localSize)
{
var widthVar;
if (localSize == SIZE_METHOD_RELATIVE)
{
widthVar = Math.round((eval(localWidth) * __AtlasRichMedia__.getModule('client_a1').getWidth()) / 100);
return widthVar;
}
if (localSize == SIZE_METHOD_ABSOLUTE)
{
return localWidth;
}
}
Position.computeRectHeight = function(localHeight, localSize)
{
var heightVal;
if (localSize == SIZE_METHOD_RELATIVE)
{
heightVal = Math.round((eval(localHeight) * __AtlasRichMedia__.getModule('client_a1').getHeight()) / 100);
return heightVal;
}
if (localSize == SIZE_METHOD_ABSOLUTE)
{
return localHeight;
}
}
Position.computeRectLeft = function(localLeft, localWidth, localSize, localPlace, localAnchor, a4eObject)
{
var a4eParent;
if ( a4eObject.nodes.clippingNode )
a4eParent = a4eObject.nodes.clippingNode.offsetParent;
else
a4eParent = ARMRedirLib.Dom.GetObj(a4eObject.SpanId).offsetParent;
var a4eParentOffset = ARMRedirLib.GetElementPosition(a4eParent);
var getRidOfOffset = a4eParentOffset.x;
var leftVal;
if (localPlace == LOCATION_METHOD_RELATIVE)
{
leftVal = __AtlasRichMedia__.getModule('client_a1').getScrollLeft() + Math.round((eval(localLeft) * __AtlasRichMedia__.getModule('client_a1').getWidth()) / 100);
if (innerDebugMode)
{
if (disregard_scroll_on_ad_not_scrollable)
{
leftVal = Math.round((eval(localLeft) * __AtlasRichMedia__.getModule('client_a1').getWidth()) / 100);
}
}
return leftVal - getRidOfOffset;
}
if (localPlace == LOCATION_METHOD_ABSOLUTE)
{
if (innerDebugMode)
{
if (disregard_scroll_on_ad_not_scrollable)
{
return localLeft + getRidOfOffset;
}
}
return localLeft + __AtlasRichMedia__.getModule('client_a1').getScrollLeft() - getRidOfOffset;
}
if (localPlace == LOCATION_METHOD_ABSOLUTE_RELATIVE)
{
switch (localAnchor)
{
case ANCHOR_TOP_LEFT_CORNER:
leftVal = localLeft;
break;
case ANCHOR_TOP_RIGHT_CORNER:
leftVal = eval(localLeft) + __AtlasRichMedia__.getModule('client_a1').getWidth() - ARMLibrary.Position.computeRectWidth(localWidth, localSize);
break;
case ANCHOR_BOTTOM_LEFT_CORNER:
leftVal = localLeft;
break;
case ANCHOR_BOTTOM_RIGHT_CORNER:
leftVal = eval(localLeft) + __AtlasRichMedia__.getModule('client_a1').getWidth() - ARMLibrary.Position.computeRectWidth(localWidth, localSize);
break;
case ANCHOR_CENTER_SCREEN:
leftVal = eval(localLeft) + (__AtlasRichMedia__.getModule('client_a1').getWidth() / 2) - (ARMLibrary.Position.computeRectWidth(localWidth, localSize) / 2);
break;
case ANCHOR_ALTERNATE:
localAnchor = new String("orange_alternate_" + a4eObject.paid);
default:
var obj = ARMRedirLib.Dom.GetObj(localAnchor);
leftVal = computeAnchorElementPosition(obj, localLeft, null, localWidth, null, localSize, a4eObject).x;
}
return leftVal + __AtlasRichMedia__.getModule('client_a1').getScrollLeft()- getRidOfOffset;
}
}
Position.computeRectTop = function(localTop, localHeight, localSize, localPlace, localAnchor, a4eObject)
{
var a4eParent;
if ( a4eObject.nodes.clippingNode )
a4eParent = a4eObject.nodes.clippingNode.offsetParent;
else
a4eParent = ARMRedirLib.Dom.GetObj(a4eObject.SpanId).offsetParent;
var a4eParentOffset = ARMRedirLib.GetElementPosition(a4eParent);
var getRidOfOffset = a4eParentOffset.y;
var topVal;
if (localPlace == LOCATION_METHOD_RELATIVE)
{
topVal = __AtlasRichMedia__.getModule('client_a1').getScrollTop() + Math.round((localTop * __AtlasRichMedia__.getModule('client_a1').getHeight()) / 100);
if (innerDebugMode)
{
if (disregard_scroll_on_ad_not_scrollable)
{
topVal = Math.round((localTop * __AtlasRichMedia__.getModule('client_a1').getHeight()) / 100);
}
}
return topVal- getRidOfOffset;
}
if (localPlace == LOCATION_METHOD_ABSOLUTE)
{
if (innerDebugMode)
{
if (disregard_scroll_on_ad_not_scrollable)
{
return localTop - getRidOfOffset;
}
}
return localTop + __AtlasRichMedia__.getModule('client_a1').getScrollTop() - getRidOfOffset;
}
if (localPlace == LOCATION_METHOD_ABSOLUTE_RELATIVE)
{
switch (localAnchor)
{
case ANCHOR_TOP_LEFT_CORNER:
topVal = localTop;
break;
case ANCHOR_TOP_RIGHT_CORNER:
topVal = localTop;
break;
case ANCHOR_BOTTOM_LEFT_CORNER:
topVal = eval(localTop) + __AtlasRichMedia__.getModule('client_a1').getHeight() - ARMLibrary.Position.computeRectHeight(localHeight, localSize);
break;
case ANCHOR_BOTTOM_RIGHT_CORNER:
topVal = eval(localTop) + __AtlasRichMedia__.getModule('client_a1').getHeight() - ARMLibrary.Position.computeRectHeight(localHeight, localSize);
break;
case ANCHOR_CENTER_SCREEN:
topVal = eval(localTop) + (__AtlasRichMedia__.getModule('client_a1').getHeight() / 2) - (ARMLibrary.Position.computeRectHeight(localHeight, localSize) / 2);
break;
case ANCHOR_ALTERNATE:
localAnchor = new String("orange_alternate_" + a4eObject.paid);
default:
var obj = ARMRedirLib.Dom.GetObj(localAnchor);
topVal = computeAnchorElementPosition(obj, null, localTop, null, localHeight, localSize, a4eObject).y;
}
return topVal + __AtlasRichMedia__.getModule('client_a1').getScrollTop() - getRidOfOffset;
}
};
Position.checkClipSpanToAlternate = function(a4eObject, oAlternateObj, bustedIframe)
{
var result = false;
if(a4eObject.bOverlayAlternate && a4eObject.m_Anchor == ANCHOR_ALTERNATE)
{
if(oAlternateObj || bustedIframe)
{
result = true;
}
}
return result;
}
Position.updateMockAlternateImage = function(a4eObject)
{
var sourceIframe = a4eObject.bustedIframe;
if (sourceIframe != null)
{
var sourceIframePosition = ARMRedirLib.GetElementPosition(sourceIframe);
var mockAlternateImage = document.getElementById('orange_alternate_' + a4eObject.paid);
mockAlternateImage.style.top = parseInt(sourceIframePosition.y) + parseInt(a4eObject.adParms.adObjectAlt.tplParams.altImageOffsetTop) + 'px' ;
mockAlternateImage.style.left = parseInt(sourceIframePosition.x) + parseInt(a4eObject.adParms.adObjectAlt.tplParams.altImageOffsetLeft) + 'px';
}
}
Position.updateObjectStyle = function(oDestObj, oDataObj)
{
oDestObj.style.top = "";
oDestObj.style.left = "";
oDestObj.style.height = "";
oDestObj.style.width = "";
oDestObj.style.top = oDataObj.top + "px";
oDestObj.style.left = oDataObj.left + "px";
oDestObj.style.height = oDataObj.height + "px";
oDestObj.style.width = oDataObj.width + "px";
}
Position.showAndHidePageObjects = function(destObj)
{
var sPhase = destObj.adCurrentPhase;
if (destObj.adEnd)
{
return;
}
sPhase = ARMLibrary.Phase.Convert(sPhase);
if (destObj.paramhideselect[sPhase] == true)
{
ARMLibrary.Position.manageVisibility(false, "visible" , destObj, 'select');
ARMLibrary.Position.manageVisibility(false, "hidden" , destObj, 'select');
ARMLibrary.Position.manageVisibility(false, "visible" , destObj, 'applet');
ARMLibrary.Position.manageVisibility(false, "hidden" , destObj, 'applet');
}
else
{
ARMLibrary.Position.manageVisibility(true, "visible" , destObj, 'select');
ARMLibrary.Position.manageVisibility(true, "visible" , destObj, 'applet');
}
if (destObj.paramnoframes[sPhase] == true)
{
ARMLibrary.Position.manageVisibility(false, "visible" , destObj, 'iframe');
ARMLibrary.Position.manageVisibility(false, "hidden",destObj,'iframe');
}
else
{
ARMLibrary.Position.manageVisibility(true, "visible" , destObj, 'iframe');
}
if (destObj.bustedIframe != null) 
{
if(destObj.mouseIn && ARMLibrary.Position.compareLocations(destObj.bustedIframe,destObj))
{
AdDisplayManager.hideBustedIframe(destObj);
}
else
{
AdDisplayManager.showBustedIframe(destObj);
}
}	
if (sPhase == "main")
{
AdDisplayManager.showTransparentIframe(destObj);
}
else
{
AdDisplayManager.hideTransparentIframe(destObj);
}
}
Position.enableHTMLbelowWithDelay = function(destObj)
{
var oLayerObj = ARMRedirLib.Dom.GetObj(destObj.SpanId);
if (oLayerObj)
{
oLayerObj.style.visibility = 'visible';
window.setTimeout(function () { ARMLibrary.Position.enableHTMLbelow(destObj); },2500);
}
}
Position.enableHTMLbelow = function(destObj)
{
var elemIndex = ARMLibrary.Utility.getAdIndexByFlashName(destObj.SwfId);
if (window.a4eAdsArray && a4eAdsArray[elemIndex])
{
if (a4eAdsArray[elemIndex].a4e_ver > 5)
{
var oLayer = ARMRedirLib.Dom.GetObj(destObj.SpanId);
if (oLayer)
oLayer.style.visibility = 'hidden';
}
}
}
Position.manageVisibility = function(showAll, workMode, a4eObject, sHtmlTag)
{
var oHiddenElementsList = null;
sHtmlTag = sHtmlTag.toLowerCase();
oHiddenElementsList = a4eObject.hiddenElementsList[sHtmlTag] ;
if (workMode == "hidden")
{
var oElementsToHide = document.getElementsByTagName(sHtmlTag);
ARMLibrary.Position.hideElements(oElementsToHide, a4eObject,
oHiddenElementsList);
a4eObject.hiddenElementsList[sHtmlTag] = oHiddenElementsList;
}
else
{
ARMLibrary.Position.showElements(showAll,oHiddenElementsList, a4eObject);
}
}
Position.hideElements = function(oElementsToHide, a4eObject,oHiddenElementsList)
{
for (var i = 0; i < oElementsToHide.length; i++)
{
if(ARMLibrary.Position.ElementIsVisibleAndOverlapsAd(oElementsToHide[i], a4eObject) && (oElementsToHide[i] != a4eObject.bustedIframe))
{
oElementsToHide[i].style.visibility = 'hidden';
oHiddenElementsList[oHiddenElementsList.length] = oElementsToHide[i];
}
}
}
Position.ElementIsVisibleAndOverlapsAd = function(element, adObject)
{
return (element.style.visibility != "hidden" && ARMLibrary.Position.compareLocations(element, adObject));
} 
Position.showElements = function(showAll,oHiddenElementsList, a4eObject)
{
for (var i = 0; i < oHiddenElementsList.length; i++)
{
if ((!ARMLibrary.Position.compareLocations(oHiddenElementsList[i], a4eObject)) || (showAll && !(oHiddenElementsList[i] == a4eObject.bustedIframe && a4eObject.mouseIn)))
{
oHiddenElementsList[i].style.visibility = 'visible';
oHiddenElementsList.splice(i,1);
--i;
}
}
}
Position.compareLocations = function (oHtmlObj, a4eObject)
{
var oHtmlObjStart = { x:0, y:0 };
var oHtmlObjEnd = { x:0, y:0 };
var a4eObjectStart = { x:0, y:0 };
var a4eObjectEnd = { x:0, y:0 };
var compareX = true;
var compareY = true;
var htmlObjPosition = ARMRedirLib.GetElementPosition(oHtmlObj);
oHtmlObjStart.x = htmlObjPosition.x;
oHtmlObjStart.y = htmlObjPosition.y;
oHtmlObjEnd.x = oHtmlObjStart.x + parseInt(oHtmlObj.offsetWidth);
oHtmlObjEnd.y = oHtmlObjStart.y + parseInt(oHtmlObj.offsetHeight);
var objectPosition = ARMRedirLib.GetElementPosition(a4eObject.nodes.getRmObjectNode());
a4eObjectStart.x = objectPosition.x;
a4eObjectStart.y = objectPosition.y;
a4eObjectEnd.x = objectPosition.x + a4eObject.computedWidth;
a4eObjectEnd.y = objectPosition.y + a4eObject.computedHeight;
if (a4eObjectStart.y > oHtmlObjEnd.y)
{
compareY = false;
}
if (a4eObjectEnd.y < oHtmlObjStart.y)
{
compareY = false;
}
if (a4eObjectStart.x > oHtmlObjEnd.x)
{
compareX = false;
}
if (a4eObjectEnd.x < oHtmlObjStart.x)
{
compareX = false;
}
return compareX && compareY;
}
Const = {}
Const.REPORT_FLASH = 'flash';
Const.MAX_NUM_EXITS = 50;
Const.MAX_TRACK_PER_EVENT = 50;
Const.EventBrandExposure = "d";
Const.EventMainDuration = "r";
Const.EventTimeToMain = "s";
Const.EventTimeToInteract = "t";
Const.EventInitialRollover = "u";
Const.EventRolloverDuration = "v";
function getValueArgStr(origString, paramName)
{
var tempVar = origString.indexOf(paramName);
var startIndex = origString.indexOf("=",tempVar);
if (startIndex == -1)
{
return ("");
}
var endIndex = origString.indexOf("&",startIndex);
if (endIndex == -1)
{
return (origString.substring(startIndex+1));
}
return (origString.substring(startIndex+1,endIndex));
}
FlashApi = {}
FlashApi.FSCommand = function(command, args, movieId)
{
if (command == "alert")
{
alert(args);
return;
}
var objIndex = ARMLibrary.Utility.getAdIndexByMovieId(movieId);
var objectToWorkOn = a4eAdsArray[objIndex];
if(!objectToWorkOn)
return;
var nextArg = args;
try
{
var mainValue = getValueArgStr(nextArg, "mainValue");
}
catch(e)
{
}
var additionalInfo = getValueArgStr(nextArg, "additionalInfo");
var startPointBlockedFlag = additionalInfo.indexOf("AtlasBlocked");
if (startPointBlockedFlag != -1)
{
if (startPointBlockedFlag == 0)
{
additionalInfo = "";
}
else
{
additionalInfo = additionalInfo.substring(0,startPointBlockedFlag);
}
}
var defaultURL = getValueArgStr(nextArg, "default");
command = command.toLowerCase();
nextArg = nextArg.toLowerCase();
if (!(objectToWorkOn.adEnd))
{
switch (command)
{
case 'exit':
AtlasEvent.exitActionHandler(objectToWorkOn, mainValue, additionalInfo, defaultURL, startPointBlockedFlag);
AtlasEvent.HandleEvent(objectToWorkOn);
break;
case 'event':
AtlasEvent.eventActionHandler(objectToWorkOn, mainValue, additionalInfo);
AtlasEvent.HandleEvent(objectToWorkOn);
break;
case 'initialization':
switch(nextArg)
{
case 'flash_loaded':
objectToWorkOn.bFlashFullyLoaded = true;
a4eloadObject(objectToWorkOn);
break;
}
break;
case 'framelabel':
if (AdRenderer.closeOnInvalidAnchor(objectToWorkOn, nextArg))
{
return;
}
var lastPhase = objectToWorkOn.adCurrentPhase;
objectToWorkOn.adCurrentPhase = nextArg;
switch(nextArg)
{
case 'teaser':
case 'startmovie':
changePhase(nextArg, ARMLibrary.Phase.Convert(nextArg), objectToWorkOn, Const.REPORT_FLASH);
AtlasEvent.HandleEndOfMainPhase(objectToWorkOn);
AtlasEvent.a4eCallURL(objectToWorkOn);
ARMLibrary.SurveyVendor.Call(objectToWorkOn, nextArg);
break;
case 'banner':
if (!innerDebugMode)
{
ARMLibrary.Zindex.SetBannerZindex(objectToWorkOn);
}
case 'reminder':
changePhase(nextArg, ARMLibrary.Phase.Convert(nextArg), objectToWorkOn, Const.REPORT_FLASH);
AtlasEvent.HandleEndOfMainPhase(objectToWorkOn);
AtlasEvent.a4eCallURL(objectToWorkOn);
ARMLibrary.SurveyVendor.Call(objectToWorkOn,nextArg);
break;
case 'expand':
ARMLibrary.Zindex.SetExpandZindex(objectToWorkOn);
case 'main':
case 'maininteractive':
objectToWorkOn.numofmain=objectToWorkOn.numofmain+1;
if(ARMLibrary.Phase.Convert(lastPhase) != 'main')
{
AtlasEvent.HandleStartOfMainPhase(objectToWorkOn);
}
changePhase(nextArg, ARMLibrary.Phase.Convert(nextArg), objectToWorkOn, Const.REPORT_FLASH);
ARMLibrary.SurveyVendor.Call(objectToWorkOn,nextArg);
break;
case 'closead':
closeA4Ead(objectToWorkOn);
AtlasEvent.HandleEndOfMainPhase(objectToWorkOn);
AtlasEvent.HandleEndOfAd(objectToWorkOn);
break;
}
break;
case 'a4eplay':
case 'a4estart':
case 'a4eload':
objectToWorkOn.paramonload = false;
break;
case 'loadmovie':
sendDebugCall ("movie=" + mainValue, additionalInfo, "");
break;
case 'html_loaded':
if (innerDebugMode)
{
setHTML_LOADED(objIndex);
}
break;
case 'ebshake':
case 'a4eshake':
case 'shake':
case 'atlasshake':
var tShake = 1;
try
{
tShake = parseInt(nextArg);
}
catch(e)
{
}
a4eshakefunc(10*tShake);
break;
case 'replay':
eval("window.document." + objectToWorkOn.SwfId + ".Rewind()");
objectToWorkOn.a4eexit = false;
a4eloadObject(objectToWorkOn);
break;
}
}
}

function EventObject(
oEvent 
)
{
if (typeof(oEvent) != "undefined")
{
this.m_oEvent = oEvent;
}
else
{
this.m_oEvent = window.event;
}
EventObject.prototype.getSourceElement = function()
{
with(this)
{
if (m_oEvent.srcElement)
{
return m_oEvent.srcElement;
}
else if (m_oEvent.target)
{
return m_oEvent.target;
}
else
{
return null;
}
}
}
}
AtlasEvent = {}
AtlasEvent.a4eCallURL = function(obj)
{
if ((obj.onViewOccurred) || (obj.blContent[obj.blTreeLocation][ALTERNATE_MOVIE_NAME] != ''))
{
return true;
}
obj.onViewOccurred = true;
ARMLibrary.AtlasEvent.CallReportingUrl(obj, AtlasFormatURL(obj.atlasObject.atlas_view_url));
try
{
if ((obj.atlasObject.pub_view_url != "") && (obj.atlasObject.pub_view_url != null))
{
ARMLibrary.AtlasEvent.CallReportingUrl(obj, AtlasFormatURL(obj.atlasObject.pub_view_url));
}
}
catch(e)
{
}
}
AtlasEvent.CallReportingUrl = function(obj, url)
{ 
if (window.testAtlasEvent)
testAtlasEvent(url);
if (obj.rptImg == null)
{
obj.rptImg = new Array();
}
var img = new Image();
img.src = url;
img.alt ='';
obj.rptImg[obj.rptImg.length] = img;
}
AtlasEvent.CurrentDurationInSeconds = function(startTime)
{
if (startTime == 0)
{
return 0;
}
var currentTime = new Date();
return Math.round((currentTime - startTime) / 1000);
}
AtlasEvent.HandleEvent = function(obj)
{
if (!obj.exitOrEventOccurred)
{
AtlasEvent.EmitEvent(obj, Const.EventTimeToInteract, AtlasEvent.CurrentDurationInSeconds(obj.tViewTime));
obj.exitOrEventOccurred = true;
}
}
AtlasEvent.HandleStartOfMainPhase = function(obj)
{
obj.startTimeOfMainPhase = (new Date()).getTime();
if (1 == obj.numofmain)
{
AtlasEvent.EmitEvent(obj, Const.EventTimeToMain, AtlasEvent.CurrentDurationInSeconds(obj.tViewTime));
AtlasEvent.HandleEvent(obj);
}
}
AtlasEvent.HandleEndOfMainPhase = function(obj)
{
if (obj.startTimeOfMainPhase > 0)
{
AtlasEvent.EmitEvent(obj, Const.EventMainDuration, AtlasEvent.CurrentDurationInSeconds(obj.startTimeOfMainPhase));
obj.startTimeOfMainPhase = 0;
}
}
AtlasEvent.HandleEndOfAd = function(obj)
{
if (obj.BXDReported != true)
{
try
{
AtlasEvent.EmitEvent(obj, Const.EventBrandExposure, AtlasEvent.CurrentDurationInSeconds(obj.tViewTime));
pause(pausableTime);
obj.BXDReported = true;
}
catch(e)
{
obj.BXDReported = false;
}
}
}
AtlasEvent.HandleStartOfAd = function(obj)
{
obj.tViewTime = (new Date()).getTime();
}
AtlasEvent.HandleStartOfRollOver = function(obj)
{
if (obj.bRolloverEventsEnabled)
{
if (!obj.tRollOverTime)
{
AtlasEvent.EmitEvent(obj, Const.EventInitialRollover, AtlasEvent.CurrentDurationInSeconds(obj.tViewTime));
}
obj.tRollOverTime = (new Date()).getTime();
}
}
AtlasEvent.HandleEndOfRollOver = function(obj)
{
if (obj.tRollOverTime)
{
AtlasEvent.EmitEvent(obj, Const.EventRolloverDuration, AtlasEvent.CurrentDurationInSeconds(obj.tRollOverTime));
}
}
AtlasEvent.EmitEvent = function(obj, evt, duration)
{
if (innerDebugMode)
{
if (evt != Const.EventBrandExposure)
{
sendDebugCall(evt + "=", duration, "");
}
}
else
{
var url = obj.atlasObject.click_url_t + evt + ";ea." + duration + obj.atlasObject.report_suffix;
ARMLibrary.AtlasEvent.CallReportingUrl(obj, url);
}
}
AtlasEvent.eventActionHandler = function(destObj, mainValue, additionalInfo, startOfPeriod)
{
if( undefined === startOfPeriod )
{
startOfPeriod = destObj.tViewTime;
}
var eventCounterName = "e" + mainValue;
if (destObj.eventCounter[eventCounterName] == undefined)
{
destObj.eventCounter[eventCounterName] = 1;
}
else
{
destObj.eventCounter[eventCounterName]++;
}
var callURL;
if ((destObj.eventCounter[eventCounterName] <= Const.MAX_TRACK_PER_EVENT) || (innerDebugMode))
{
try
{
if ((destObj.atlasObject.event_url_t != null) &&
(new String(destObj.atlasObject.event_url_t) != ""))
{
callURL = new String(destObj.atlasObject.event_url_t +
mainValue + ";ea." +
AtlasEvent.CurrentDurationInSeconds(startOfPeriod) +
destObj.atlasObject.report_suffix);
}
if (innerDebugMode)
{
sendDebugCall ("event=" + mainValue, additionalInfo, "");
}
else
{
ARMLibrary.AtlasEvent.CallReportingUrl(destObj, callURL);
destObj.lastEventTimeStamp = (new Date()).getTime();
}
destObj.eventsCount++; 
}
catch (e)
{
}
}
}
AtlasEvent.exitActionHandler = function(destObj, mainValue, additionalInfo, defaultURL, blockedByPopUp)
{
if (blockedByPopUp == -1)
{
blockedByPopUp = "";
}
else
{
blockedByPopUp = "blocked=";
}
if ((destObj.clicksCount < Const.MAX_NUM_EXITS) || (innerDebugMode))
{
var callURL = defaultURL;
try
{
if ((destObj.atlasObject.click_url_t != "") && (destObj.atlasObject.click_url_t != null) && (new String(destObj.atlasObject.click_url_t) != ""))
{
callURL = new String(destObj.atlasObject.click_url_t + mainValue + destObj.atlasObject.report_suffix);
if (typeof(_objAdEvents) != 'undefined')
{
if (_objAdEvents != null)
{
callURL = new String(eval("_objAdEvents.exit"+mainValue));
}
}
if(window.testAtlasClickEvent)
testAtlasClickEvent(callURL);	
}
}
catch(e)
{
}
try
{
if ((additionalInfo == "") || (additionalInfo == "null") || (additionalInfo == null))
{
additionalInfo = "_blank";
}
if (innerDebugMode)
{
sendDebugCall ("exit=" + mainValue, defaultURL, blockedByPopUp);
}
else
{
if (additionalInfo == "_none")
{
ARMLibrary.AtlasEvent.CallReportingUrl(destObj, callURL);
}
else
{
window.open(callURL, additionalInfo);
}
}
destObj.clicksCount++;
}
catch(e)
{
}
try
{
if ((destObj.atlasObject.pub_click_url != "") && (destObj.atlasObject.pub_click_url != null) )
{
if (!innerDebugMode)
{
ARMLibrary.AtlasEvent.CallReportingUrl(destObj, AtlasFormatURL(destObj.atlasObject.pub_click_url));
}
}
}
catch(e)
{
}
ARMLibrary.AtlasEvent.HandleEndOfAd(destObj);
}
}

AtlasEvent.handleMouseEvent = function(oEvent, bMouseIn)
{
var oEventObj = new ARMLibrary.EventObject(oEvent);
var oFlash = new ARMLibrary.FlashObject(ARMRedirLib.Dom.GetObj(oEventObj.getSourceElement().name));
var elemIndex = ARMLibrary.Utility.getAdIndexByFlashName(oFlash.name);
var a4eObject = a4eAdsArray[elemIndex];
var bFlashLoaded = (oFlash.PercentLoaded() == 100) && a4eObject.bFlashFullyLoaded;
if (bMouseIn)
{ 
if(bFlashLoaded)
{
oFlash.SetVariable('isMouseOver', 'true');
}
ARMLibrary.AtlasEvent.HandleStartOfRollOver(a4eObject);
}
else
{
if(a4eObject.adEnd == false && bFlashLoaded)
{
oFlash.SetVariable('isMouseOver', 'false');
}
ARMLibrary.AtlasEvent.HandleEndOfRollOver(a4eObject);
}
return a4eObject;
}	
FlashObjectUtil = {};
FlashObjectUtil.SwfIsNotAtlasSwf = function(objElement)
{
return (!objElement.id || objElement.id.indexOf("orange") != 0);
}
FlashObjectUtil.GetWmode = function(objElement)
{
if(objElement.wmode)
{
return objElement.wmode.toLowerCase();
}
else if(objElement.attributes['wmode'])
{
var wMode = objElement.attributes['wmode'].value;
if ( (wMode.toLowerCase() == "transparent") || (wMode.toLowerCase() == "opaque") )
{
return wMode.toLowerCase();
}
else
{
return "window";
}
}
return "window";
}
FlashObjectUtil.ObjectIsSWF = function(object)
{
for (var j=0; j<object.childNodes.length; j++)
{
var param = object.childNodes[j];
if (param.nodeName.toLowerCase() == "param" && param['name'].toLowerCase() == 'movie' && param['value'].toLowerCase().indexOf(".swf") != -1)
{
return true;
}
}
return false;
}
FlashObjectUtil.getActiveElement = function(element) {
if(element.tagName == "OBJECT") {
if(FlashObjectUtil.elementHasFlashPlayerApi(element)) return element;
var embed = element.getElementsByTagName('embed')[0];
if(embed && FlashObjectUtil.elementHasFlashPlayerApi(embed)) return embed;
return null;
}
if(element.tagName == "EMBED") {
if(FlashObjectUtil.elementHasFlashPlayerApi(element)) return element;
return null;
}
return null;
}
FlashObjectUtil.elementHasFlashPlayerApi = function(element) {
try {
return FlashObjectUtil.elementHasFlashPlayerApi.doCheck(element);
} catch(e) {
return true;
};
}
FlashObjectUtil.elementHasFlashPlayerApi.doCheck = function(element) {
return (element.IsPlaying != undefined && element.PercentLoaded != undefined && element.StopPlay != undefined && element.Play != undefined && element.SetVariable != undefined);
}
FlashObjectUtil.setOverlappingSwfsToOpaque = function(atlasObject) {
var objects = new Array();
var objectsCollection = document.getElementsByTagName('object');
for (var i=0; i<objectsCollection.length; i++)
{
objects[objects.length] = objectsCollection[i];
}
for (var i = 0; i < objects.length; i++)
{
var object = objects[i];
var embed = null;	
for (var k=0; k<object.childNodes.length; k++) {
var node = object.childNodes[k];
if (node.nodeName.toLowerCase() == "embed")
{
embed = node;
}
} 

if ( FlashObjectUtil.ObjectIsSWF(object) && FlashObjectUtil.SwfIsNotAtlasSwf(object) && ( ARMLibrary.Position.compareLocations(object, atlasObject) || (embed && ARMLibrary.Position.compareLocations(embed, atlasObject) )))
{
var wmode = embed ? FlashObjectUtil.GetWmode(embed) : FlashObjectUtil.GetWmode(object);
if (wmode != "opaque" && wmode != "transparent")
{
if(object.outerHTML) {
object.wmode = "opaque";
var outerhtml = object.outerHTML;
var innerhtml = "";
for (var j=0; j<object.childNodes.length; j++) {
var param = object.childNodes[j];
if (param.nodeName == "PARAM"){
if(param.getAttribute('name').toLowerCase() != 'wmode') 
innerhtml += param.outerHTML;
}
}
innerhtml += '<param name="wmode" value="opaque" />';
object.outerHTML = outerhtml.split(">")[0] + ">" + innerhtml + " </object>";
} else {
var param = document.createElement('param');
param.setAttribute('name','wmode');
param.setAttribute('value','opaque');
object.appendChild(param);
object.wmode = "opaque";
var placeHolder = document.createElement('span');
object.parentNode.replaceChild(placeHolder,object);
placeHolder.parentNode.replaceChild(object,placeHolder);
}
}
if (embed) {
var wmode = embed.getAttribute('wmode');
if (!wmode || (wmode.toLowerCase() != "opaque" && wmode.toLowerCase() != "transparent"))
embed.setAttribute('wmode','opaque');
}
}
}
}

function BrowserEvent (){}
BrowserEvent.scrollA4EAd = function()
{

if (window.a4eAdsArray)
{
for (var i = 0; i < a4eAdsArray.length; i++)
{
if ((a4eAdsArray[i].playStarted==1) && (!(a4eAdsArray[i].adEnd)))
{
if (!a4eAdsArray[i].paramonscroll)
{
ARMLibrary.Position.enableHTMLbelowWithDelay(a4eAdsArray[i]);
if (!ARMLibrary.Position.modifyLocation(a4eAdsArray[i]))
{
return true;
}
}
}
ARMLibrary.Position.showAndHidePageObjects(a4eAdsArray[i]);
}
}
return true;
}
BrowserEvent.attachScrollEvents = function()
{

ARMRedirLib.Dom.AddEvent(window, 'scroll', ARMLibrary.BrowserEvent.scrollA4EAd);
var version = __AtlasRichMedia__.getModule('client_a1').userAgent.getVersion();
if (__AtlasRichMedia__.getModule('client_a1').userAgent.isFirefox() && ((version.major == 1 && version.minor < 5) || version.major < 1))
{
ARMRedirLib.Dom.AddEvent(document, 'DOMMouseScroll', AdDisplayManager.handleAdditionalScrollEvents);
ARMRedirLib.Dom.AddEvent(document, 'keydown', AdDisplayManager.handleAdditionalScrollEvents);
return true;
}
else
{
return false;
} 
}
BrowserEvent.detachScrollEvents = function()
{
ARMRedirLib.Dom.RemoveEvent(window, 'scroll', ARMLibrary.BrowserEvent.scrollA4EAd);
var version = __AtlasRichMedia__.getModule('client_a1').userAgent.getVersion();
if (__AtlasRichMedia__.getModule('client_a1').userAgent.isFirefox() && ((version.major == 1 && version.minor < 5) || version.major < 1)) 
{
ARMRedirLib.Dom.RemoveEvent(document, 'DOMMouseScroll', AdDisplayManager.handleAdditionalScrollEvents);
ARMRedirLib.Dom.RemoveEvent(document, 'keydown', AdDisplayManager.handleAdditionalScrollEvents); 
}
}
BrowserEvent.attachResizeEvents = function()
{
ARMRedirLib.Dom.AddEvent(window, 'resize', ARMLibrary.BrowserEvent.resizeA4EAd);
}
BrowserEvent.detachResizeEvents = function()
{
ARMRedirLib.Dom.RemoveEvent(window, 'resize', ARMLibrary.BrowserEvent.resizeA4EAd);
}
BrowserEvent.resizeA4EAd = function()
{
if (window.a4eAdsArray)
{
for (var i=0;i < a4eAdsArray.length; i++)
{
if ((a4eAdsArray[i].playStarted==1) && (!(a4eAdsArray[i].adEnd)))
{
if (!ARMLibrary.Position.modifyLocation(a4eAdsArray[i]))
{
return true;
}
}
ARMLibrary.Position.showAndHidePageObjects(a4eAdsArray[i]);
}
}
return true;
}
UtilityPrivate = {};
UtilityPrivate.getAdIndexById = function(property, id)
{
for (var i = 0; i < a4eAdsArray.length; i++)
{
if(a4eAdsArray[i][property] == id)
{
return i;
}
}
}
Utility = {};
Utility.getAdIndexByFlashName = function(flashId)
{
return UtilityPrivate.getAdIndexById('SwfId', flashId);
}
Utility.getAdIndexByMovieId = function(movieId)
{
return UtilityPrivate.getAdIndexById('movieId', movieId);
}
return {
Zindex : Zindex,
SurveyVendor : SurveyVendor,
Phase : Phase,
FlashObject : FlashObject,
Position : Position,
FlashApi : FlashApi,
AtlasEvent : AtlasEvent,
FlashObjectUtil : FlashObjectUtil,
EventObject : EventObject,
BrowserEvent : BrowserEvent,
AdObject : AdObject,
Utility : Utility,
TestApi : { Const : Const }
}
}();
function a4eunload()
{
try
{
sendDebugCall ("label=closead","", "");
if (window.a4eAdsArray)
{
for (var i=0;i < a4eAdsArray.length; i++)
{
ARMLibrary.AtlasEvent.HandleEndOfMainPhase(a4eAdsArray[i]);
ARMLibrary.AtlasEvent.HandleEndOfAd(a4eAdsArray[i]);
}
}
}
catch (e)
{
}
return true;
}
function handleError()
{
return true;
}
function findleft(el)
{
atlasCounter=0;
while (el!=null)
{
atlasCounter=atlasCounter+el.offsetLeft;el=el.offsetParent;
}
return(atlasCounter-__AtlasRichMedia__.getModule('client_a1').getScrollLeft());
}
function findtop(el)
{
atlasCounter=0;
while (el!=null)
{
atlasCounter=atlasCounter+el.offsetTop;el=el.offsetParent;
}
return(atlasCounter-__AtlasRichMedia__.getModule('client_a1').getScrollTop());
}
function pause (nMillis)
{
var now = new Date();
var exitTime = now.getTime() + nMillis;
while (true)
{
now = new Date();
if (now.getTime() > exitTime)
{
return;
}
}
}
function sendDebugCall(eventExpandoInfo, originalInfo, blockedByPopUp)
{
if (!innerDebugMode)
{
return;
}
try
{
var eventObj = document.createEventObject();
blockedByPopUp = "&" + blockedByPopUp;
if (blockedByPopUp.length == 1)
{
blockedByPopUp = "";
}
eventObj.expando = eventExpandoInfo + "&" + originalInfo + blockedByPopUp;
document.all.TopLayerDebugObject.fireEvent("onchange",eventObj);
}
catch(e)
{
}
}
function AtlasFormatURL(URLString)
{
if (URLString.indexOf("http") != 0)
{
return (new String("http" + URLString));
}
else
{
return (new String(URLString));
}
}ARMLibrary.Position.modifyLocation = function (rmAd)
{
var client = __AtlasRichMedia__.getModule('client_a1');
var positioningNode = rmAd.nodes.getRootNode();
var clippingNode = rmAd.nodes.getClippingNode();
var rmObjectNode = new ARMLibrary.FlashObject(rmAd.nodes.getRmObjectNode());
var alternateNode = rmAd.nodes.getAlternateNode();
var verticalOffset = ARMLibrary.Position.computeRectTop(rmAd.Top, rmAd.Height, rmAd.Size, rmAd.Place, rmAd.m_Anchor, rmAd, true);
var horizontalOffset = ARMLibrary.Position.computeRectLeft(rmAd.Left, rmAd.Width, rmAd.Size, rmAd.Place, rmAd.m_Anchor, rmAd, true);
var flashObjectWidth = ARMLibrary.Position.computeRectWidth(rmAd.Width, rmAd.Size);
var flashObjectHeight = ARMLibrary.Position.computeRectHeight(rmAd.Height, rmAd.Size);
var rmObjectPosition = {
left: 0,
top: 0,
width: flashObjectWidth,
height: flashObjectHeight
};
if ( ARMLibrary.Position.checkClipSpanToAlternate(rmAd, alternateNode, rmAd.bustedIframe))
{
rmObjectPosition.top = rmAd.Top;
rmObjectPosition.left = rmAd.Left;
var clipSpanHeight, clipSpanWidth;
if(alternateNode)
{
clipSpanHeight = alternateNode.offsetHeight;
clipSpanWidth = alternateNode.offsetWidth;
}
else
{
clipSpanWidth = parseInt(rmAd.alternateWidth);
clipSpanHeight = parseInt(rmAd.alternateHeight);
}
var clippingNodePosition = {
top: verticalOffset - rmAd.Top,
left: horizontalOffset - rmAd.Left,
width: clipSpanWidth,
height: clipSpanHeight
};
} else {
var clippingNodePosition = {
top: verticalOffset,
left: horizontalOffset,
width: flashObjectWidth,
height: flashObjectHeight
};
}
var bottomBound = Math.max(client.getHeight(), client.getScrollHeight());
if(clippingNodePosition.top > bottomBound) clippingNodePosition.top = bottomBound;
if(clippingNodePosition.top + clippingNodePosition.height > bottomBound) clippingNodePosition.height = bottomBound - clippingNodePosition.top;
var rightBound = Math.max(client.getWidth(), client.getScrollWidth());
if(clippingNodePosition.left > rightBound) clippingNodePosition.left = rightBound;
if(clippingNodePosition.left + clippingNodePosition.width > rightBound) clippingNodePosition.width = rightBound - clippingNodePosition.left;
try
{
ARMLibrary.Position.updateObjectStyle(rmObjectNode,rmObjectPosition);
ARMLibrary.Position.updateObjectStyle(clippingNode,clippingNodePosition);
rmAd.computedWidth = clippingNodePosition.width;
rmAd.computedHeight = clippingNodePosition.height;
}
catch(e)
{
return false;
}
var transparentIframe = ARMRedirLib.Dom.GetObj(rmAd.SwfId + "_iframe");
if(transparentIframe)
{
transparentIframe.style.left = "0px"; 
transparentIframe.style.top = "0px"; 
transparentIframe.style.height = rmAd.computedHeight + "px";
transparentIframe.style.width = rmAd.computedWidth + "px";
}
return true;
}
function AdDisplayManager(){}
AdDisplayManager.getKeyCode = function(oEvent)
{
return oEvent.keyCode;
}
AdDisplayManager.handleAdditionalScrollEvents = function(oEvent)
{
var pressedKeyCode = AdDisplayManager.getKeyCode(oEvent);
if(((pressedKeyCode >= 32) && (pressedKeyCode <= 40)) || (pressedKeyCode == 0))
{
window.setTimeout(ARMLibrary.BrowserEvent.scrollA4EAd, 10);
}
}
AdDisplayManager.onMouseIn = function(destObj)
{
if (!__AtlasRichMedia__.getModule('client_a1').userAgent.isInternetExplorer() && destObj.bustedIframe != null)
{
destObj.mouseIn = true;
AdDisplayManager.hideBustedIframe(destObj);
}
}
AdDisplayManager.onMouseOut = function(destObj)
{
if (!__AtlasRichMedia__.getModule('client_a1').userAgent.isInternetExplorer() && destObj.bustedIframe != null)
{
destObj.mouseIn = false;
AdDisplayManager.showBustedIframe(destObj);
}
}
AdDisplayManager.hideBustedIframe = function(destObj)
{
if ( ! __AtlasRichMedia__.getModule('client_a1').userAgent.isInternetExplorer() )
{
if(ARMLibrary.Position.ElementIsVisibleAndOverlapsAd(destObj.bustedIframe, destObj))
{
destObj.bustedIframe.style.visibility = 'hidden';
destObj.weHidBustedIframe = true;
}
} 
}
AdDisplayManager.showBustedIframe = function(destObj)
{
if ( ! __AtlasRichMedia__.getModule('client_a1').userAgent.isInternetExplorer() )
{
if(destObj.weHidBustedIframe)
{
destObj.bustedIframe.style.visibility = 'visible';
destObj.weHidBustedIframe = false;
}
}
}
AdDisplayManager.showTransparentIframe = function(destObj) 
{
var transparentIframe = ARMRedirLib.Dom.GetObj(destObj.SwfId + "_iframe");
if(transparentIframe)
{
transparentIframe.style.visibility = 'visible';
}
}
AdDisplayManager.hideTransparentIframe = function(destObj) 
{
var transparentIframe = ARMRedirLib.Dom.GetObj(destObj.SwfId + "_iframe");
if(transparentIframe)
{
transparentIframe.style.visibility = 'hidden';
}
}
function ClientCompatibilityManager(){}
ClientCompatibilityManager.getClientBrowser = function()
{
return { browser : "msie", version : "6"};
}
if (typeof(USER_CLICK_CLOSE) == 'undefined')
{
if (typeof(innerDebugMode) == 'undefined')
var innerDebugMode = false;
if (typeof(AtlasPaTTestTab) == 'undefined')
var AtlasPaTTestTab = false;
var notifiedTrackingWindow = false;
var AtlasPageLoaded = false;
var initializedFlashFile = false;
var objectsOnPage = 0;
var embedsOnPage = 0;
var MAX_NUM_EVENTS = 100, MAX_NUM_MOVIES = 4;
var hideElementsCap = 0;
var pausableTime = 600;
var noApplets = false;
var noIframes = false;
var noSelectBoxes = false;
var playingAds = 0;
var USER_CLICK_CLOSE = 6;
var ACTION_CLOSE_A4E_AD = 1;
var ACTION_NONE_A4E_AD= 0;
var TEASER = 0;
var REMINDER = 1;
var MAIN = 2;
var SCROLL_INTERVAL = 1;
var METHOD_RELATIVE_STRING = '%';
var METHOD_ABSOLUTE_STRING = 'px';
var LOCATION_METHOD_RELATIVE	= 0;
var LOCATION_METHOD_ABSOLUTE	= 1;
var LOCATION_METHOD_ABSOLUTE_RELATIVE	= 2;
var SIZE_METHOD_ABSOLUTE	= 1;
var SIZE_METHOD_RELATIVE	= 0;
var ANCHOR_TOP_LEFT_CORNER	= 'TopLeftCorner';
var ANCHOR_TOP_RIGHT_CORNER	= 'TopRightCorner';
var ANCHOR_BOTTOM_LEFT_CORNER	= 'BottomLeftCorner';
var ANCHOR_BOTTOM_RIGHT_CORNER	= 'BottomRightCorner';
var ANCHOR_CENTER_SCREEN	= 'CenterOfScreen';
var ANCHOR_ALTERNATE = 'Alternate';
var ANCHOR_OBJECT_IN_PAGE	= 'ObjectInPage';
var timeOutHandles = new Array();
var movieInterval = new Array();
if (typeof(ARM_TestMode) == 'undefined')
{
ARM_startTopLayer();
}
}
function ARM_startTopLayer()
{
beginAdHandler = null;
ARMLibrary.BrowserEvent.attachScrollEvents();
ARMRedirLib.Dom.AddEvent(window, 'error', handleError);
ARMRedirLib.Dom.AddEvent(window, 'unload', a4eunload);
ARMLibrary.BrowserEvent.attachResizeEvents();
ARMRedirLib.Dom.AddEvent(window, 'load', igniteAtlasRM);
if ((document.readyState=="complete") || (document.readyState=="interactive"))
{
if (document.readyState=="complete")
AtlasPageLoaded = true;
}
ARM_attachOnPropertyChangeHandler(a4eAdsArray);
}
function ARM_attachOnPropertyChangeHandler(a4eAdsArray)
{
if(a4eAdsArray && a4eAdsArray[0])
{
var obj = a4eAdsArray[0].nodes.getRmObjectNode();
obj.onpropertychange = atlasPropChanged;
}
}
AdRenderer = {}
AdRenderer.handleCacheSwfLoaded = function(destObj)
{
notifiedTrackingWindow = true;
changePhase('teaser', ARMLibrary.Phase.Convert('teaser'), destObj, 'javascript');
AdRenderer.replaceFlashMovieSrc(
new ARMLibrary.FlashObject(destObj.nodes.getTempRmObjectNode()),
new ARMLibrary.FlashObject(destObj.nodes.getRmObjectNode())
);
destObj.nodes.removeTempRmObjectNode();
}
AdRenderer.replaceFlashMovieSrc = function(sourceFlashObject, targetFlashObject)
{
if(sourceFlashObject.GetMovieSrc() != targetFlashObject.GetMovieSrc())
{
targetFlashObject.SetMovieSrc(sourceFlashObject.GetMovieSrc());
}
}
AdRenderer.closeOnInvalidAnchor = function(adObj, phaseLabel)
{
return false;
}
function auto_orange_DoFSCommand(command, args, movieId)
{
ARMLibrary.FlashApi.FSCommand(command, args, movieId);
}
function changePhase(phaseLabel, phaseID, objectToWorkOn)
{
objectToWorkOn.adCurrentPhase = phaseID;
var phaseIDUpperCase = phaseID.toUpperCase();
ARMLibrary.AdObject.updateParams(objectToWorkOn, phaseIDUpperCase);
ARMLibrary.Position.modifyLocation(objectToWorkOn);
ARMLibrary.Position.modifyLocation(objectToWorkOn);
objectToWorkOn.status = phaseID.toUpperCase();
ARMLibrary.Position.showAndHidePageObjects(objectToWorkOn);
ARMLibrary.FlashObjectUtil.setOverlappingSwfsToOpaque(objectToWorkOn);
ARMLibrary.Position.enableHTMLbelowWithDelay(objectToWorkOn);
sendDebugCall ("label=" + phaseLabel ,"", "");
}
function a4eload()
{
for (var i=0;i < a4eAdsArray.length; i++)
{
a4eAdsArray[i].paramonload = false;
}
}
function a4eloadObject(a4eObject)
{
if (a4eObject.playStarted == 0)
{
if (playingAds == 0)
ARMLibrary.FlashObjectUtil.setOverlappingSwfsToOpaque(a4eObject);
a4eObject.playStarted = 1;
}
ARMLibrary.AdObject.updateParams(a4eObject, "TEASER");
a4eObject.status = TEASER;
ARMLibrary.AtlasEvent.HandleStartOfAd(a4eObject);
if (!innerDebugMode)
{
if (ARMLibrary.Position.modifyLocation(a4eObject) != true) 
return;
a4eObject.nodes.getRmObjectNode().style.visibility='visible';
}
sendDebugCall ("beginPlay=", "", "");
if (a4eObject.adCurrentPhase != 'banner')
{
ARMLibrary.Position.showAndHidePageObjects(a4eObject);
}
ARMLibrary.Position.enableHTMLbelowWithDelay(a4eObject);	
var d = new Date();
var dd= d.getTime();
ARMLibrary.AtlasEvent.a4eCallURL(a4eObject);
ARMLibrary.SurveyVendor.Call(a4eObject, 'teaser');
if (typeof(toplayer_debug_mode) != 'undefined')
if (toplayer_debug_mode)
innerDebugMode = true;
playingAds++;
}
function closeA4Ead(objectToWorkOn)
{
sendDebugCall ("label=closead","", "");
var rmObjectNode = objectToWorkOn.nodes.getRmObjectNode();
rmObjectNode.StopPlay();
rmObjectNode.style.visibility= 'hidden';
if (!innerDebugMode)
{
objectToWorkOn.a4eexit=true;
clearAtlasDivs(objectToWorkOn.nodes.getClippingNode());
objectToWorkOn.adEnd = true;
}
clearAtlasDivs(rmObjectNode);
ARMLibrary.Position.manageVisibility(true, "visible", objectToWorkOn, 'select');
ARMLibrary.Position.manageVisibility(true, "visible", objectToWorkOn, 'applet');
ARMLibrary.Position.manageVisibility(true, "visible", objectToWorkOn, 'iframe');
}
function computeAnchorElementPosition(anchorElement, localLeft, localTop, localWidth, localHeight, localSize, a4eObject)
{
var leftVal;
var topVal;
if (anchorElement == null)
{
if (a4eObject.bustedIframe != null)
{
anchorElement = a4eObject.bustedIframe;
var alternateOffset = ARMRedirLib.GetElementPosition(anchorElement);
a4eObject.alternateOffsetX = alternateOffset.x;
leftVal = parseInt(a4eObject.alternateOffsetX + eval(localLeft) - __AtlasRichMedia__.getModule('client_a1').getScrollLeft()) + parseInt(a4eObject.alternateOffsetIframeLeftOffset);
a4eObject.alternateOffsetY = alternateOffset.y;
topVal = parseInt(a4eObject.alternateOffsetY + eval(localTop) - __AtlasRichMedia__.getModule('client_a1').getScrollTop()) + parseInt(a4eObject.alternateOffsetIframeTopOffset);
}
else
{
if (!innerDebugMode)
{
closeA4Ead(a4eObject);
ARMLibrary.AtlasEvent.HandleEndOfMainPhase(a4eObject);
ARMLibrary.AtlasEvent.HandleEndOfAd(a4eObject);
}
else
{
leftVal = eval(localLeft) + (__AtlasRichMedia__.getModule('client_a1').getWidth() / 2) - (ARMLibrary.Position.computeRectWidth(localWidth, localSize) / 2);
topVal = eval(localTop) + (__AtlasRichMedia__.getModule('client_a1').getHeight() / 2) - (ARMLibrary.Position.computeRectHeight(localHeight, localSize) / 2);
}
}
}
else
{
var alternateOffset = ARMRedirLib.GetElementPosition(anchorElement);
a4eObject.alternateOffsetX = alternateOffset.x;
leftVal = a4eObject.alternateOffsetX + eval(localLeft) - __AtlasRichMedia__.getModule('client_a1').getScrollLeft();
a4eObject.alternateOffsetY = alternateOffset.y;
topVal = a4eObject.alternateOffsetY + eval(localTop) - __AtlasRichMedia__.getModule('client_a1').getScrollTop();
}
return {x: leftVal, y: topVal};
}
function clearAtlasDivs(objectToWorkOn)
{
objectToWorkOn.style.width = 0;
objectToWorkOn.style.height = 0;
objectToWorkOn.style.visibility='hidden';
objectToWorkOn.style.display='none';
}
function igniteAllTopLayer()
{
var destObj;
if (window.a4eAdsArray)
{
for (var i=0;i < a4eAdsArray.length; i++)
{
if (a4eAdsArray[i] != null)
{
if (typeof(a4eAdsArray[i]) == 'object')
{
destObj = a4eAdsArray[i];
var tempNode = destObj.nodes.getTempRmObjectNode();
if ((destObj.playStarted == 0) && tempNode)
{
attachAtlasEvents(destObj.nodes.getRmObjectNode());
var tempSwf = new ARMLibrary.FlashObject(tempNode);
if (tempSwf.PercentLoaded() == 100)
{
ARMLibrary.AdObject.HandleFlashLoad(destObj);
}
}
else
{
var swfObject = null;
try {
swfObject = new ARMLibrary.FlashObject(destObj.nodes.getRmObjectNode());
} catch(e) {
}
if (swfObject)
{
if ((!destObj.bFlashFileInitialized) && (AtlasPageLoaded) && swfObject.PercentLoaded() == 100)
{
setHTML_LOADED();
destObj.bFlashFileInitialized = true;
}
if ((destObj.m_Anchor != ANCHOR_TOP_LEFT_CORNER) && (destObj.m_Anchor != ANCHOR_TOP_RIGHT_CORNER) && (destObj.m_Anchor != ANCHOR_BOTTOM_LEFT_CORNER) && (destObj.m_Anchor != ANCHOR_BOTTOM_RIGHT_CORNER) && (destObj.m_Anchor != ANCHOR_CENTER_SCREEN) && (destObj.m_Anchor != '') && (destObj.m_anchor != NOT_DEFINED) && (destObj.m_Anchor != null) && (destObj.m_Anchor != -100000))
{
var localAnchor;
if (destObj.m_Anchor == ANCHOR_ALTERNATE)
localAnchor = new String("orange_alternate_" + destObj.paid);
else
localAnchor = destObj.m_Anchor;
var obj = document.getElementById(localAnchor);
if (obj != null)
{
if ((obj.offsetTop != destObj.alternateOffsetY) || (obj.offsetLeft != destObj.alternateOffsetX))
{
if (!ARMLibrary.Position.modifyLocation(destObj)) return;
}
}
}	
}
}
if (hideElementsCap < 10)
{
ARMLibrary.FlashObjectUtil.setOverlappingSwfsToOpaque(destObj);
recheckHiddenElements(destObj);
}
}
}
}
}
}
function IframeOnLoadFunc()
{
}
function recheckHiddenElements(a4eObject)
{
var reHide = false;
hideElementsCap ++;
var objectsCollection = document.getElementsByTagName('select');
if ((a4eObject.selectList != null) && (a4eObject.selectList != ''))
{
if (a4eObject.selectList.length != objectsCollection.length)
{
a4eObject.selectList = objectsCollection;
reHide = true
}
}
objectsCollection = document.getElementsByTagName('iframe');
if ((a4eObject.IframesList != null) && (a4eObject.IframesList != ''))
{
if ((a4eObject.IframesList.length != objectsCollection.length) && (a4eObject.IframesList.length+1 != objectsCollection.length) && (a4eObject.IframesList.length+2 != objectsCollection.length))
{
a4eObject.IframesList = objectsCollection;
reHide = true
}
}
objectsCollection = document.getElementsByTagName('applet');
if ((a4eObject.appletList != null) && (a4eObject.appletList != ''))
{
if (a4eObject.appletList.length != objectsCollection.length)
{
a4eObject.appletList = objectsCollection;
reHide = true
}
}
if (reHide)
ARMLibrary.BrowserEvent.scrollA4EAd();
}
function igniteAtlasRM()
{
AtlasPageLoaded = true;
}
if (window.beginAdHandler == null)
beginAdHandler = window.setInterval("igniteAllTopLayer()",700);
function setHTML_LOADED()
{
for (var i=0; i < a4eAdsArray.length; i++)
{
if (a4eAdsArray[i] != null)
{
if (typeof(a4eAdsArray[i]) == 'object')
{
try
{
new ARMLibrary.FlashObject(a4eAdsArray[i].nodes.getRmObjectNode()).SetVariable('html_loaded', 'true');
}
catch(e)
{
}
}
}
}
}
function attachAtlasEvents(rmObjectNode)
{
ARMRedirLib.Dom.AddEvent(rmObjectNode, 'mouseover', invokeFlashMouseIn);
ARMRedirLib.Dom.AddEvent(rmObjectNode, 'mouseout', invokeFlashMouseOut);
}
function invokeFlashMouseIn(eventString)
{
var rmAd = ARMLibrary.AtlasEvent.handleMouseEvent(eventString, true);
AdDisplayManager.onMouseIn(rmAd);
}
function invokeFlashMouseOut(eventString)
{
var rmAd = ARMLibrary.AtlasEvent.handleMouseEvent(eventString, false);
AdDisplayManager.onMouseOut(rmAd);
}
function atlasPropChanged()
{
if (event.propertyName == "style.visibility")
if (event.srcElement.id.indexOf("orange") == 0)
event.srcElement.style.visibility = "visible";
}
function getAdObjectElement()
{
return a4eAdsArray[0].nodes.getRmObjectNode(); 
}
function enableHidingIframe(a4eObject)
{
}
function disableHidingIframe(a4eObject)
{
}
