function ebCDebug(lvl)
{
if (typeof(lvl) == "undefined")
lvl = 0;
var browser = new ebCBrowserCheck();
this.objWindow = null;
this.nLevel = lvl;
this.setDbgLvl = setDbgLvl;
this.debug2 = debug2;
this.debug = debug;
this.info = info;
this.attention = attention;
this.warning = warning;
this.error = error;
this.fatal = fatal;
this.always = always;
function setDbgLvl(lvl)
{
if (typeof(lvl) == "undefined")
return;
if (this.nLevel == lvl)
return;
this.nLevel = lvl;
this.attention("Changing debug level to " + lvl);
gEbClientInfo.cookieInfo.setDbgLvl(lvl);
}
function debug2(msg)
{
writeLine(this,msg,"#cccccc",6);
}
function debug(msg)
{
writeLine(this,msg,"#ccaccc",5);
}
function info(msg)
{
writeLine(this,msg,"#777777",4);
}
function attention(msg)
{
writeLine(this,msg,"black",3);
}
function warning(msg)
{
writeLine(this,msg,"red",2);
}
function error(msg)
{
writeLine(this,msg,"black",1,"#ffff00");
}
function fatal(msg)
{
writeLine(this,msg,"black",1,"#ff0000");
}
function always(msg)
{
writeLine(this,msg,"blue",1);
}
function init(objRef)
{
try{
if (typeof(gEbAdWindow) != "undefined")
objRef.objWindow = window.open("", "WinAdDebug");
else
if (typeof(gfEbBannerInInnerIframe) != "undefined")
objRef.objWindow = window.open("", "BannerInIframeDebug");
else
if (typeof(gfEbOnIframe) != "undefined")
objRef.objWindow = window.open("", "OOBInIframeDebug");
else
objRef.objWindow = window.open("", "EyeblasterDebug");
if (!browser.isAOL())
objRef.objWindow.blur();
if (objRef.objWindow.document.title == "")
{
objRef.objWindow.document.open("text/html","aaa");
objRef.objWindow.document.write("<HTML><HEAD><TITLE>" + objRef.objWindow.name + "</TITLE></HEAD><BODY><FONT face='Times New Roman (Hebrew)' size=2>");
objRef.objWindow.document.writeln("<BR><BR>");
}
}catch(e)
{
}
}
function writeLine(objRef,msg,color,minLvl,bgColor)
{
try{
if(typeof(bgColor) == 'undefined')
{
if (typeof(gEbAdWindow) != "undefined")
bgColor = "#ffffcc";
else
bgColor = "#ffffff";
}
if(objRef.nLevel < minLvl)
return;
if((objRef.objWindow == null) || objRef.objWindow.closed)
init(objRef);
msg = msg.replace(/ /g,"&nbsp;")
var line = "<FONT color=" + color + " style='BACKGROUND-COLOR: " + bgColor + "'>";
line = line + msg + "</FONT><BR>";
objRef.objWindow.document.writeln(line);
}catch(e)
{
}
}
}
function ebCTIObj(name)
{
this.id = "";
this.name = "";
this.src = "";
this.play = true;
this.width = "0";
this.height = "0";
this.wmode = "transparent";
this.version = 4.0;
this.style = new Object();
this.style.border = 0; 
this.onclick = "";
this.onload = ""; 
this.refElement = null;
this.bgColor = "";
this.frameborder = 0; 
this.adId = "";
this.border = 0;
this.strAdditionalRes = "";
this.className = "";
this.dir = "";
if (typeof(name) != "undefined")
{
this.id = name;
this.name = name;
}
this.print = printTIObj;
function printTIObj()
{
var str = "ebCTIObj: <br>" +
"id: " + this.id + "<br>" +
" name: " + this.name +"<br>" +
" src: " + this.src +"<br>" +
" play: " + this.play + "<br>" +
" width: " + this.width +"<br>" +
" height: " + this.height +"<br>" +
" wmode: " + this.wmode + "<br>" +
" version: " + this.version +"<br>" +
" style: " + this.style +"<br>" +
" onclick: " + this.onclick + "<br>" +
" onload: " + this.onload +"<br>" +
" refElement: " + this.refElement +"<br>" +
" bgColor: " + this.bgColor;
gEbDbg.attention(str);
}
}
function ebCTagInsertor(win)
{
if (typeof(win) == "undefined")
win = self;
var browser = new ebCBrowserCheck();
this.tagsContainer = null;
this.win = win;
this.doc = win.document;
this.write = write;
this.addFlash = addFlash;
this.addScript = addScript;
this.addImage = addImage2;
this.addDiv = addDiv;
this.addInLineScript = addInLineScript;
this.addEventHandler = addEventHandler;
this.addFsCommandHandler = addFsCommandHandler;
this.addIframe = addIframe;
this.addRelativeObject = addRelativeObject;
this.addTable = addTable;
this.setTagsContainer = setTagsContainer;
this.addEyeDiv = addEyeDiv;
function addFlash(method,obj)
{
try{
var str = "addFlash('" + method + "','" + obj.id + "','" + obj.name + "','" + obj.src + "','" + obj.play + "','" + obj.style.width + "','" + obj.style.height + "','" + obj.wmode + "','" + obj.version + "');";
if (obj.refElement != null)
str = str + "refObj ID : " + obj.refElement.id;
gEbDbg.debug(str);
if(browser.isIE())
return(addObject(this,method ,obj));
else
return(addEmbed(this,method ,obj));
}catch(e)
{
gEbDbg.fatal("ebCTagInsertor.addFlash : " + e.description);
}
return (null);
}
function write(str,refObj)
{
try{
if(typeof(refObj) == 'undefined')
refObj = this;
refObj.doc.write(str);
}catch(e)
{
gEbDbg.fatal("ebCTagInsertor.write : " + e.description);
gEbDbg.fatal("ebCTagInsertor.write : " + str.replace(/</g,"<."));
}
}
function addScript(method,src,id,name)
{
if(typeof(src) == 'undefined')
{
src="";
gEbDbg.fatal("addScript - no src was given");
return;
}
if(typeof(id) == 'undefined')
id="";
if(typeof(name) == 'undefined')
name ="";
gEbDbg.debug("addScript('" + method + "','" + src+ "','" + id + "','" + name + "');");
if(method == 'append' )
{
try{
var element = this.doc.createElement("script");
element.setAttribute("id",id);
element.setAttribute("src",src);
var container = getTagsContainer(this);
container.appendChild(element);
}catch(e)
{
gEbDbg.fatal("ebCTagInsertor.addScript : " + e.description);
}
}
else
{
if(method == 'write' )
{
var strTag = '<SCR' + 'IPT';
if(id != "")
strTag += (' id="' + id + '"');
if(name != "")
strTag += (' name="' + name + '"');
if(src != "")
strTag += (' src="' + src + '"');
strTag += '></SCR' + 'IPT>';
this.write(strTag);
}
else
gEbDbg.warning("addScript : unrecognized method - " + method);
}
}
function addDiv(method,obj)
{
var newObj = null;
gEbDbg.debug("addDiv('" + method + "', id='" + obj.id + "');");
if(method == 'write' )
{
var style = getStyleStr(obj.style);
var strTag = '<div id="' + obj.id + '" style="' + style + '"';
if(obj.dir != "")
strTag += ' dir="' + obj.dir + '"';
if(obj.className != "")
strTag += ' className="' + obj.className + '"';
strTag += '></div>';
this.write(strTag);
}
else
{
try{
var element = this.doc.createElement("div");
element.setAttribute("id",obj.id);
if(obj.className != "")
element.setAttribute("className",obj.className);
if(obj.dir != "")
element.setAttribute("dir",obj.dir);
copyObj(element.style,obj.style);
if(method == 'append' )
{
var container;
if (obj.refElement != null)
container = obj.refElement;
else
container = getTagsContainer(this);
container.appendChild(element);
}
else
if(method == 'before' )
{
var refEl = obj.refElement;
var parentEl = refEl.parentNode;
parentEl.insertBefore(element, refEl);
}
else
gEbDbg.warning("addDiv : unrecognized method - " + method);
newObj = element;
}catch(e)
{
gEbDbg.fatal("ebCTagInsertor.addDiv : " + e.description);
}
}
return (newObj);
}
function addImage2(method,obj)
{
var newObj = null;
var str = "addImage('" + method + "','" + obj.src+ "','" + obj.width + "','" + obj.height + "','" + obj.id + "','" + obj.name + " ','" +obj.onclick+"','" + obj.onload +"');";
if (obj.refElement != null)
str = str + "refObj ID : " + obj.refElement.id;
gEbDbg.debug(str);
var style = getStyleStr(obj.style);
if (obj.onclick != "")
style += "cursor:pointer;cursor:hand";
var strTag = '<img id="' + obj.id + '" src="' + obj.src + '" width=' + obj.width + ' height=' + obj.height + ' onclick="' + obj.onclick + '" onload="' + obj.onload +'" border="'+ obj.border + '" style="' + style + '"/>';
if(method == 'write' )
{
this.write(strTag);
}
else
{
try{
divElement = this.doc.createElement("DIV");
if(method == 'append' )
{
var container;
if (obj.refElement != null)
container = obj.refElement;
else
container = getTagsContainer(this);
container.appendChild(divElement);
}
else
if(method == 'before' )
{
var refEl = obj.refElement;
var parentEl = refEl.parentNode;
parentEl.insertBefore(divElement, refEl);
}
divElement.innerHTML = strTag;
if (obj.id != "")
{
newObj = this.doc.getElementById(obj.id);
if (newObj == null)
gEbDbg.fatal("addObject : Can't find object " + obj.id);
}
}catch(e)
{
gEbDbg.fatal("ebCTagInsertor.addImage : " + e.description);
}
}
return (newObj);
}
function addInLineScript(method ,strScript,id,obj,event)
{
try{
if(typeof(id) == 'undefined')
id="";
if(typeof(obj) == 'undefined')
obj ="";
if(typeof(event) == 'undefined')
event ="";
gEbDbg.debug("addInLineScript('" + method + "','" + strScript+ "','" + id+ "','" + obj + "','" + event+ "');");
if(method == 'append' )
{
{
try{
if (browser.isIE())
{
var str;
if (event == "")
str = "<scr" + "ipt></scr" + "ipt>";
else
str = "<scr" + "ipt for='" + obj + "' event='" + event + "'></scr" + "ipt>"
var element = this.doc.createElement(str);
element.setAttribute("id",id);
element.text = strScript;
}
else
{
var element = this.doc.createElement("script");
element.setAttribute("id",id);
var text = this.doc.createTextNode(strScript);
element.appendChild(text);
}
var container = getTagsContainer(this);
container.appendChild(element);
}catch(e)
{
gEbDbg.fatal("exception: " + e.description);
}
}
}
else
{
if(method == 'write' )
{
var strTag = '<scr' + 'ipt id="' + id + '" ';
if(obj != "")
strTag += 'for="' + obj + '" ';
if(event != "")
strTag += 'event="' + event + '" ';
strTag += '>' + strScript + '</scr' + 'ipt>';
this.write(strTag);
}
else
gEbDbg.warning("addInLineScript : unrecognized method - " + method);
}
}catch(e)
{
gEbDbg.fatal("ebCTagInsertor.addInlineScript : " + e.description);
}
}
function addFsCommandHandler(method,objName,handler)
{
try{
gEbDbg.debug("addFsCommandHandler('" + method + "','" + objName + "','" + handler+ "');");
var strFsCommandHandler;
if(browser.isIE())
{
strFsCommandHandler = handler;
this.addInLineScript(method,strFsCommandHandler,"",
objName,"FSCommand(command,args)");
}
else
{
strFsCommandHandler =
'function ' + objName + '_DoFSCommand(command,args){'+
handler +
'}';
this.addInLineScript(method,strFsCommandHandler);
}
}catch(e)
{
gEbDbg.fatal("ebCTagInsertor.addFSCommandHandler : " + e.description);
}
}
function addEventHandler(event,handler,obj)
{
try{
gEbDbg.debug("addEventHandler('" + event + "','" + handler +"');");
var strEventHandler;
if(typeof(obj) == "undefined")
obj = this.win;
if(browser.isIE())
{
event = "on" + event;
obj.attachEvent(event,eval(handler));
}
else
{
this.win.addEventListener(event,eval(handler),false);
}
}catch(e)
{
gEbDbg.fatal("ebCTagInsertor.addEventHandler : " + e.description);
}
}
function addIframe(method,obj)
{
try{
gEbDbg.debug("addIframe(" + method + "," + obj.src + "," + obj.id + ");");
var style = getStyleStr(obj.style);
var iframeStr = "<iframe frameborder=" + obj.frameborder + " src='" + obj.src + "' style='" + style + "' id='" + obj.id + "'></iframe>";
if(method == 'write')
{
this.write(iframeStr);
}
else
{
divElement = this.doc.createElement("DIV");
if(method == 'append')
{
var container;
if (obj.refElement != null)
container = obj.refElement;
else
container = getTagsContainer(this);
divElement.innerHTML = iframeStr;
container.appendChild(divElement);
}
else
gEbDbg.warning("addIframe - non suported method: " + method);
}
}catch(e)
{
gEbDbg.error("addIframe: " + e.description);
}
}
function addTable(object,name,style)
{
ebTable = this.doc.createElement("table");
ebTable.setAttribute("cellPadding","0");
ebTable.setAttribute("cellSpacing","0");
ebTable.style.display = "inline";
if (typeof(style) != "undefined")
copyObj(ebTable.style,style);
var row = ebTable.insertRow(0);
var cell = this.doc.createElement("TD");
var TIobj = new ebCTIObj(name);
copyObj(TIobj.style,style);
TIobj.refElement = cell;
var tmpDiv = this.addDiv("append",TIobj);
row.appendChild(cell);
object.parentNode.insertBefore(ebTable,object);
return (tmpDiv);
}
function addRelativeObject(object,name,zIndex)
{
ebTable = this.doc.createElement("table");
ebTable.setAttribute("cellPadding","0");
ebTable.setAttribute("cellSpacing","0");
ebTable.style.display = "inline";
var row = ebTable.insertRow(0);
var cell = this.doc.createElement("TD");
var TIobj = new ebCTIObj(name);
TIobj.style.position = "absolute"
TIobj.style.width = "0px";
TIobj.style.height = "0px";
if(typeof(zIndex) != "undefined")
TIobj.style.zIndex = zIndex;
TIobj.refElement = cell;
var tmpDiv = this.addDiv("append",TIobj);
row.appendChild(cell);
var refObj = object;
var parentNode = refObj.parentNode;
if (parentNode.tagName.toLowerCase() == "a")
{
refObj = parentNode;
parentNode = parentNode.parentNode;
}
parentNode.insertBefore(ebTable,refObj);
cell.appendChild(refObj);
return tmpDiv;
}
function setTagsContainer(newTC)
{
gEbDbg.info("Setting new Tags Container : " + newTC.id);
this.tagsContainer = newTC;
}
function addEyeDiv(method,name)
{
var divAttr = new ebCTIObj(name);
divAttr.style.position = "absolute";
divAttr.style.top = "0";
divAttr.style.left = "0";
divAttr.style.zIndex = "10000";
divAttr.dir = "ltr";
if (method == "write")
{
this.addDiv(method,divAttr);
return;
}
divAttr.refElement = this.doc.body;
var container = this.addDiv(method,divAttr);
if (container != null)
this.setTagsContainer(container);
else
gEbDbg.error("Can't create new tags container (eyeDiv2)");
}
function createFlash(refObj,method,id,name, src ,play,width,height,wmode,version)
{
if(browser.isIE())
{
return createObject(id,name, src ,play,width,height,wmode,version);
}
else
{
return createEmbed(refObj,method,id,name, src ,play,width,height,wmode,version);
}
}
function createObject(id,name, src ,play,width,height,wmode,version)
{
var strObject ='<object id="' + id + '" name ="' + name +
'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' +
'codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+ version +',0,0,0' + ' style="WIDTH:' + width + 'px;HEIGHT:' + height+ 'px;" >'+
'<PARAM NAME="movie" VALUE="' + src +'">'+
'<PARAM NAME="play" VALUE=' + play + '>'+
'<PARAM NAME="wmode" VALUE="' + wmode +'">'+
'<PARAM NAME="menu" VALUE=false>'+
'</object>';
return strObject;
}
function createEmbed(refObj,asElement,id,name, src ,play,width,height,wmode,version)
{
if(asElement)
{
var element = refObj.doc.createElement("EMBED");
element.setAttribute("id",id);
element.setAttribute("name",name);
element.setAttribute("src",src);
element.setAttribute("play",play);
element.setAttribute("WIDTH",width);
element.setAttribute("HEIGHT",height);
element.setAttribute("menu",false);
element.setAttribute("TYPE","application/x-shockwave-flash"); element.setAttribute("PLUGINSPAGE","http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash");
return element;
}
else
{
var strEmbed =
'<EMBED src="' + src +'" WIDTH="' + width +
'" HEIGHT="' + height + '" play=' + play +
' id= "' + id +'" name="'+ name + '" quality=high' +
' menu=false' +
' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>' ;
return strEmbed;
}
}
function addEmbed(refObj,method ,obj)
{
var newObj = null;
try{
if(method == 'write' )
{
var style = getStyleStr(obj.style);
var strEmbed =
'<EMBED src="' + obj.src +
'" play=' + obj.play +
' id= "' + obj.id +
'" name="'+ obj.name +
'" quality=high' +
' wmode=' + obj.wmode +
' menu=false' +
' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"' +
' style="' + style + '"';
if(obj.bgColor != "")
strEmbed += 'bgcolor="' + obj.bgColor +'"';
strEmbed += '></EMBED>' ;
refObj.write(strEmbed,refObj);
}
else
{
var element = refObj.doc.createElement("EMBED");
element.setAttribute("id",obj.id);
element.setAttribute("name",obj.name);
element.setAttribute("src",obj.src);
element.setAttribute("play",obj.play);
obj.wmode = "transparent";
element.setAttribute("wmode",obj.wmode);
element.setAttribute("menu",false);
element.setAttribute("TYPE","application/x-shockwave-flash");
element.setAttribute("PLUGINSPAGE","http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash");
if(obj.bgColor != "")
element.setAttribute("bgcolor",obj.bgColor);
copyObj(element.style,obj.style);
if(method == 'append' )
{
var container;
if (obj.refElement != null)
container = obj.refElement;
else
container = getTagsContainer(refObj);
container.appendChild(element);
}
else
if(method == 'before' )
{
var refEl = obj.refElement;
var parentEl = refEl.parentNode;
parentEl.insertBefore(element, refEl);
}
else
gEbDbg.warning("addEmbed: unrecognized method - " + method);
newObj = element;
}
}catch(e)
{
gEbDbg.fatal("ebCTagInsertor.addEmbed : " + e.description);
}
return (newObj);
}
function addObject(refObj,method ,obj)
{
var newObj = null;
try{
var style=getStyleStr(obj.style);
var flashsrc = obj.src;
var strObject =
'<object id="' + obj.id + '" name ="' + obj.name +
'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' +
'codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+ obj.version +',0,0,0' + ' style="' + style + '" >';
strObject +=
'<PARAM NAME="movie" VALUE="' + flashsrc +'">'+
'<PARAM NAME="play" VALUE=' + obj.play + '>'+
'<PARAM NAME="wmode" VALUE="' + obj.wmode +'">'+
'<PARAM NAME="menu" VALUE=false>';
if(obj.bgColor != "")
strObject += '<PARAM NAME="bgcolor" VALUE="' + obj.bgColor +'">';
strObject += '</object>';
if(method == 'write' )
refObj.write(strObject);
else
{
divElement = refObj.doc.createElement("DIV");
if(method == 'append' )
{
var container;
if (obj.refElement != null)
container = obj.refElement;
else
container = getTagsContainer(refObj);
container.appendChild(divElement);
}
else
if(method == 'before' )
{
var refEl = obj.refElement;
var parentEl = refEl.parentNode;
parentEl.insertBefore(divElement, refEl);
}
divElement.innerHTML = strObject;
if (obj.id != "")
{
newObj = refObj.doc.getElementById(obj.id);
if (newObj == null)
gEbDbg.fatal("addObject : Can't find object " + obj.id);
}
else
gEbDbg.warning("addObject : there obj.id is empty ");
}
}catch(e)
{
gEbDbg.fatal("ebCTagInsertor.addObject : " + e.description);
}
return(newObj);
}
function copyObj(dest,src)
{
for (attr in src)
{
dest[attr] = src[attr];
}
}
function getStyleStr(styleObj)
{
var strStyle = ""
for (attr in styleObj)
{
if (attr == "zIndex")
strStyle = strStyle + "z-Index:" + styleObj[attr] + ";";
else
strStyle = strStyle + attr + ":" + styleObj[attr] + ";";
}
return(strStyle);
}
function getTagsContainer(objRef)
{
if(objRef.tagsContainer != null)
return objRef.tagsContainer;
objRef.tagsContainer = objRef.doc.getElementById("eyeDiv");
if(objRef.tagsContainer == null)
{
objRef.tagsContainer = objRef.doc.body;
gEbDbg.warning("tagsContainer is document.body");
}
return objRef.tagsContainer;
}
}
function ebCPlugin(objName)
{
var browser = new ebCBrowserCheck();
this.objName = objName; 
this.flFlashVer=0;
this.flAudioVer=0;
this.bandWidth = new ebCBWDetector(this.objName + ".bandWidth");
this.init = initPlugin;
function initPlugin()
{
gEbDbg.info("Initializing plugin info");
this.flFlashVer = getFlashVer();
this.flAudioVer = getAudioVer();
gEbDbg.debug("Flash Version : " + this.flFlashVer);
gEbDbg.debug("Audio Version : " + this.flAudioVer);
this.bandWidth.init();
}
function getFlashVer()
{
try{
if (browser.isIE())
return(getIEFlash());
else
return(getNNFlash());
}catch(e)
{
return 0;
}
}
function getNNFlash()
{
var ver = 0;
var releaseVer=0;
if (navigator.mimeTypes["application/x-shockwave-flash"])
{
var plugin = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
ver = (plugin.description.substring(plugin.description.indexOf("Shockwave Flash")+15));
releaseVer = parseInt(ver.substr(ver.indexOf("r")+1,ver.length));
ver = parseInt(ver.substr(0,ver.indexOf("r")));
}
if(((ver == 6)&&(releaseVer >= 40))||(ver > 6))
return(ver);
else
return 0;
}
function getIEFlash()
{
var obj = "ShockwaveFlash.ShockwaveFlash.";
var ver = 7.0;
var found = false;
while ((false == found) && (ver > 0))
{
found = true;
try
{
var obj = new ActiveXObject(obj+ver);
}
catch (e)
{
found = false;
ver --;
}
}
return(ver);
}
function getAudioVer()
{
if (browser.isIE())
return (1);
else
return(0);
}
}
function ebCBWDetector(objName)
{
this.nValue=0;
this.dtStart=null;
this.dtCookieTime=null;
this.nImageSize = EB_BANNER_BW_IMG_SIZE * 8;
this.strImage = EB_BANNER_BW_IMG;
this.objName = objName;
this.start = start;
this.detect = detect;
this.init = initBWDetector;
function initBWDetector()
{
gEbDbg.info("Initializing BandWidth detector info");
readCookie(this);
start(this);
}
function detect()
{
try{
var dtEnd = new Date().getTime();
var dtDelta = parseInt(dtEnd) - parseInt(this.dtStart);
this.nValue = this.nImageSize / dtDelta * 1000 ;
this.nValue = parseInt(this.nValue);
gEbDbg.always("Bandwidth was detected : " + this.nValue + "KBitsPerSec" );
this.dtCookieTime = dtEnd;
setCookie(this);
if(typeof(ebBWDetectCB) != 'undefined')
ebBWDetectCB();
}catch(e)
{
gEbDbg.fatal("ebCBWDetector.detect : " + e.description );
}
}
function start(objRef)
{
if (typeof(gfEbActiveXPreview) != "undefined")
{
gEbDbg.attention("ebCBWDetector - start is ignored in ActiveX PREVIEW");
return;
}
var dtNow = new Date().getTime();
var dtDelta = parseInt(dtNow) - parseInt(objRef.dtCookieTime);
gEbDbg.info("dtDelta " + dtDelta);
var minDelta = 8*60*60*1000; 
if(dtDelta < minDelta)
{
gEbDbg.info("only " + dtDelta/1000/60/60 + " hours passed from last detection, do not perform again.");
return;
}
if(typeof(objRef) == 'undefined')
objRef = this;
objRef.dtStart = new Date().getTime();
var randnum = new String(Math.random());
randnum = randnum.substr(randnum.indexOf(".")+1);
var src = objRef.strImage;
var TIobj = new ebCTIObj("");
TIobj.src = src;
TIobj.style.width = "0px";
TIobj.style.height = "0px";
TIobj.onload = "ebBannerBWDetectHandler()";
gEbTI.addImage("write" , TIobj);
}
function readCookie(objRef)
{
var bwCookie = gEbClientInfo.cookieInfo.getBandWidth();
objRef.nValue = bwCookie.substr(0,bwCookie.indexOf(":"));
objRef.dtCookieTime = bwCookie.substr(bwCookie.indexOf(":")+1,bwCookie.length);
if(objRef.nValue == "")
{
objRef.nValue = -1;
objRef.dtCookieTime = 0;
gEbDbg.debug("BandWidth cookie: None");
}
else
gEbDbg.debug("BandWidth cookie: nValue=" + objRef.nValue + " dtCookieTime=" +objRef.dtCookieTime);
}
function setCookie(objRef)
{
var bwCookie = objRef.nValue + ":" + objRef.dtStart;
gEbClientInfo.cookieInfo.setBandWidth(bwCookie);
}
}
function ebCCookie(domain)
{
try{
var strGCookie; 
var dtExpires; 
var strDomain="";
if(typeof(domain) != "undefined" && (domain != ""))
{
if(domain.indexOf(".") > 0)
{
strDomain += ".";
}
strDomain += domain;
}
else
{
strDomain = "." + document.location.hostname; 
}
}catch(e)
{
gEbDbg.error("ebCCookie: " + e.description);
}
var fValidDomain; 
var strPath = "/"; 
var strCookNamePrefix = "eb";
var strHistCookName = "NewHistory";
var strDbgCookName = "DebugLevel";
var strBWCookName = "BandWidth";
var strReadyAdCookName = "ReadyAd";
var strReadyAdTypeCookName = "ReadyAdType";
var strBurstingTimeCookName = "BurstingTime";
var strInvitationTimeCookName = "InvitationTime";
var strDebugLevel="";
var strNewHistory="";
var strBandWidth="";
var strReadyAd = "";
var strReadyAdType = "";
var strBurstingTime = "";
var strInvitationTime = "";
this.fOptOut = false;
this.init = init;
this.getDomain = function(){return strDomain;};
this.setDomain = setDomain;
this.setDbgLvl = setDebugLvl;
this.setHistory = setHistory;
this.setBandWidth = setBandWidth;
this.setReadyAd = setReadyAd;
this.setReadyAdType = setReadyAdType;
this.setBurstingTime = setBurstingTime;
this.setInvitationTime = setInvitationTime;
this.setOptOut = setOptOut;
this.getDbgLvl = function() {return strDebugLevel;};
this.getHistory = getHistory;
this.getBandWidth = function() {return strBandWidth;};
this.getReadyAd = function() {return strReadyAd;};
this.getReadyAdType = function() {return strReadyAdType;};
this.getBurstingTime = function() {return strBurstingTime;};
this.getInvitationTime = function() {return strInvitationTime;};
function init()
{
gEbDbg.attention("Initializing cookie info");
dtExpires = new Date();
dtExpires.setTime(dtExpires.getTime() + 1000*60*60*24*365);
setDomainValidation(); 
readCookie(); 
parse(this); 
}
function setDebugLvl(lvl)
{
strDebugLevel = lvl;
updateCookie(this,strDbgCookName);
}
function setHistory(hist)
{
strNewHistory = hist;
updateCookie(this,strHistCookName);
}
function setBandWidth(bw)
{
strBandWidth = bw;
updateCookie(this,strBWCookName);
}
function setReadyAd(adCookie)
{
strReadyAd = adCookie;
updateCookie(this,strReadyAdCookName);
}
function setReadyAdType(type)
{
strReadyAdType = type;
updateCookie(this,strReadyAdTypeCookName);
}
function setBurstingTime(time)
{
strBurstingTime = time;
updateCookie(this,strBurstingTimeCookName);
}
function setInvitationTime(time)
{
strInvitationTime = time;
updateCookie(this,strInvitationTimeCookName);
}
function setOptOut(fOptOut)
{
if(fOptOut)
{
deleteCookie(strHistCookName);
deleteCookie(strBWCookName);
deleteCookie(strReadyAdCookName);
deleteCookie(strReadyAdTypeCookName);
deleteCookie(strBurstingTimeCookName);
deleteCookie(strInvitationTimeCookName);
strGCookie = "";
}
this.fOptOut = (fOptOut == 1);
}
function getHistory()
{
this.init();
return(strNewHistory);
}
function setDomain(domain)
{
if(domain.indexOf(".") > 0)
{
domain = "." + domain;
}
strDomain = domain;
}
function readCookie()
{
strGCookie = document.cookie;
gEbDbg.debug2(strGCookie);
}
function parse(objRef)
{
strDebugLevel = unescape(getCookie(strDbgCookName));
strNewHistory = unescape(getCookie(strHistCookName));
strBandWidth = unescape(getCookie(strBWCookName));
strReadyAd = unescape(getCookie(strReadyAdCookName));
strReadyAdType = unescape(getCookie(strReadyAdTypeCookName));
strBurstingTime = unescape(getCookie(strBurstingTimeCookName));
strInvitationTime = unescape(getCookie(strInvitationTimeCookName));
gEbDbg.attention("strBandWidth: " + strBandWidth);
gEbDbg.attention("strReadyAd: " + strReadyAd);
gEbDbg.attention("strReadyAdType: " + strReadyAdType);
gEbDbg.attention("strBurstingTime: " + strBurstingTime);
gEbDbg.attention("strInvitationTime: " + strInvitationTime);
}
function getCookie(name)
{
name = strCookNamePrefix + name + '_' + strDomain;
var start = strGCookie.indexOf(name + "=");
if (start == -1)
return("");
start += name.length + 1;
var end = strGCookie.indexOf(';',start);
if (end == -1)
end = strGCookie.length;
var cookieVal = strGCookie.substring(start,end);
return(cookieVal);
}
function updateCookie(objRef,name)
{
if(objRef.fOptOut && (name != strDbgCookName))
{
gEbDbg.info("updateCookie: the user is opt-out therfore the cookie will not be set");
return;
}
var strCookie = strCookNamePrefix + name + '_' + strDomain + '=' + escape(eval("str" + name ));
strCookie += ";expires=" + dtExpires.toGMTString();
strCookie += "; path=" + strPath;
if(fValidDomain)
strCookie += "; domain=" + strDomain;
document.cookie = strCookie;
}
function setDomainValidation()
{
if((strDomain != null)&&(strDomain != 'undefined'))
{
var domainParts = strDomain.split(".");
if(domainParts.length < 3)
fValidDomain = 0;
else
fValidDomain = 1;
}
else
fValidDomain = 0;
gEbDbg.info("setDomainValidation: strDomain=" + strDomain + " valid:" + fValidDomain);
}
function deleteCookie(name)
{
var dtNow = new Date();
var strCookie = strCookNamePrefix + name + '_' + strDomain + '=""' ;
strCookie += ";expires=" + dtNow.toGMTString();
strCookie += "; path=" + strPath;
if(fValidDomain)
strCookie += "; domain=" + strDomain;
var strTmpCookie = eval("str" + name );
strTmpCookie = "";
document.cookie = strCookie;
}
}
function ebCHistItem()
{
this.nFlight=0;
this.dtNextDisplay=null;
this.nFlightDisplays=0;
this.dtLastDay=null;
this.nLastDaydisplys=0;
this.update = update;
this.copy = copy;
this.set = set;
this.getDateAsStr = getDateAsStr;
this.isToday = isToday;
function update(interval,currentTime)
{
if(typeof(currentTime) == 'undefined')
this.dtNextDisplay = new Date();
else
this.dtNextDisplay = currentTime;
this.dtNextDisplay = this.dtNextDisplay.getTime() + parseInt(interval);
this.nFlightDisplays ++;
updateLastDay(this);
gEbDbg.info("Next display of Flight " + this.nFlight + " is : " + this.getDateAsStr(this.dtNextDisplay,true));
}
function set(flight,time,displays,date,impForDate)
{
this.nFlight = flight;
this.dtNextDisplay = time;
this.nFlightDisplays = displays;
this.dtLastDay = date;
this.nLastDaydisplys = impForDate;
gEbDbg.debug("Set history item :<br>" +
" flight : " + this.nFlight + "<br>" +
" dtNextDisplay : " + getDateAsStr(this.dtNextDisplay,false) + "<br>" +
" nFlightDisplays : " + this.nFlightDisplays + "<br>" +
" dtLastDay : " + getDateAsStr(this.dtLastDay,false) + "<br>" +
" nLastDaydisplys : " + this.nLastDaydisplys + "<br>"
);
}
function copy(item)
{
this.nFlight = item.nFlight;
this.dtNextDisplay = item.dtNextDisplay;
this.nFlightDisplays = item.nFlightDisplays;
this.dtLastDay = item.dtLastDay;
this.nLastDaydisplys = item.nLastDaydisplys;
}
function isToday(day)
{
if (typeof(day) == "undefined")
day = this.dtLastDay;
try{
var strDay = getDateAsStr(day,false);
var strToday = getDateAsStr(new Date(),false);
return(strDay == strToday);
}catch(e)
{
gEbDbg.error("ebCHistItem.isToday: " + e.description);
return false;
}
}
function updateLastDay(objRef)
{
if(objRef.isToday())
{
objRef.nLastDaydisplys ++;
gEbDbg.info("user has impressions today, increase by 1: (" + objRef.nLastDaydisplys + ")");
}
else
{
objRef.dtLastDay = new Date().getTime();
objRef.nLastDaydisplys = 1;
gEbDbg.info("user has No impressions today, set to 1");
}
}
function getDateAsStr(day,fTime)
{
var dtDay = new Date();
dtDay.setTime(day);
var strDate = dtDay.getDate() + "/" + (parseInt(dtDay.getMonth())+1) + "/" + dtDay.getYear();
if(fTime)
strDate += "(" + getTimeAsStr(dtDay) + ")";
return strDate;
}
function getTimeAsStr(dtDay)
{
var strTime = dtDay.getHours() + ":" + dtDay.getMinutes() + ":" + dtDay.getSeconds();
return strTime;
}
}
function ebCHistory()
{
this.items=null;
this.nLength=0;
this.setCookie = setCookie;
this.getItem = getItem;
this.setLength = setLength;
this.update = update;
this.init = init;
this.getNotAllowedList = getNotAllowedList;
function getItem(flightId)
{
gEbDbg.debug("getItem( "+flightId+" )");
var items = this.items;
if (items == null)
return (null);
var i=0;
while (i < items.length)
{
var item = items[i];
if (item.nFlight == parseInt(flightId))
{
gEbDbg.debug("getItem: item "+flightId+" found");
return(item);
}
if (item.nFlight > parseInt(flightId))
return(null);
i++;
}
gEbDbg.debug("getItem: item "+flightId+" wasn't found length="+items.length);
return(null); 
}
function setLength(nLength)
{
gEbDbg.debug("ebCHistory.setLength(" + nLength + ")" );
this.nLength = nLength;
}
function setCookie()
{
var items = this.items;
if (items == null)
return;
var cookieVal = "";
if (items.length > this.nLength)
{
gEbDbg.debug("there are more items on the array then the history length - trancate");
trancate(this);
}
gEbDbg.info("Updating history cookie");
gEbDbg.info("=============================================");
gEbDbg.info("History cookie:");
var item;
for (var i=0; i<items.length; i++)
{
item = items[i];
if (item.nFlight != -1)
{
if (cookieVal != "")
cookieVal += "&";
cookieVal += item.nFlight + ":" + item.dtNextDisplay + ":" + item.nFlightDisplays + ":" + item.dtLastDay + ":" + item.nLastDaydisplys;
if(item.isToday())
gEbDbg.info(item.nFlight + " : [" + item.getDateAsStr(item.dtNextDisplay ,true) + "] : (" + item.nFlightDisplays + ") Today: " + item.nLastDaydisplys);
else
gEbDbg.info(item.nFlight + " : [" + item.getDateAsStr(item.dtNextDisplay ,true) + "] : (" + item.nFlightDisplays + ") Today: 0");
}
}
gEbDbg.info("=============================================");
gEbClientInfo.cookieInfo.setHistory(cookieVal);
gEbDbg.info("update done");
}
function update(flightId,interval,currentTime)
{
this.init();
if(typeof(currentTime) == "undefined")
currentTime = new Date();
var item = this.getItem(flightId);
if (item == null)
{
var time = currentTime.getTime() + parseInt(interval);
newItem(this,flightId,time);
}
else
item.update(interval,currentTime);
this.setCookie();
}
function init()
{
this.items = new Array();
load(this);
}
function newItem(objRef,flight,time)
{
var items = objRef.items;
var oldLength = 0;
if (items == null)
items = new Array();
else
oldLength = items.length;
items[oldLength] = new ebCHistItem();
var index=0;
while (index < oldLength)
{
if (items[index].nFlight > flight)
break;
index++;
}
for (var i=oldLength; i>index; i--)
items[i].copy(items[i-1]);
var dtCurTime = new Date().getTime();
items[index].set(flight,time,1,dtCurTime,1);
}
function trancate(objRef,curLength)
{
gEbDbg.info("ebTrancateHistory(" + curLength + ")");
var length = objRef.nLength;
var items = objRef.items;
if( typeof(curLength) == 'undefined')
curLength = items.length;
if (length == 0)
{
objRef.items.length = 0;
return;
}
if (curLength <= length)
return;
var index = -1;
var smallestT = 0;
for (var i=0; i<curLength; i++)
{
var item = items[i];
if (item.nFlight != -1) 
{
if ((item.dtNextDisplay < smallestT) || (index == -1))
{
smallestT = item.dtNextDisplay;
index = i;
}
}
}
gEbDbg.info("ebTrancateHistory() - removing flight id " + items[index].nFlight);
items[index].nFlight = -1; 
trancate(objRef,curLength-1);
}
function load(objRef)
{
var items = objRef.items;
var histCookie = gEbClientInfo.cookieInfo.getHistory();
gEbDbg.info("Loading History Cookie: " + histCookie);
tmp = histCookie.split('&');
if (tmp == "")
return;
for (i=0; i<tmp.length; i++)
{
tmp[i] = tmp[i].split(':');
tmp[i][1] = unescape(tmp[i][1]);
items[i] = new ebCHistItem();
items[i].set(tmp[i][0],tmp[i][1],tmp[i][2],tmp[i][3],tmp[i][4]);
}
gEbDbg.info("there are " + items.length + " items in the history");
}
function getNotAllowedList()
{
var dtNow = new Date().getTime();
var strNotAllowed = "";
var items = this.items;
var i=0;
while (i < items.length)
{
var item = items[i];
if (item.dtNextDisplay > dtNow)
{
if(strNotAllowed == "")
strNotAllowed = item.nFlight;
else
strNotAllowed += "," + item.nFlight;
}
i++;
}
gEbDbg.info("the not allowed flights from the user history are: " + strNotAllowed);
return (strNotAllowed);
}
}
function ebCRemoteServers()
{
this.strNUrl = ""; 
this.strAUrl = "" 
this.strAReportUrl = ""; 
this.strNReportUrl = ""; 
this.aReportingImg = null; 
this.nReportingImg = null; 
this.set = set;
this.report = report;
this.update = update;
this.replaceConsts = replaceConsts;
function set(strRS)
{
try{
var agencyUrl = "";
var networkUrl = "";
var agencyIndex = strRS.indexOf("ebA=");
var networkIndex = strRS.indexOf("ebN=",agencyIndex);
if (agencyIndex != -1)
{
agencyIndex += 4;
if (networkIndex != -1)
agencyUrl = strRS.substr(agencyIndex, networkIndex - agencyIndex - 1);
else
agencyUrl = strRS.substr(agencyIndex,strRS.length - agencyIndex-1);
}
if (networkIndex != -1)
{
networkIndex += 4;
networkUrl = strRS.substr(networkIndex,strRS.length - networkIndex - 1);
}
this.strAUrl = agencyUrl;
this.strNUrl = networkUrl;
gEbDbg.debug("RS -> agency : " + this.strAUrl + " network : " + this.strNUrl);
}
catch (e) {gEbDbg.fatal("RS.set : " + e.description)}
}
function update(adminRS)
{
if (this.strNUrl == "")
this.strNUrl = adminRS.strNUrl;
if (this.strAUrl == "")
this.strAUrl = adminRS.strAUrl;
gEbDbg.debug("RS update -> agency : " + this.strAUrl + " network : " + this.strNUrl);
}
function report(adData,interactionNum, interactionName)
{
try{
if(gEbfOfflineDemo)
{
gEbDbg.warning("ebCRemoteServers.report: offline demo there will be no report ");
return;
}
gEbDbg.info("Remote Server Report:");
strRand = adData.strRand;
nIndex = adData.nIndex;
this.strNReportUrl = this.strNUrl;
this.strAReportUrl = this.strAUrl;
addRand(this,strRand);
if (typeof(interactionNum) != "undefined")
this.replaceConsts(interactionNum,interactionName);
if (this.strNReportUrl != "")
{
gEbDbg.info("Remote Server Report: calling Network Remote Server : " + this.strNReportUrl);
this.nReportingImg = new Image();
this.nReportingImg.src = this.strNReportUrl;
}
if (this.strAReportUrl != "")
{
gEbDbg.info("Remote Server Report: calling Agency Remote Server : " + this.strAReportUrl);
this.aReportingImg = new Image();
this.aReportingImg.src = this.strAReportUrl;
}
}catch(e)
{
gEbDbg.error("RS.report: " + e.description);
}
}
function addRand(objRef,strRand)
{
objRef.strNReportUrl = objRef.strNReportUrl.replace(/\[ebRandom\]/ig,strRand);
objRef.strNReportUrl = objRef.strNReportUrl.replace(/\[timestamp\]/ig,strRand);
objRef.strAReportUrl = objRef.strAReportUrl.replace(/\[ebRandom\]/ig,strRand);
objRef.strAReportUrl = objRef.strAReportUrl.replace(/\[timestamp\]/ig,strRand);
}
function replaceConsts(interactionNum,name)
{
try{
if (this.strNReportUrl != "")
{
this.strNReportUrl = this.strNReportUrl.replace(/\[ebInteraction\]/ig,name);
this.strNReportUrl = this.strNReportUrl.replace(/\[ebInteractionNum\]/ig,interactionNum);
}
if (this.strAReportUrl != "")
{
this.strAReportUrl = this.strAReportUrl.replace(/\[ebInteraction\]/ig,name);
this.strAReportUrl = this.strAReportUrl.replace(/\[ebInteractionNum\]/ig,interactionNum);
}
}catch(e)
{
gEbDbg.error("replaceConsts: " + e.description);
}
}
}
function ebCInteractionsList()
{
this.nNumInteractions = 0;
this.fClicked = 0;
this["_eyeblaster"] = new ebCInteraction("_eyeblaster",0);
}
function ebCInteraction(strName,nType,objName)
{
var strInteractionPipe = "http://" + ebBS + "/BurstingPipe/BurstingInteractionsPipe.asp";
var charAdFieldsDelimeter = '~';
var charIntDelimeter = '^';
this.nType = 0; 
if(typeof(nType) != "undefined")
this.nType = nType;
this.nValue = 0;
this.nStartTime = 0;
this.strName = strName;
this.fCloseFlag = 1;
this.strJumpUrl = "";
this.strTarget = "_blank";
this.RS = new ebCRemoteServers();
this.fCountAsClick = 1;
this.jumpWin = new ebCJumpWin();
this.fShouldReport = true;
this.fIsBusy = false; 
this.strReportURL = ""; 
this.objName = objName;
this.adData = null;
this.reportingImg = null; 
this.update = update;
this.print = print;
this.redirect = redirect;
this.getReportData = getReportData;
this.getAdReportData = getAdReportData;
this.getPipeUrl = function(){return strInteractionPipe;};
this.setType = setInteractionType;
if(this.nType == 0)
this.handle = handleCounter;
else
this.handle = handleTimer;
function update(inter)
{
gEbDbg.debug("updating interaction : " + this.strName)
try {
this.nType = inter.nType;
this.fCloseFlag = inter.fCloseFlag;
this.strJumpUrl = inter.strJumpUrl;
this.strTarget = inter.strTarget;
this.fCountAsClick = inter.fCountAsClick;
this.jumpWin.strPosX = inter.jumpWin.strPosX;
this.jumpWin.strPosY = inter.jumpWin.strPosY;
this.jumpWin.strWidth = inter.jumpWin.strWidth;
this.jumpWin.strHeight = inter.jumpWin.strHeight;
this.jumpWin.strAddressBar = inter.jumpWin.strAddressBar;
this.jumpWin.strMenuBar = inter.jumpWin.strMenuBar;
this.fShouldReport = inter.fShouldReport;
this.RS.update(inter.RS);
}
catch (e) { gEbDbg.fatal("Update interaction : " + this.strName + " Failed (" + e.description + ")")};
}
function print()
{
gEbDbg.info("interaction " + this.strName + "<br>" +
"close flag : " + this.fCloseFlag + "<br>" +
"jump URL : " + this.strJumpUrl + "<br>" +
"target : " + this.strTarget + "<br>" +
"network URL : " + this.RS.strNUrl + "<br>" +
"agency URL : " + this.RS.strAUrl + "<br>" +
"count as click : " + this.fCountAsClick + "<br>" +
"jumpWin.strPosX : " + this.jumpWin.strPosX + "<br>" +
"jumpWin.strPosY : " + this.jumpWin.strPosY + "<br>" +
"jumpWin.strWidth : " + this.jumpWin.strWidth + "<br>" +
"jumpWin.strHeight : " + this.jumpWin.strHeight + "<br>" +
"jumpWin.strAddressBar : " + this.jumpWin.strAddressBar + "<br>" +
"jumpWin.strMenuBar : " + this.jumpWin.strMenuBar + "<br>" +
"fShouldReport : " + this.fShouldReport + "<br>" +
"nType : " + this.nType + "<br>" +
"nValue : " + this.nValue + "<br>" +
"nStartTime : " + this.nStartTime + "<br>" );
}
function handleCounter(interactionNum,isClick,adData,fReportImmediatly)
{
try{
if(this.nType == 1)
{
gEbDbg.error("handleCounter was called on a timer interaction (" + this.strName + ")");
return;
}
gEbDbg.debug("handle counter interaction");
if(this.fIsBusy)
{
gEbDbg.attention("the interaction " + this.strName + " is busy");
return;
}
this.fIsBusy = true;
if(typeof(adData) != 'undefined')
this.adData = adData;
else
gEbDbg.warning("ebCInteraction.handleCounter: adData is undefined");
if (ebIsPreview())
{
this.redirect();
}
else
{
if (typeof(gEbAdWindow) != "undefined")
this.strTarget = "_blank";
buildUrl(this,isClick,fReportImmediatly);
if (this.strTarget != "_blank")
{
gEbDbg.debug("target=current window <br> report All and wait before redirect");
reportAll(this,interactionNum,fReportImmediatly);
var strFunc = this.objName + ".redirect();";
window.setTimeout(strFunc,1000);
}
else
{
gEbDbg.debug("target = _blank");
this.redirect();
reportAll(this,interactionNum,fReportImmediatly);
}
}
this.fIsBusy = false;
}catch(e)
{
gEbDbg.error("handleCounter: " + e.description);
}
return(this.fClose);
}
function handleTimer(command,adData,nValue)
{
if(this.nType == 0)
{
gEbDbg.error("handleTimer was called on a counter interaction (" + this.strName + ")");
return;
}
gEbDbg.debug("handle a timer interaction");
if(typeof(adData) != 'undefined')
this.adData = adData;
else
gEbDbg.warning("ebCInteraction.handleTimer: adData is undefined");
switch(command)
{
case 1: 
if(this.nStartTime != 0)
{
gEbDbg.warning("start timer: " + this.strName + " - allready started, Ignore");
return;
}
this.nStartTime = new Date().getTime();
break;
case 2: 
if(this.nStartTime == 0)
{
if(this.nValue == 0)
gEbDbg.warning("end timer: " + this.strName + " - not started yet, Ignore");
else
gEbDbg.warning("end timer: " + this.strName + " - allready stopped, Ignore");
return;
}
var dtNow = new Date().getTime();
this.nValue += (dtNow - this.nStartTime);
this.nStartTime = 0;
gEbDbg.info("end timer " + this.strName + " value is: " + this.nValue);
break;
case 3: 
if((typeof(nValue) != "undefined") && !isNaN(nValue))
{
this.nValue += nValue;
gEbDbg.info("update timer " + this.strName + " was update by " + nValue);
}
else
gEbDbg.error("update timer " + this.strName + " not a valid value");
gEbDbg.info("update timer " + this.strName + " value is: " + this.nValue);
break;
}
}
function redirect()
{
if (ebIsPreview())
{
gEbDbg.attention("Preview: set target to _blank");
this.strTarget = "_blank";
}
gEbDbg.attention("redirect: redirection on " + this.strTarget + " : " + this.strJumpUrl);
var prop = "titlebar=1,resizable=1,scrollbars=1,directories=0,toolbar=1,location=" + this.jumpWin.strAddressBar;
prop += ",menubar=" + this.jumpWin.strMenuBar;
prop += ",left=" + this.jumpWin.strPosX;
prop += ",top=" + this.jumpWin.strPosY;
if (this.jumpWin.strWidth != 0)
prop += ",width=" + this.jumpWin.strWidth;
if (this.jumpWin.strHeight != 0)
prop = prop + ",height=" + this.jumpWin.strHeight;
if(this.strJumpUrl != "")
checkUrl(this);
if(this.strJumpUrl != "")
{
addRand(this,this.adData.strRand);
if(gEbfOfflineDemo)
{
this.strJumpUrl = this.adData.strDemoFolder + this.strName + ".htm";
}
gEbDbg.attention("redirect: redirection on " + this.strTarget + " : " + this.strJumpUrl);
gEbDisplayPage.TI.win.open(this.strJumpUrl,this.strTarget,prop);
}
}
function getReportData(isClick)
{
var strReportingName = this.strName;
strReportingName = strReportingName.replace(/\~/ig,"_");
strReportingName = strReportingName.replace(/\^/ig,"_");
strReportingName = strReportingName.replace(/\|/ig,"_");
var strReportData =
charIntDelimeter + strReportingName + 
charAdFieldsDelimeter + parseInt(this.nValue/1000) + 
charAdFieldsDelimeter + isClick;
return strReportData;
}
function getAdReportData(adData)
{
try
{
if(typeof(adData) == "undefined")
adData = this.adData;
else
this.adData = adData;
var strPage = adData.strPage;
if(!adData.fWebPageSource)
{
if(!adData.fCollectWebPages)
strPage = "UnSpecified";
}
var strReportingPage = strPage;
strReportingPage = strReportingPage.replace(/\~/ig,"_");
strReportingPage = strReportingPage.replace(/\^/ig,"_");
strReportingPage = strReportingPage.replace(/\|/ig,"_");
var strAdReportData =
adData.nAdID +
charAdFieldsDelimeter + strReportingPage + 
charAdFieldsDelimeter + ebPluID;
return strAdReportData;
}
catch(e)
{
gEbDbg.error("exception on getAdReportData: " + e.description);
return "";
}
}
function buildUrl(refObj,isClick,fReport)
{
try
{
var pendingInter = refObj.adData.strPendingInteractions;
if(fReport)
{
var str = refObj.getAdReportData() + refObj.getReportData(isClick) + pendingInter;
refObj.strReportURL = strInteractionPipe + "?interactionsStr=" + escape(str) +
"&ebRandom=" + Math.random();
gEbDbg.debug("linkURL: " + refObj.strReportURL);
pendingInter = "";
}
else
{
pendingInter += refObj.getReportData(isClick);
gEbDbg.info("buildUrl: do not report, add the interaction to the pending interactions list" );
gEbDbg.attention("strPendingInteractions: " + pendingInter );
}
refObj.adData.strPendingInteractions = pendingInter;
}
catch(e)
{
gEbDbg.error("exception on buildUrl: " + e.description);
}
}
function setInteractionType(nType)
{
this.nType = nType;
if(this.nType == 0)
this.handle = handleCounter;
else
this.handle = handleTimer;
}
function addRand(objRef,strRand)
{
objRef.strJumpUrl = objRef.strJumpUrl.replace(/\[ebRandom\]/ig,strRand);
objRef.strJumpUrl = objRef.strJumpUrl.replace(/\[timestamp\]/ig,strRand);
}
function checkUrl(objRef)
{
if ((objRef.strJumpUrl.indexOf("http://") == -1) &&
(objRef.strJumpUrl.indexOf("https://") == -1) &&
(objRef.strJumpUrl.indexOf("ftp://") == -1) &&
(objRef.strJumpUrl.indexOf("aim:") == -1) &&
(objRef.strJumpUrl.indexOf("mailto:") == -1))
{
if (objRef.strJumpUrl.indexOf("/") == 0)
objRef.strJumpUrl = "http://" + document.location.hostname + objRef.strJumpUrl;
else
objRef.strJumpUrl = "http://" + objRef.strJumpUrl;
}
}
function reportAll(objRef,interactionNum,fReporToPipe)
{
if(gEbfOfflineDemo)
{
gEbDbg.warning("ebcinteraction.reportAll: offline demo there will be no report ");
return;
}
gEbDbg.debug("reportAll ");
if(fReporToPipe)
{
gEbDbg.info("Report to interaction pipe");
objRef.reportingImg = new Image();
objRef.reportingImg.src = objRef.strReportURL;
}
else
gEbDbg.info("reportAll: Do Not Report to interaction pipe");
gEbDbg.info("Report to remote servers");
objRef.RS.report(objRef.adData,interactionNum,objRef.strName);
}
}
function ebCJumpWin()
{
this.strPosX = "";
this.strPosY = "";
this.strWidth = "";
this.strHeight = "";
this.strAddressBar = "";
this.strMenuBar = "";
}
function ebCClientInfo(name,domain)
{
this.strObjName = name; 
this.cookieInfo = new ebCCookie(domain);
this.pluginInfo = new ebCPlugin(this.strObjName + ".pluginInfo");
this.history = new ebCHistory();
this.init = initClientInfo;
function initClientInfo()
{
this.cookieInfo.init();
var nDbgLvl = parseInt(gEbClientInfo.cookieInfo.getDbgLvl());
if (!isNaN(nDbgLvl))
{
gEbDbg.setDbgLvl(nDbgLvl);
}
gEbDbg.always("<BR>");
gEbDbg.always("====================================================================");
gEbDbg.always("====================================================================");
gEbDbg.always(" EYEBLASTER DEBUG");
gEbDbg.always("====================================================================");
gEbDbg.always("====================================================================");
gEbDbg.info("Initializing client info");
this.pluginInfo.init();
this.history.init();
}
}
function ebCAdData(nIndex,strBannerRef)
{
this.nIndex = nIndex;
this.strBannerRef = strBannerRef;
this.nFlightID = -1;
this.nAdID = -1;
this.fTest = false;
this.strLogID = "";
this.strAdUrl = "";
this.strTemplateName = "";
this.strBlankUrl = "";
this.nDownloadMode = 1;
this.strPage = "";
this.fPromptForPlugins = false;
this.strRand = ""
this.nWidth = 0;
this.nHeight = 0;
this.fWebPageSource = 0;
this.fShowOnlyImage = false;
this.nLowBWLimit = -1;
this.playRS = new ebCRemoteServers();
this.nImpressions = -1; 
this.bannerPos = new Object();
this.bannerPos.nType = -1;
this.bannerPos.strBannerName = "";
this.bannerPos.strAlternateBanner = "";
this.strAdType = "";
this.nSiteInterval = 0;
this.nFlightInterval = 0;
this.nSiteID = "-1";
this.strKeyword = "";
this.fAdFromCookie = false;
this.fDownloadOnly = false;
this.nRightAlignment = -1;
this.fCountIntDuration = false;
this.strPendingInteractions = ""; 
this.strInvitationUrl = "";
this.nInvitationWidth = -1;
this.nInvitationHeight = -1;
this.nSurveyID = -1;
this.strInvitationBannerUrl = "";
this.fCollectWebPages = true;
this.strOnStartDnl = "";
this.strOnPlay = "";
this.strDemoFolder = "";
init(this);
function init(obj)
{
var strRand = new String(Math.random());
obj.strRand = strRand.substr(strRand.indexOf(".")+1);
}
}
function ebCServerRequest(strObjRef)
{
this.nCode = 7;
this.flAudioVer = gEbClientInfo.pluginInfo.flAudioVer;
this.flFlashVer = gEbClientInfo.pluginInfo.flFlashVer;
this.nPlatform = 0;
this.nBrowser = 0;
this.nRes = 0;
this.strObjRef = strObjRef;
this.fForceDisplay = 0;
this.fTest = 0;
init(this);
this.sendRequest = sendRequest;
function sendRequest(nCode,adData)
{
if(gEbfOfflineDemo)
{
gEbDbg.warning("ebCServerRequest.sendRequest: offline demo there will be no report ");
return;
}
var strMethod = "";
if(nCode == 7)
{
if ((adData.nWidth == 0) || (adData.nHeight == 0))
{
gEbDbg.fatal( "At least one of the following properties were not set : nWidth/nHeight");
return;
}
if ((adData.nFlightID == -1) && !ebIsPreview()) 
{
gEbDbg.fatal( "FlightID was not set");
return;
}
if ((adData.nFlightID == -1) && (adData.nAdID == -1))
{
gEbDbg.fatal( "FlightID and AdID ware not set");
return;
}
strMethod = "write";
}
else
{
if((nCode == 9)&&(adData.nDownloadMode != 1))
strMethod = "write";
else
strMethod = "append";
}
var strReq;
if(nCode == 10)
strReq = buildSuccessReq(this,adData);
else
strReq = buildRequest(this,nCode,adData);
if(strReq != "")
send(strReq,strMethod);
}
function init(obj,adData)
{
var bc = new ebCBrowserCheck();
obj.nPlatform = bc.getEbPlatform();
obj.nBrowser = bc.getEbBrowser();
switch(window.screen.width)
{
case 640:
obj.nRes = 1;
break;
case 800:
obj.nRes = 2;
break;
case 1024:
obj.nRes = 4;
break;
case 1152:
obj.nRes = 8;
break;
case 1280:
obj.nRes = 16;
break;
case 1600:
obj.nRes = 32;
break;
}
if (ebIsPreview())
obj.fForceDisplay = 1;
}
function send (req,method)
{
gEbDbg.attention( "Server Request :");
gEbDbg.attention( " " + req.replace(/</g,"<."));
if(typeof(method) == "undefined")
var method = 'write';
var bw = gEbClientInfo.pluginInfo.bandWidth;
var nBandWidth = bw.nValue;
var dtNow = new Date().getTime(); 
var nDelta = dtNow - bw.dtCookieTime; 
if (nBandWidth != -1)
gEbDbg.attention( " BandWidth : " + nBandWidth + "Kbit/Sec (Delta time : " + nDelta + "msec)");
else
gEbDbg.attention( " BandWidth : UnDetected");
var ebRand = "&ord=" + Math.random();
var src = 'http://' + ebBS + '/BurstingPipe/AdServerPipe.asp?param=' + escape(req) +
ebRand +
"&CSVersion=" + nEbCSVersion;
if (nBandWidth != -1)
src = src + "&BWVal=" + nBandWidth + "&BWDTime=" + nDelta;
gEbDbg.debug(src);
gEbTI.addScript(method,src);
}
function buildRequest(reqObj,nCode,adData)
{
var plugins = "<Type:Plugin;AudioVersion:" + reqObj.flAudioVer +
";FlashVersion:" + reqObj.flFlashVer +
";Platform:" + reqObj.nPlatform +
";Browser:" + reqObj.nBrowser +
";Resolution:" + reqObj.nRes + ";>";
var currDate = new Date();
var t = currDate.getTime();
var currTime = currDate.getHours() + currDate.getMinutes()/60.0 + currDate.getSeconds()/60/60;
var req = "<Type:Command;Code:" + nCode +
";objRef:" + adData.strBannerRef;
var histItem = null;
var strNotAllowedList = "";
if (adData.nFlightID != -1) 
{
req = req + ";FlightID:" + adData.nFlightID;
histItem = gEbClientInfo.history.getItem(adData.nFlightID);
}
else
{
strNotAllowedList = gEbClientInfo.history.getNotAllowedList();
gEbDbg.debug( "OOB - not allowed list: " + strNotAllowedList);
if((adData.nSiteID != "-1") && (adData.strKeyword != '')) 
{
adData.nAdID = -1;
gEbDbg.attention("buildRequest: eyeblaster will be choosen by keywords: KeyWord="+adData.strKeyword + " , siteId=" + adData.nSiteID);
req = req + ";Keywords:" + escapeCharacters(adData.strKeyword) +
";SiteID:" + adData.nSiteID;
}
else
{
if(!((adData.nAdID != -1) && ebIsPreview())) 
{
gEbDbg.warning("buildRequest: no valid tags combination, no request will be sent to the server (might be iframe tags with document.write for the script tag - in that case it is ok)" );
return "";
}
}
}
if(adData.fTest == true)
req = req + ";AdMode:Test";
if(adData.nAdID != -1)
req = req + ";EyeblasterID:" + adData.nAdID;
if (strNotAllowedList != "")
req = req + ";UserHistory:" + strNotAllowedList;
req = req +
";ForceDisplay:" + reqObj.fForceDisplay +
";TimeOfDay:" + currTime +
";PluID:" + ebPluID;
var page = adData.strPage;
if (page != "")
adData.fWebPageSource = 1;
else
{
adData.strPage = document.location.hostname;
page = adData.strPage;
}
var escapedPage = escapeCharacters(adData.strPage);
req = req +
";Page:" + escapedPage +
";WebPageSource:" + adData.fWebPageSource ;
var strCookInvitationTime = gEbClientInfo.cookieInfo.getInvitationTime();
if(strCookInvitationTime != "")
{
var dtCurrTime = new Date().getTime();
var flTimeSinceInvitation = (parseFloat(dtCurrTime) - parseFloat(strCookInvitationTime))/1000;
req += ";TimeSinceInvitation:" + flTimeSinceInvitation;
}
req += ";>";
var strNumImp = "";
var strNumImpPerDay = "";
if (histItem != null)
{
if (isNaN(histItem.nFlightDisplays))
adData.nImpressions =0;
else
adData.nImpressions = parseInt(histItem.nFlightDisplays);
strNumImp = adData.nFlightID + ":" + histItem.nFlightDisplays + ";";
if (histItem.isToday())
strNumImpPerDay = adData.nFlightID + ":" + histItem.nLastDaydisplys + ";";
}
if (strNumImp != "")
req = req + "<Type:UserImpressions;" + strNumImp + ">";
if (strNumImpPerDay != "")
req = req + "<Type:ImpressionsPerDay;" + strNumImpPerDay + ">";
req += plugins;
return req;
}
function buildSuccessReq(reqObj,adData)
{
if (adData.nImpressions == -1)
{
var histItem = gEbClientInfo.history.getItem(adData.nFlightID);
if(histItem != null)
{
if (isNaN(histItem.nFlightDisplays))
adData.nImpressions =0;
else
adData.nImpressions = parseInt(histItem.nFlightDisplays) - 1; 
}
else
adData.nImpressions =0;
}
var nFlightDisplays = adData.nImpressions + 1;
var req =
"<Type:Command;Code:10.0;PluID:" + ebPluID +
";objRef:" + adData.strBannerRef +
";SiteID:" + adData.nSiteID +
";LogID:" + adData.strLogID +
";EyeblasterID:" + adData.nAdID +
";NumImpressions:" + nFlightDisplays +
";Page:"+ escapeCharacters(adData.strPage) +
";WebPageSource:" + adData.fWebPageSource;
if(adData.nSurveyID != -1)
req += ";Invitation:1;>";
else
req += ";Invitation:0;>";
return req;
}
function escapeCharacters(str)
{
var charToEscape = "/<;>";
var escapedStr="";
for(var i=0;i<str.length;i++)
{
if(charToEscape.indexOf(str.charAt(i)) > -1)
escapedStr = escapedStr + "/" + str.charAt(i);
else
escapedStr = escapedStr + str.charAt(i);
}
escapedStr = escapedStr.replace(/\n/g,"\\n")
return escapedStr;
}
}
function ebCServerResponse()
{
this.setStatus = setStatus;
this.setEye = setEye;
this.setBlankImage = setBlankImage;
this.setLowBWLimit = setLowBWLimit;
this.endRespond = endRespond;
this.setDbgLvl = setDebugLvl;
this.setHistoryLen = setHistoryLen;
this.setEventHandler = setEventHandler;
this.setSiteInterval = setSiteInterval;
this.openPopUpInvitation = openPopUpInvitation;
this.showControlBanner = showControlBanner;
this.ebOptOut = ebOptOut;
function setStatus(nCode,strDesc)
{
if (this.fRequestHandled)
{
gEbDbg.warning("request was already handled for banner " + this.adData.nIndex);
return;
}
gEbDbg.attention("Start server response for banner " + this.adData.nIndex);
this.fShowEye = false;
this.fControlUser = false;
switch (nCode)
{
case 0 :
gEbDbg.attention("Nothing To Display");
break;
case 1 :
gEbDbg.attention("Show Message");
this.fShowEye = true;
break;
case 2 :
gEbDbg.error("Illegal eyeblasterID");
break;
case 3 :
gEbDbg.error("Illegal siteID");
break;
case 4 :
gEbDbg.error("Illegal keyword");
break;
case 5 :
gEbDbg.error("Illegal request");
break;
case 6 :
gEbDbg.error("Illegal command");
break;
case 7 :
gEbDbg.error("Site service state OFF");
break;
case 8 :
gEbDbg.error("Internal Error");
break;
case 9 :
gEbDbg.error("Illegal flightID");
break;
case 10 :
gEbDbg.error("ObjRef does not exist");
break;
case 11 :
gEbDbg.always("Control Impression");
this.fControlUser = true;
break;
case 99 :
gEbDbg.error("Server is busy");
break;
}
gEbDbg.debug(strDesc);
}
function setEye(strLogID,nAdID,nFlightID,strAdUrl,strTemplateName,fPromptForPlugins,nFlightInterval,fShowOnlyImage,fCollectWebPages )
{
if (this.fRequestHandled)
return;
gEbDbg.info("flightID : " + nFlightID + " adID : " + nAdID);
gEbDbg.info("TemplateName : " + strTemplateName + " adUrl : " + strAdUrl);
gEbDbg.info("LogID : " + strLogID);
gEbDbg.info("PluginPrompt : " + fPromptForPlugins);
gEbDbg.info("nFlightInterval : " + nFlightInterval);
gEbDbg.info("fShowOnlyImage : " + fShowOnlyImage);
gEbDbg.info("fCollectWebPages : " + fCollectWebPages);
this.adData.nFlightID = nFlightID;
this.adData.nAdID = nAdID;
this.adData.strLogID = strLogID;
this.adData.strAdUrl = strAdUrl;
this.adData.strTemplateName = strTemplateName;
this.adData.fPromptForPlugins = fPromptForPlugins;
this.adData.nFlightInterval = nFlightInterval;
this.adData.fShowOnlyImage = fShowOnlyImage;
this.adData.fCollectWebPages = fCollectWebPages;
}
function setBlankImage(strBlankUrl)
{
if (this.fRequestHandled)
return;
this.adData.strBlankUrl = strBlankUrl;
gEbDbg.warning("Blank image (" + strBlankUrl + ") will be displayed !!!");
var TIobj = new ebCTIObj();
TIobj.src = this.adData.strBlankUrl;
TIobj.width = this.adData.nWidth;
TIobj.height = this.adData.nHeight;
gEbTI.addImage('write',TIobj);
}
function setLowBWLimit(nLimit)
{
gEbDbg.info("Low BW Limit : " + nLimit);
this.adData.nLowBWLimit = nLimit;
}
function endRespond()
{
if (this.fRequestHandled)
return;
gEbDbg.attention("End server response for banner " + this.adData.nIndex);
this.fRequestHandled = true;
if (this.fShowEye && (this.adData.strTemplateName == "ExpBanner"))
{
if ((typeof(gfEbInIframe) != "undefined") && (gfEbInIframe))
{
gEbDbg.always("special treatment for Exp Banner in IFRAME...");
this.loadInnerIframe();
return;
}
}
if (this.fShowEye && (this.adData.strTemplateUrl != ""))
this.loadEye();
if((this.adData.nAdType == 2) || this.fControlUser)
{
if(this.adData.nSurveyID != -1)
{
gEbTI.addEventHandler("unload","ebShowInvitation");
gEbTI.addEventHandler("beforeunload","ebShowInvitation");
gEbDbg.attention("endRespond: set ebShowInvitation as unload event handler");
}
}
}
function setDebugLvl(nLevel)
{
if (this.fRequestHandled)
return;
gEbDbg.debug("Debug Level : " + nLevel);
gEbDbg.setDbgLvl(nLevel);
}
function setHistoryLen(nLen)
{
if (this.fRequestHandled)
return;
gEbDbg.debug("History Length : " + nLen);
gEbClientInfo.history.setLength(nLen);
}
function setEventHandler(event,handler)
{
try{
if (this.fRequestHandled)
return;
switch(event)
{
case "OnImpression" :
gEbDbg.info("OnImpression event :" + handler);
this.adData.strOnPlay = handler;
break;
case "OnStartDownload" :
gEbDbg.info("OnStartDownload event :" + handler);
this.adData.strOnStartDnl = handler;
break;
}
}catch(e)
{
gEbDbg.error("setEventHandler: " + e.description);
}
}
function setSiteInterval(interval)
{
this.adData.nSiteInterval = interval;
}
function openPopUpInvitation(strUrl,nWidth,nHeight,nSurveyID)
{
gEbDbg.attention("openPopUpInvitation:");
gEbDbg.info("strUrl:" + strUrl);
gEbDbg.info("nWidth:"+nWidth);
gEbDbg.info("nHeight:" +nHeight);
gEbDbg.info("nSurveyID:" + nSurveyID);
this.adData.strInvitationUrl = strUrl;
this.adData.nInvitationWidth = nWidth;
this.adData.nInvitationHeight = nHeight;
this.adData.nSurveyID = nSurveyID;
if (this.adData.nAdType == 2)
{
if ((typeof(gfEbInIframe) != "undefined") && (gfEbInIframe))
{
gEbDbg.debug("Not writing invitation time cookie for banners in Iframe");
return;
}
}
var flInvitationCookie = new Date().getTime();
gEbClientInfo.cookieInfo.setInvitationTime(flInvitationCookie);
}
function showControlBanner(strResUrl,nSurveyID)
{
gEbDbg.attention("showControlBanner:");
gEbDbg.info("strResUrl:" + strResUrl);
gEbDbg.info("nSurveyID:"+nSurveyID);
this.adData.strInvitationBannerUrl = strResUrl;
this.adData.nSurveyID = nSurveyID;
var fFlashRes = (strResUrl.indexOf(".swf") != -1);
var TIobj = new ebCTIObj();
TIobj.src = ebResourcePath + strResUrl + "?clickTag=javascript:ebLoadSurvey('" + this.objName + "')";
TIobj.style.width = this.adData.nWidth;
TIobj.style.height = this.adData.nHeight;
TIobj.width = this.adData.nWidth;
TIobj.height = this.adData.nHeight;
TIobj.onclick = "ebLoadSurvey('" + this.objName + "')"; 
TIobj.style='cursor:pointer;cursor:hand';
if(fFlashRes)
gEbTI.addFlash('write',TIobj);
else
gEbTI.addImage('write',TIobj);
}
function ebOptOut(fOptOut)
{
gEbDbg.info("ebOptOut(" + fOptOut + ")" );
gEbClientInfo.cookieInfo.setOptOut(fOptOut);
}
}
function ebCScriptLoader()
{
var loadedScriptFiles = new Array();
this.addLoadedScript = addLoadedScript;
this.doOnScriptLoad = doOnScriptLoad;
this.findLoadedScript = findLoadedScript;
function addLoadedScript(name)
{
var index = loadedScriptFiles.length;
loadedScriptFiles[index] = name;
}
function doOnScriptLoad()
{
try{
gEbDbg.debug("Checking if all files are loaded for banner " + this.adData.nIndex + "(total of " + this.adFiles.length + " files)");
if(this.adFiles.length == 0)
{
gEbDbg.debug("banner " + this.adData.nIndex + " need no files for now - return");
return;
}
for(var i=0;i<this.adFiles.length;i++)
{
if(!findLoadedScript(this.adFiles[i]))
{
gEbDbg.debug("File " + this.adFiles[i] + " : not loaded yet");
return;
}
else
gEbDbg.debug("File " + this.adFiles[i] + " : loaded");
}
if(!this.fDisplayUnitCreated)
{
gEbDbg.attention("All files for banner " + this.adData.nIndex + " are loaded");
this.createDisplayUnit();
}
}catch(e)
{
gEbDbg.error("doOnScriptLoad: " + e.description);
}
}
function findLoadedScript(name)
{
for(var j=0;j<loadedScriptFiles.length;j++)
{
if(name == loadedScriptFiles[j])
{
return true;
}
}
return false;
}
}
function ebCEye(nID,adData,interactions)
{
this.temp = ebCServerResponse; 
this.temp();
delete this.temp;
this.fRequestHandled = false;
this.fShowEye = false;
this.fControlUser = false;
this.serverReq = new ebCServerRequest("gEbEyes[" + nID + "]");
this.displayUnit = null;
this.adData = new ebCAdData(nID,"gEbEyes[" + nID + "]");
this.interactions = new ebCInteractionsList();
this.adFiles = new Array();
this.objName = "gEbEyes[" + nID + "]";
this.fDisplayUnitCreated = false;
init(this,adData,interactions);
this.startFlow = startFlow;
this.loadEye = loadEye;
this.createDisplayUnit = createDisplayUnit;
this.run = run;
this.continueRun = continueRun;
this.doOnLoad = doOnLoad;
this.buildWinAdStr = buildWinAdStr;
this.loadInnerIframe = loadInnerIframe;
this.openInvitationPopUp = openInvitationPopUp;
this.buildSurveyUrl = buildSurveyUrl;
function startFlow()
{
try{
gEbDbg.debug("startFlow: " );
var fSkipServerReq = ( (typeof(gEbAdWindow) != "undefined") ||
(this.adData.fAdFromCookie))
if(fSkipServerReq)
{
if(typeof(gnEbHistLen) != "undefined")
gEbClientInfo.history.setLength(gnEbHistLen );
if (this.adData.nAdType == 2)
{
if(this.adData.nSurveyID != -1)
{
gEbTI.addEventHandler("unload","ebShowInvitation");
gEbTI.addEventHandler("beforeunload","ebShowInvitation");
gEbDbg.attention("endRespond: set ebShowInvitation as unload event handler");
}
}
this.loadEye();
}
else
{
if(this.adData.nAdType == 1) 
this.serverReq.sendRequest(9,this.adData);
else 
this.serverReq.sendRequest(7,this.adData);
}
}catch(e)
{
gEbDbg.error("startFlow: " + e.description);
}
}
function loadEye()
{
gEbDbg.debug("Function loadEye()");
var adData = this.adData;
var dnl = adData.strOnStartDnl;
var fCallDnlEvent = ((dnl != "") &&
(typeof(gEbAdWindow) == "undefined"));
if(fCallDnlEvent)
{
gEbDbg.info("Calling onStartDownload : " + dnl);
try
{
eval(dnl);
}
catch(e)
{
gEbDbg.fatal("exception on onStartDownload event : " + e.description);
}
}
var strMethod = "write";
if((adData.nAdType == 1) &&(adData.nDownloadMode == 1))
strMethod = "append";
var strAdUrl = ebResourcePath + adData.strAdUrl;
var strAdName = "ebAd_" + adData.nAdID;
var strTemplateUrl;
strTemplateUrl = ebBigS + "templates" + ebTemplateVer + "/" + adData.strTemplateName + ".js";
gEbDbg.info("loading Template : " + strTemplateUrl);
addScriptFile(this,strMethod,strTemplateUrl,"eb" + adData.strTemplateName);
gEbDbg.info("loading Ad : " + strAdUrl);
addScriptFile(this,strMethod,strAdUrl,strAdName);
if(adData.nAdType == 1)
{
var strPositionUrl = ebBigS + "Position" + ebPositionVer + ".js";
var strPositionName = "ebPosition";
gEbDbg.info("loading Position : " + strPositionUrl);
addScriptFile(this,strMethod,strPositionUrl,strPositionName);
}
this.doOnScriptLoad();
}
function createDisplayUnit()
{
this.fDisplayUnitCreated = true;
gEbDbg.always("A new ad on the page : AdID=" + this.adData.nAdID + " (index:" + this.adData.nIndex + ")");
gEbDbg.attention("creating object ebAd_" + this.adData.nAdID);
var tempAd = eval("new ebAd_" + this.adData.nAdID + "()");
gEbDbg.attention("creating object ebTemplate" + this.adData.strTemplateName);
this.displayUnit = eval("new ebCTemplate" + this.adData.strTemplateName + "('" + this.objName + ".displayUnit')")
gEbDbg.debug("set ad");
this.displayUnit.ad = tempAd;
gEbDbg.debug("set addata");
this.displayUnit.adData = this.adData;
gEbDbg.debug("set interactions");
this.displayUnit.interactions = this.interactions;
this.run();
}
function run()
{
try{
gEbDbg.debug("run");
this.displayUnit.findMyIframe();
var browser = new ebCBrowserCheck();
if (browser.isIE())
{
if (gEbDisplayPage.TI.doc.readyState != 'complete') 
{
var strFunc = this.displayUnit.scriptWin +".ebOnResize()";
gEbDisplayPage.ResizeIntervalId = gEbDisplayPage.TI.win.setInterval(strFunc,100);
}
}
if(this.adData.nAdType == 1) 
{
var adStatus = this.displayUnit.canDisplay();
var fPreview = ebIsPreview();
if(adStatus != 1) 
{
if (gEbDocLoaded)
{
if (fPreview || gEbfOfflineDemo)
{
if (adStatus == 5) 
{
gEbDbg.warning("ebCEye.run: PREVIEW : using pixel position instead of relative position (can't find relative object for intro)");
this.displayUnit.ad.nPosType = 1;
window.setTimeout(this.objName + ".run()",100); 
return;
}
if (adStatus == 6) 
{
gEbDbg.warning("ebCEye.run: PREVIEW : using pixel position instead of relative position (can't find relative object for reminder)");
this.displayUnit.ad.nRemPosType = 1;
window.setTimeout(this.objName + ".run()",100); 
return;
}
if (adStatus == 7) 
{
gEbDbg.warning("ebCEye.run: PREVIEW : using pixel position instead of relative position (can't find relative object for mini site)");
this.displayUnit.ad.nMiniSitePosType = 1;
window.setTimeout(this.objName + ".run()",100); 
return;
}
if (adStatus == 3) 
{
gEbDbg.warning("ebCEye.run: PREVIEW : using pixel OVERLAY banner setting instead of the requested setting");
this.displayUnit.nBannerType = 0;
}
}
else
{
if(adStatus == 4)
gEbDbg.fatal("run: the ad will not be displayed - download only case for opt out user");
else
gEbDbg.fatal("ebCEye.run: Can't display the ad - either relative position or banner settings failed");
return;
}
}
else
{
window.setTimeout(this.objName + ".run()",100);
return;
}
}
}
if(!this.adData.fDownloadOnly)
this.displayUnit.updateInteractions();
if(this.displayUnit.adTI.doc.body == null)
{
gEbDbg.warning("The tags are in the Head, there is no body yet, the ad will not run!");
return;
}
gEbDbg.debug("Calling template addResources");
this.displayUnit.nStartDlTime = new Date().getTime();
if(this.adData.nAdType == 2)
{
this.displayUnit.fShouldReportTimers = true;
this.displayUnit.ebstarttimerHandler("ebAdDuration");
}
this.displayUnit.addResources();
this.continueRun();
}catch(e)
{
gEbDbg.error("run: " + e.description);
}
}
function continueRun()
{
try{
if(this.adData.nAdType == 1) 
{
var fWinAd = (this.adData.strTemplateName == "WindowAd");
var fWinAdOpener = false;
var fAdWin = false;
fWinAdOpener = fWinAd && (typeof(gEbAdWindow) == "undefined");
fAdWin = fWinAd && (typeof(gEbAdWindow) != "undefined");
gEbDbg.attention("Check resources");
if(!this.displayUnit.resourcesReady())
{
window.setTimeout(this.objName + ".continueRun()",100);
return;
}
gEbDbg.attention("Resources are ready");
if(this.adData.fDownloadOnly)
{
gEbDbg.always("download only case");
downloadOnly(this);
return;
}
if(!fWinAdOpener)
this.displayUnit.fShouldReportTimers = true;
this.displayUnit.ebstarttimerHandler("ebAdDuration");
this.displayUnit.show();
if(this.adData.nAdType == 1) 
{
if (fAdWin)
{
gEbDbg.attention("continueRun() - Success report and OnPlay will be done from the main window");
return;
}
success(this);
}
}
doOnPlay(this);
}catch(e)
{
gEbDbg.error("continueRun: " + e.description);
}
}
function doOnLoad()
{
var adData = this.adData;
if(adData.nAdType == 1) 
{
switch(adData.nDownloadMode){
case 1:
this.startFlow();
break;
case 2:
case 3:
if(typeof(this.displayUnit.doOnLoad) == "function")
this.displayUnit.doOnLoad();
break;
}
}
}
function buildWinAdStr()
{
var strAd = adDataAsStr(this);
var strInteractions = interactionsAsStr(this);
return "strEbAd='" + strAd + "';strEbInteraction='" +strInteractions + "';";
}
function openInvitationPopUp()
{
var strUrl = ebBigS + "/DLInvitation" + ebDLInvetationVer + ".html?";
strUrl += "InvitationUrl=" + escape(ebResourcePath + this.adData.strInvitationUrl);
strUrl += "&AdID=" + this.adData.nAdID;
strUrl += "&SurveyID=" + this.adData.nSurveyID;
strUrl += "&SurveyUrl=" + escape(buildSurveyUrl(this.adData));
var strWinAttr = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0";
strWinAttr += ",width=" + this.adData.nInvitationWidth;
strWinAttr += ",height=" + this.adData.nInvitationHeight;
window.open(strUrl,"_blank",strWinAttr);
}
function buildSurveyUrl(adData)
{
var strUrl = "http://" + ebBS + "/BurstingPipe/DLPipe.asp?SurveyID=" + adData.nSurveyID + "&AdID=" + adData.nAdID;
gEbDbg.info("survey url: " + strUrl);
return strUrl;
}
function loadInnerIframe()
{
gEbDbg.always("Banner in IFRAME -> loading inner iframe");
var src = ebGetAddineyeLocation();
var strAdData = this.buildWinAdStr();
strAdData += "ebSmallS='" + escape(ebSmallS) + "';";
strAdData += "ebDbgLvl='" + gEbDbg.nLevel + "';";
strAdData += "gfEbBannerInInnerIframe = true;";
src = src + "?strBanner=" + escape(strAdData);
var iframeAttr = new ebCTIObj();
iframeAttr.src = src;
iframeAttr.style.width = "0px";
iframeAttr.style.height = "0px";
iframeAttr.frameborder = 0;
gEbTI.addIframe("write",iframeAttr);
}
function init(eyeObj,srcAdData,srcInteractions)
{
try{
copy(srcAdData,eyeObj.adData);
if (typeof(srcInteractions) != "undefined")
{
if(eyeObj.adData.fAdFromCookie)
copyCookieInteractions(srcInteractions, eyeObj.interactions);
else
copyInteractions(srcInteractions, eyeObj.interactions);
}
}catch(e)
{
gEbDbg.error("ebCEye.init: " + e.descrition);
}
}
function copy(src,dest)
{
for (attr in src)
{
if (typeof(src[attr]) == "object")
{
gEbDbg.debug("updateData - object " + attr);
if (typeof(dest[attr]) == "undefined")
{
if (typeof(src[attr].strType) != "undefined")
{
gEbDbg.debug("creating object " + src[attr].strType);
dest[attr] = eval ("new " + src[attr].strType + "()");
}
}
copy(src[attr],dest[attr]);
}
else
{
gEbDbg.debug("updateData - " + attr + " : " + src[attr]);
dest[attr] = src[attr];
}
}
}
function copyInteractions(src,dest)
{
for (attr in src)
{
if (typeof(src[attr])!= "string")
return;
gEbDbg.debug("copy interaction : " + attr + "(" + src[attr] + ")" );
var lowerAttr = attr.toLowerCase();
dest[lowerAttr] = new ebCInteraction(attr);
dest[lowerAttr].RS.set(src[attr]); 
dest[lowerAttr].fShouldReport = false;
}
}
function copyCookieInteractions(src,dest)
{
try{
for (inter in src)
{
var lowerName = src[inter].strName.toLowerCase();
dest[lowerName] = new ebCInteraction(src[inter].strName,src[inter].nType);
dest[lowerName].update(src[inter]);
}
}catch(e)
{
gEbDbg.error("copyCookieInteractions: " + e.description);
}
}
function addScriptFile(eyeObj,method,src,name)
{
try{
var scriptEl = document.getElementById(name);
var index = eyeObj.adFiles.length;
eyeObj.adFiles[index] = name;
if(scriptEl != null)
{
gEbDbg.info("the file " + name + " is allready loaded");
return;
}
gEbTI.addScript(method,src,name);
}catch(e)
{
gEbDbg.error("addScriptFile: " + e.description);
}
}
function doOnPlay(eyeObj)
{
if (!ebIsPreview())
eyeObj.adData.playRS.report(eyeObj.adData);
var play = eyeObj.adData.strOnPlay;
if (play != "")
{
gEbDbg.info("Calling onPlay : " + play);
try
{
eval(play);
}
catch(e)
{
gEbDbg.fatal("exception on onPlay event : " + e.description);
}
}
}
function downloadOnly(eyeObj)
{
var adData = eyeObj.adData;
var strCookieAd = adDataAsStr(eyeObj);
var strInteractions = interactionsAsStr(eyeObj);
var strCookie =
"var strCookieAd='" + strCookieAd + "';" +
"var strCookieInteractions='" + strInteractions + "';";
var strReadyAdType =
"var strCookieAdType='" + adData.strTemplateName + "';" +
"var nCookieFlightId='" + adData.nFlightID + "';";
gEbClientInfo.cookieInfo.setReadyAd(strCookie);
gEbClientInfo.cookieInfo.setReadyAdType(strReadyAdType);
}
function adDataAsStr(eyeObj)
{
try{
var adData = eyeObj.adData;
var strAd =
adData.nFlightID + "::" + 
adData.nAdID + "::" + 
adData.strLogID + "::" + 
adData.nSiteInterval + "::" + 
escape(adData.strAdUrl) + "::" + 
adData.strTemplateName + "::" + 
adData.strPage + "::" + 
adData.fWebPageSource + "::" + 
adData.nSiteID + "::" + 
escape(adData.playRS.strNUrl) + "::" + 
escape(adData.playRS.strAUrl) + "::" + 
adData.strRand + "::" + 
adData.nFlightInterval + "::" + 
escape(adData.strBlankUrl) + "::" + 
adData.fPromptForPlugins + "::" + 
adData.nAdType + "::" + 
gEbClientInfo.history.nLength + "::" + 
escape(adData.strOnPlay) + "::" + 
escape(adData.strOnStartDnl) + "::" + 
adData.nImpressions + "::" + 
adData.bannerPos.nType + "::" + 
adData.bannerPos.strBannerName + "::" + 
adData.bannerPos.strAlternateBanner + "::" + 
adData.fShowOnlyImage + "::" + 
adData.nLowBWLimit + "::" + 
escape(adData.strInvitationUrl) + "::" + 
adData.nInvitationWidth + "::" + 
adData.nInvitationHeight + "::" + 
adData.nSurveyID + "::" + 
escape(adData.strInvitationBannerUrl) + "::" + 
adData.nWidth + "::" + 
adData.nHeight + "::" + 
adData.nDownloadMode + "::" + 
adData.fCollectWebPages + "::" + 
adData.strDemoFolder; 
return strAd;
}catch(e)
{
gEbDbg.error("adDataAsStr: " + e.description);
}
}
function interactionsAsStr(eyeObj)
{
gEbDbg.attention("interactionsAsStr: ");
var interactions = eyeObj.interactions;
var strInteractions = "";
for( inter in interactions)
{
gEbDbg.attention("interaction: " + inter + " type: " + typeof(interactions[inter]));
if(typeof(interactions[inter]) != "object")
{
gEbDbg.attention("not an object, do not copy");
continue;
}
if(strInteractions != "")
strInteractions += "::";
strInteractions += "[" +
interactions[inter].strName + "," + 
interactions[inter].fCloseFlag + "," + 
escape(interactions[inter].strJumpUrl) + "," + 
interactions[inter].strTarget + "," + 
escape(interactions[inter].RS.strNUrl) + "," + 
escape(interactions[inter].RS.strAUrl) + "," + 
interactions[inter].jumpWin.strPosX + "," + 
interactions[inter].jumpWin.strPosY + "," + 
interactions[inter].jumpWin.strWidth + "," + 
interactions[inter].jumpWin.strHeight + "," + 
interactions[inter].jumpWin.strAddressBar + "," + 
interactions[inter].jumpWin.strMenuBar + "," + 
interactions[inter].fCountAsClick + "," + 
interactions[inter].fShouldReport + "," + 
interactions[inter].nType + "," + 
interactions[inter].nValue + "," + 
interactions[inter].nStartTime + "]" ; 
}
return strInteractions;
}
function success(eyeObj)
{
var adData = eyeObj.adData;
var dtCurrentTime = new Date();
var flSiteIntevalCookie = parseFloat(dtCurrentTime.getTime()) + parseFloat(adData.nSiteInterval);
gEbClientInfo.cookieInfo.setBurstingTime(flSiteIntevalCookie);
gEbClientInfo.history.update(adData.nFlightID,adData.nFlightInterval,dtCurrentTime);
eyeObj.fRequestHandled = false;
eyeObj.serverReq.sendRequest(10,adData);
if(adData.nSurveyID != -1)
{
eyeObj.displayUnit.adTI.addEventHandler("unload","ebShowInvitation");
eyeObj.displayUnit.adTI.addEventHandler("beforeunload","ebShowInvitation");
gEbDbg.always("success: set ebShowInvitation as unload event handler");
}
}
}
ebCEye.prototype = new ebCScriptLoader();
function ebCTemplateBase()
{
this.ad = null;
this.adData = null;
this.interactions = null;
this.fShouldReportTimers = false;
this.objType = 1; 
this.fImageOnly = false; 
this.nStartDlTime = 0; 
this.scriptWin = "self"; 
this.topIframe = null; 
this.adTI = gEbTI;
this.relativeObjRef = null; 
this.remRelativeObjRef = null; 
this.miniSiteRelativeObjRef = null; 
this.fObjAreHidden = false; 
this.nBannerType = -1; 
this.strBannerName = "";
this.strAltBannerName = "";
this.fCloseable = true; 
this.setBannerType = setBannerType;
this.canDisplay = canDisplay;
this.updateInteractions = updateInteractions; 
this.handleFSCommand = handleFSCommand;
this.myName = myName;
this.findMyIframe = findMyIframe;
this.showHidePageElements = showHidePageElements;
this.hideObject = hideObject;
this.showObject = showObject;
this.addRelativeObj = addRelativeObj;
this.refObjExist = refObjExist;
this.findBanner = findBanner;
this.searchForObj = searchForObj;
this.flashResReady = flashResReady;
this.buildResUrl = buildResUrl;
this.ebinteractionHandler = ebinteractionHandler;
this.handleInteraction = handleInteraction;
this.ebstarttimerHandler = ebstarttimerHandler;
this.ebendtimerHandler = ebendtimerHandler;
this.ebupdatetimerHandler = ebupdatetimerHandler;
this.collectTimers = collectTimers;
this.ebcommandHandler = ebCommandHandler;
this.ebquitHandler = ebQuitHandler;
this.ebshakeHandler = ebShakeHandler;
this.ebshake2Handler = ebShake2Handler;
this.ebShake2 = ebShake2;
this.ebmsgHandler = ebMsgHandler;
function canDisplay()
{
gEbDbg.debug("canDisplay");
var fShowOnNextPage = ((typeof(this.ad.fShowOnNextPage) != "undefined")&&(this.ad.fShowOnNextPage));
this.adData.fDownloadOnly = (fShowOnNextPage &&(!this.adData.fAdFromCookie)&& !ebIsPreview());
if(this.adData.fDownloadOnly && gEbClientInfo.cookieInfo.fOptOut)
{
gEbDbg.warning("download only case for opt out users - do not display");
return 4;
}
if(typeof(this.ad.nPosType) != "undefined")
{
if (this.ad.nPosType == 2) 
{
gEbDbg.attention("searching for the intro ref element");
var ebRefObj = getRefObject(this,this.ad.strRefName);
this.relativeObjRef = ebRefObj;
if (ebRefObj == null)
return (5); 
}
}
if(typeof(this.ad.nRemPosType) != "undefined")
{
if (this.ad.nRemPosType == 2) 
{
gEbDbg.attention("searching for the reminder ref element");
if(typeof(this.ad.strRemRefName) != "undefined")
{
var ebRefObj = getRefObject(this,this.ad.strRemRefName);
this.remRelativeObjRef = ebRefObj;
if (ebRefObj == null)
return (6); 
}
else
{
gEbDbg.warning("canDisplay: ad.nRemPosType is 2 but ad.strRemRefName is undefined");
return (6); 
}
}
}
if(typeof(this.ad.nMiniSitePosType) != "undefined")
{
if (this.ad.nMiniSitePosType == 2) 
{
gEbDbg.attention("searching for the mini site ref element");
if(typeof(this.ad.strMiniSiteRefName) != "undefined")
{
var ebRefObj = getRefObject(this,this.ad.strMiniSiteRefName);
this.miniSiteRelativeObjRef = ebRefObj;
if (ebRefObj == null)
return (7); 
}
else
{
gEbDbg.warning("canDisplay: ad.nMiniSitePosType is 2 but ad.strMiniSiteRefName is undefined");
return (7); 
}
}
}
if ((typeof(this.ad.nBannerType) != "undefined") && (typeof(this.ad.fHasReminder) != "undefined") && this.ad.fHasReminder)
return (canDisplayBannerReminder(this));
return (1);
}
function updateInteractions()
{
gEbDbg.debug("updateInteractions");
gEbDbg.debug("Updating Play RemoteServers:");
this.adData.playRS.update(this.ad.playRS);
var winAdOpener = ((this.adData.strTemplateName == "WindowAd")&&(typeof(gEbAdWindow) == "undefined"));
if(winAdOpener)
{
gEbDbg.debug("Window ad opener - no need to update ad interactions (only play remote servers were updated from admin)");
return;
}
updateAdInteractions(this);
setAutoInteractions(this);
if (typeof(this.updateTemplateInteractions) == "function")
this.updateTemplateInteractions();
var interactions = this.interactions;
for (attr in interactions) 
{
if(typeof(interactions[attr]) == "object")
{
interactions[attr].objName = this.objName + ".interactions['" + attr + "']";
gEbDbg.debug(interactions[attr].strName + " : " + interactions[attr].objName);
}
}
}
function handleFSCommand(strCommand,strArgs,strObjID)
{
try{
if (typeof(strObjID) == "undefined")
strObjID = "";
if(strArgs == "")
strArgs = "''";
var ch = strArgs.charAt(0);
if ((ch != '"') && (ch != '\''))
strArgs = "'" + strArgs + "'";
var strLowerCmd = strCommand.toLowerCase();
gEbDbg.info("fscommand( " + strLowerCmd + " , " + strArgs + " , " + strObjID + " )");
var strFunc = "this." + strLowerCmd + "Handler";
var func = eval (strFunc);
if (typeof (func) == "function")
{
strFunc = this.objName + "." + strLowerCmd + "Handler(" + strArgs + ",'" + strObjID + "')";
var browser = new ebCBrowserCheck();
if (browser.isIE())
{
gEbDbg.debug ("Calling : " + strFunc);
eval(strFunc);
}
else
{
gEbDbg.debug ("Calling : " + "window.setTimeout('"+ strFunc +"',100)");
window.setTimeout(strFunc,100);
}
}
else
gEbDbg.warning (strLowerCmd + " is not handled in current template");
}catch(e)
{
gEbDbg.error("handleFSCommand: " + strCommand +"," + strArgs + " : " + e.description);
}
}
function myName(name)
{
return (name + this.adData.nIndex + "_" + this.adData.strRand);
}
function findMyIframe()
{
try
{
gEbDisplayPage.getIframeData();
var name = this.myName("ebScriptWin");
var scriptWinPointer = self;
eval ("gEbDisplayPage.TI.win." + name + "=scriptWinPointer");
this.scriptWin = name;
this.topIframe = gEbDisplayPage.topIframe;
this.adTI = gEbDisplayPage.TI;
}
catch (e)
{
gEbDbg.fatal("exception in findMyIframe() - " + e.description);
this.topIframe = null;
}
}
function showHidePageElements(fShow,win)
{
var fHide = !fShow;
if (typeof(win) == "undefined")
win = gEbTI.win;
if ((fShow && !this.fObjAreHidden) ||(fHide && this.fObjAreHidden ))
{
gEbDbg.debug("showHidePageElements: fShow=" + fShow + " fObjAreHidden=" + this.fObjAreHidden + " - DO NOTHING");
return;
}
this.fObjAreHidden = !this.fObjAreHidden;
if (this.ad.fHideDropDowns)
{
if (fShow)
this.showObject("SELECT",win);
else
this.hideObject("SELECT",win);
}
if (this.ad.fHideIframes)
{
if (fShow)
this.showObject("IFRAME",win);
else
this.hideObject("IFRAME",win);
}
var browser = new ebCBrowserCheck();
if (this.ad.fHideFlash)
{
if (fShow)
{
if(browser.isIE())
this.showObject("OBJECT",win);
else
this.showObject("EMBED",win);
}
else
{
if(browser.isIE())
this.hideObject("OBJECT",win);
else
this.hideObject("EMBED",win);
}
}
if (this.ad.fHhideApplet)
{
if (fShow)
this.showObject("APPLET",win);
else
this.hideObject("APPLET",win);
}
}
function hideObject(strType,win)
{
if (typeof(win) == "undefined")
win = gEbTI.win;
var doc = win.document;
if (typeof(win.ebHiddenDropDowns) == "undefined")
eval ("win.ebHiddenDropDowns = new Array()");
if (typeof(win.ebHiddenDropDownsRefCount) == "undefined")
eval ("win.ebHiddenDropDownsRefCount = 0");
if (typeof(win.ebHiddenIframes) == "undefined")
eval ("win.ebHiddenIframes = new Array()");
if (typeof(win.ebHiddenIframesRefCount) == "undefined")
eval ("win.ebHiddenIframesRefCount = 0");
if (typeof(win.ebHiddenFlashElements) == "undefined")
eval ("win.ebHiddenFlashElements = new Array()");
if (typeof(win.ebHiddenFlashElementsRefCount) == "undefined")
eval ("win.ebHiddenFlashElementsRefCount = 0");
if (typeof(win.ebHiddenApplets) == "undefined")
eval ("win.ebHiddenApplets = new Array()");
if (typeof(win.ebHiddenAppletsRefCount) == "undefined")
eval ("win.ebHiddenAppletsRefCount = 0");
var browser = new ebCBrowserCheck();
var buf;
if (strType == "SELECT")
{
if (!browser.isIE())
return;
}
else
if (strType == "IFRAME")
{
if ((browser.getEbBrowser() & this.ad.nHideIframeIn) == 0)
return;
}
else
if (strType == "EMBED")
{
if (browser.getNNVer() < 7.0)
{
gEbDbg.warning("Hiding FLASH objects is only supported in NN for version 7.0 and above (current version " + browser.getNNVer() + ")");
return;
}
}
gEbDbg.info("Hiding all " + strType + " items");
var fTypeIsFlash = false;
switch (strType)
{
case "SELECT" :
win.ebHiddenDropDownsRefCount++;
buf = win.ebHiddenDropDowns;
break;
case "IFRAME" :
win.ebHiddenIframesRefCount++;
buf = win.ebHiddenIframes;
break;
case "EMBED" :
case "OBJECT" :
win.ebHiddenFlashElementsRefCount++;
buf = win.ebHiddenFlashElements;
fTypeIsFlash = true;
break;
case "APPLET" :
win.ebHiddenAppletsRefCount++;
buf = win.ebHiddenApplets;
break;
}
var itemList = doc.getElementsByTagName(strType);
for (var i=0; i<itemList.length; i++)
{
var vis = itemList[i].style.visibility;
if ((vis == "visible") || (vis == ""))
{
gEbDbg.info("Hiding " + strType + " element (total hidden : " + (buf.length + 1) + ")");
if(fTypeIsFlash)
if( !shouldHideFlash(strType,itemList[i]))
continue;
var newElement = new Object();
newElement.obj = itemList[i];
newElement.visibility = itemList[i].style.visibility;
buf[buf.length] = newElement;
itemList[i].style.visibility = "hidden";
}
}
}
function shouldHideFlash(strType,obj)
{
try{
if(strType == "OBJECT" )
{
if(obj.classid != "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000")
{
gEbDbg.debug("shouldHideFlash: not a flash object do not hide: classid=" + obj.classid);
return false;
}
if(obj.Wmode.toLowerCase() != "window" )
{
gEbDbg.debug("shouldHideFlash: WMODE other then 'window' (" + obj.Wmode + ") do not hide");
return false;
}
if(( obj.Movie.indexOf(ebResourcePath) == 0)||(obj.Movie.indexOf("about:blank") == 0))
{
gEbDbg.debug("shouldHideFlash: do not hide the flash resource because it is related to the ad - src=" + obj.Movie);
return false;
}
gEbDbg.debug("this flash element should be hidden (" + obj.Movie + ")");
}
if(strType == "EMBED" )
{
if(obj.type != "application/x-shockwave-flash")
{
gEbDbg.debug("shouldHideFlash: not a flash object do not hide: type=" + obj.type);
return false;
}
if((obj.getAttribute("wmode") != null)&&(obj.getAttribute("wmode").toLowerCase() != "window" )&& (obj.getAttribute("wmode") != ""))
{
gEbDbg.debug("shouldHideFlash: WMODE other then 'window' (" + obj.getAttribute("wmode") + ") do not hide");
return false;
}
if(( obj.src.indexOf(ebResourcePath) == 0)|| ( obj.src.indexOf("about:blank") == 0))
{
gEbDbg.debug("shouldHideFlash: do not hide the flash resource because it is related to the ad - src=" + obj.src);
return false;
}
gEbDbg.debug("this flash element should be hidden (" + obj.src + ")");
}
return true;
}catch(e)
{
gEbDbg.error("shouldHideFlash: " + e.description);
}
}
function showObject(strType,win)
{
if (typeof(win) == "undefined")
win = gEbTI.win;
var buf,count;
if ((typeof(win.ebHiddenDropDowns) == "undefined") ||
(typeof(win.ebHiddenDropDownsRefCount) == "undefined") ||
(typeof(win.ebHiddenIframes) == "undefined") ||
(typeof(win.ebHiddenIframesRefCount) == "undefined")||
(typeof(win.ebHiddenFlashElements) == "undefined") ||
(typeof(win.ebHiddenFlashElementsRefCount) == "undefined")||
(typeof(win.ebHiddenApplets) == "undefined") ||
(typeof(win.ebHiddenAppletsRefCount) == "undefined"))
{
gEbDbg.error("showObject() - buffers or refcount are undefined !!!");
return;
}
switch (strType)
{
case "SELECT" :
buf = win.ebHiddenDropDowns;
win.ebHiddenDropDownsRefCount--;
count = win.ebHiddenDropDownsRefCount;
break;
case "IFRAME" :
buf = win.ebHiddenIframes;
win.ebHiddenIframesRefCount--;
count = win.ebHiddenIframesRefCount;
break;
case "EMBED" :
case "OBJECT" :
buf = win.ebHiddenFlashElements;
win.ebHiddenFlashElementsRefCount--;
count = win.ebHiddenFlashElementsRefCount;
break;
case "APPLET" :
buf = win.ebHiddenApplets;
win.ebHiddenAppletsRefCount--;
count = win.ebHiddenAppletsRefCount;
break;
}
if (count > 0)
{
gEbDbg.attention("showObject(" + strType + ") - don't show since refCount is " + count);
}
else
{
gEbDbg.info("Showing all " + strType + " items (" + buf.length + " elements)");
for (var i=0; i<buf.length; i++)
{
try {
buf[i].obj.style.visibility = buf[i].visibility;
}catch (e) {gEbDbg.error("showObject: " + e.description);}
}
buf.length = 0;
}
}
function ebCommandHandler(strArgs,strObjID)
{
gEbDbg.info ("Calling ebCommand : " + strArgs);
try{
eval (strArgs);
}catch(e)
{
gEbDbg.warning("ebCommand: "+ strArgs + " " + e.description);
}
}
function ebMsgHandler(strArgs,strObjID)
{
gEbDbg.always(strArgs);
if (strArgs.indexOf("ebInteractionTime") != -1)
{
gEbDbg.always("Interaction time for this ad will be collected");
this.adData.fCountIntDuration = true;
}
}
function ebShakeHandler(n)
{
try{
n = parseInt(n);
if (isNaN(n) || (n<=0))
n = 1;
if (typeof(gfEbActiveXPreview) != "undefined") return;
var bc=new ebCBrowserCheck();
if (bc.isAOL()) return;
if (bc.getEbBrowser() == 32) return;
if (top.moveBy){
for (var i = 15; i > 0; i--){
for (var j = n; j > 0; j--){
top.moveBy(0,i);
top.moveBy(i,0);
top.moveBy(0,-i);
top.moveBy(-i,0);
}
}
}
}
catch(e)
{
gEbDbg.warning("ebCommand: "+ strArgs + " " + e.description);
}
}
function ebShake2Handler(n)
{
try{
n = parseInt(n);
if (isNaN(n) || (n<=0))
n = 1;
if (typeof(gfEbActiveXPreview) != "undefined") return;
var bc=new ebCBrowserCheck();
if (bc.isAOL()) return;
if (bc.getEbBrowser() == 32) return;
this.ebShake2(n,15,n);
}
catch(e)
{
gEbDbg.warning("ebCommand: "+ strArgs + " " + e.description);
}
}
function ebShake2(n,i,j)
{
top.moveBy(0,i);
top.moveBy(i,0);
top.moveBy(0,-i);
top.moveBy(-i,0);
j--;
if (j==0)
{
i--;
j=n;
}
if (i!= 0)
window.setTimeout(this.objName + ".ebShake2(" + n + "," + i + "," + j + ")",1);
}
function ebQuitHandler(strArgs,strObjID)
{
this.ebinteractionHandler("ebClose");
}
function handleInteraction(strName,fReportImmediatly,strObjID)
{
if(strName == "")
strName = "_eyeblaster";
gEbDbg.info ("Trying to handle interaction " + strName);
var interactions = this.interactions;
var inter = getInteractionObj(this,strName);
if(typeof(inter) == 'undefined')
{
gEbDbg.warning ("Can't find interaction : " + strName);
return;
}
if(inter.nType == 1)
{
gEbDbg.warning("handleInteraction: " + strName + " is a timer interaction - ignore");
return;
}
if (inter.fIsBusy)
{
gEbDbg.warning ("interaction " + strName + " is currently handled. Ignoring this one");
return;
}
if(inter.fShouldReport)
{
interactions.nNumInteractions ++;
var fIsClick = 0; 
if ((inter.fCountAsClick) && (!interactions.fClicked))
{
fIsClick = 1;
interactions.fClicked = true;
}
if((inter.fCloseFlag) && this.fCloseable)
fReportImmediatly = false;
inter.handle(interactions.nNumInteractions,fIsClick,this.adData,fReportImmediatly);
if (inter.fCloseFlag)
{
gEbDbg.debug ("Interaction " + strName + " has close flag : " + inter.fCloseFlag);
if (typeof (this.close) == "function")
this.close();
else
gEbDbg.warning ("close() is not defined");
}
}
else
{
gEbDbg.warning("handleInteraction: interaction '" + strName + "' does not configured through the admin and will be ignored.");
}
}
function ebinteractionHandler(strName,strObjID)
{
this.handleInteraction(strName,true,strObjID);
}
function ebstarttimerHandler(strName,strObjID)
{
try{
if(ebMaxTimePassed)
{
gEbDbg.warning("ebstarttimerHandler: the maximum timers time has passed, ignore timers");
return;
}
var interactions = this.interactions;
var lowerName = strName.toLowerCase();
var inter = getInteractionObj(this,strName);
if(typeof(inter) == 'undefined')
{
gEbDbg.warning ("ebstarttimerHandler: Can't find timer : " + strName);
return;
}
if(inter.nType != 1)
{
gEbDbg.warning("ebstarttimerHandler: interaction " + strName + " is not a timer");
return;
}
inter.handle(1,this.adData);
}catch(e)
{
gEbDbg.error("ebstarttimerHandler: " + e.description);
}
}
function ebendtimerHandler(strName,strObjId)
{
if(ebMaxTimePassed)
{
gEbDbg.warning("ebendtimerHandler: the maximum timers time has passed, ignore timers");
return;
}
var interactions = this.interactions;
var inter = getInteractionObj(this,strName);
if(typeof(inter) == 'undefined')
{
gEbDbg.warning ("ebendtimerHandler: timer " + strName + " doesn't exist - ignore it");
return;
}
if(inter.nType != 1)
{
gEbDbg.warning("ebendtimerHandler: interaction " + strName + " is not a timer");
return;
}
inter.handle(2,this.adData);
}
function ebupdatetimerHandler(strName,nValue)
{
if(ebMaxTimePassed)
{
gEbDbg.warning("ebupdatetimerHandler: the maximum timers time has passed, ignore timers");
return;
}
var interactions = this.interactions;
var inter = getInteractionObj(this,strName);
if(typeof(inter) == 'undefined')
{
gEbDbg.warning ("ebupdatetimerHandler: timer " + strName + " doesn't exist - ignore it");
return;
}
if(inter.nType != 1)
{
gEbDbg.warning("ebupdatetimerHandler: interaction " + strName + " is not a timer");
return;
}
inter.handle(3,this.adData,nValue);
}
function collectTimers(fReport)
{
try{
var badInt = "0";
gEbDbg.debug2(this.objName + ".collectTimers(" + fReport + ")");
gEbDbg.info("collectTimers for ad " + this.adData.nAdID);
badInt += "1";
if (ebIsPreview())
{
badInt += "2";
gEbDbg.info("preview - Do not collect timers.");
return "";
}
badInt += "3";
if(!this.fShouldReportTimers)
{
badInt += "4";
gEbDbg.info("timers for this ad (" + this.objName + ") should not be reported");
return "";
}
badInt += "5";
var strInteractions = "";
var interactions = this.interactions;
var tmpInter = null;
var ok = true;
badInt += "6";
for(inter in interactions)
{
badInt += "7";
if(interactions[inter].nType == 1)
{
badInt += "8";
try {
interactions[inter].handle(2,this.adData);
}catch (e) {ok = false; strInteractions = "handleTimer" + this.adData.nAdID + "_" + e.description; break;}
try {
if(interactions[inter].nValue != 0)
strInteractions += interactions[inter].getReportData(0);
else
{
if(((inter == "ebintduration")&&(this.adData.fCountIntDuration))||
(inter == "ebremduration"))
strInteractions += interactions[inter].getReportData(0);
}
}catch (e) {ok= false; strInteractions = "getReportData_" + inter + this.adData.nAdID + "_" + e.description; break;}
}
badInt += "9";
}
badInt += "a";
if (ok)
{
strInteractions += this.adData.strPendingInteractions;
this.adData.strPendingInteractions = "";
}
badInt += "b";
if(strInteractions != "")
{
badInt += "c";
if (ok)
{
strInteractions = interactions["_eyeblaster"].getAdReportData(this.adData) + strInteractions;
gEbDbg.debug("collectTimers: interactions string is " + strInteractions);
}
badInt += "d";
if(fReport)
{
badInt += "e";
var reportUrl = interactions["_eyeblaster"].getPipeUrl() +
"?interactionsStr=" + escape(strInteractions) +
"&ebRandom=" + Math.random();
badInt += "f";
interactions["_eyeblaster"].reportingImg = new Image();
interactions["_eyeblaster"].reportingImg.src = reportUrl;
badInt += "g";
gEbDbg.debug("collectTimers: report interctions on : " + reportUrl);
badInt += "h";
}
badInt += "i";
}
else
gEbDbg.debug("collectTimers: there are no interactions to report");
badInt += "j";
this.fShouldReportTimers = false;
badInt += "k";
return strInteractions;
}catch(e)
{
gEbDbg.error("collectTimers: " + e.description);
return "collectTimers" + this.adData.nAdID + "_" + badInt + "_" + e.description;
}
}
function addRelativeObj(refObj,propObj,objType)
{
var relContainer = gEbTI.addRelativeObject(refObj,"");
propObj.refElement = relContainer;
if(objType == "flash")
gEbTI.addFlash("append",propObj);
else
gEbTI.addImage("append",propObj);
}
function refObjExist(refObjSrc)
{
var refObj;
var objTypeArr = new Array("iframe","img","object","embed");
for(var i=0; i<objTypeArr.length; i++)
{
refObj = this.searchForObj(objTypeArr[i],refObjSrc);
if(refObj != null)
{
gEbDbg.info("a matching " + objTypeArr[i] + " was found");
return 1;
}
}
if(gEbDocLoaded) 
{
gEbDbg.warning("no object with src " + refObjSrc + " was found");
return 0;
}
else
{
gEbDbg.info("no object with src " + refObjSrc + " was found yet, try again");
return 2;
}
}
function searchForObj(type,url)
{
url = url.toLowerCase();
type = type.toLowerCase();
gEbDbg.info("searchForObj: type=" + type + " url=" + url);
var objarr = this.adTI.doc.getElementsByTagName(type);
for (var i=0; i<objarr.length; i++)
{
try
{
var objsrc;
if (type == "object")
objsrc = objarr[i].movie;
else
objsrc = objarr[i].src;
objsrc = objsrc.toLowerCase();
if (typeof(objsrc) != "undefined")
{
if (objsrc.indexOf(url) != -1)
{
gEbDbg.info("found matching " + type + " resource to " + url + "(" + objsrc + ")");
return(objarr[i]);
}
}
}
catch (e)
{
gEbDbg.error("searchForObj: Type=" + type + " url=" + url + " : " + e.description);
}
}
return(null);
}
function flashResReady(nPercentLoaded,nResSize,streamParams)
{
gEbDbg.debug2("flashResReady() - percent loaded : " + nPercentLoaded);
if (nPercentLoaded == 100)
{
gEbDbg.debug2("Flash resource is fully loaded (100%)");
return (true);
}
var nLoadedSize = nPercentLoaded * nResSize / 100;
if (nLoadedSize > 300 * 1024)
{
gEbDbg.debug2("Flash resource reached loading limit (Loaded size : " + nLoadedSize + " is bigger then 300 KB)");
return (true);
}
if (streamParams == null)
{
gEbDbg.debug2("No Streaming is need and resource is not ready (percent loaded : " + nPercentLoaded + " Loaded Size : " + nLoadedSize + ")");
return (false);
}
if (streamParams.fAutoBuffer == "1")
{
gEbDbg.debug2("Stream according Automatic Buffering");
var dtNow = new Date().getTime();
var nDelta = dtNow - this.nStartDlTime; 
if (nPercentLoaded == 0)
return (false);
var nLeftTimeToDownload = nDelta/(nPercentLoaded/100) - nDelta;
gEbDbg.debug2("Movie Duration : " + streamParams.nMovieDuration * 1000 + " ms Left To Download : " + nLeftTimeToDownload + " ms");
if (nLeftTimeToDownload < streamParams.nMovieDuration * 1000)
{
gEbDbg.debug2("Flash resource is READY");
return (true);
}
}
else
{
gEbDbg.debug2("Stream according to bandwidth");
var bw = gEbClientInfo.pluginInfo.bandWidth;
var nBandWidth = bw.nValue;
var fLowBW = true;
var nLimit = this.adData.nLowBWLimit;
if (nBandWidth != -1)
{
gEbDbg.debug2("Users BandWidth : " + nBandWidth + " Low BW Limit : " + nLimit);
if (nBandWidth > nLimit)
fLowBW = false;
}
else
gEbDbg.debug2("User's BandWidth is undefined - assuming Low BandWidth");
if (fLowBW)
{
gEbDbg.debug2("Check low bandwidth settings");
if (nPercentLoaded >= streamParams.nLowBWBuffer)
{
gEbDbg.debug2("Flash resource is READY");
return (true);
}
}
else
{
gEbDbg.debug2("Check high bandwidth settings");
if (nPercentLoaded >= streamParams.nHighBWBuffer)
{
gEbDbg.debug2("Flash resource is READY");
return (true);
}
}
}
gEbDbg.debug2("Flash resource is NOT READY");
return (false);
}
function buildResUrl(resUrl)
{
var strDcPipe;
if(gEbfOfflineDemo)
strDcPipe ='';
else
strDcPipe = 'http://' + ebDataCapture + '/BurstingPipe/BurstingDataCapturePipe.asp';
var strDomain;
try{
strDomain = this.adTI.doc.location.hostname;
}catch(e)
{
strDomain = "";
}
var conduitPath = ebBigS + "/res/" + ebConduitVer ;
var interactionTime = ebBigS + "/res/ebInteractionTime" + ebIntTimeVer + ".swf";
var strAdditionalRes = "";
resources = this.ad.arrAdditionalRes;
for(i=0; i< resources.length; i++)
{
if(strAdditionalRes != "")
strAdditionalRes += "&";
strAdditionalRes += resources[i].name + "=" + ebResourcePath + resources[i].url;
}
var strUrl = resUrl + "?ebDomain=" + strDomain +
"&ebDCPipe=" + strDcPipe +
"&ebAdID=" + this.adData.nAdID +
"&" + strAdditionalRes +
"&cp=" + conduitPath +
"&ebIntTime=" + interactionTime;
gEbDbg.debug("buildResUrl: url=" + strUrl);
return strUrl;
}
function getInteractionObj(templateObj,strName)
{
try{
while(strName.charAt(0) == " ")
{
strName = strName.subStr(1,strName.length);
gEbDbg.debug("getInteractionObj: the interaction name had a space prefix, was removed: " + strName);
}
while(strName.charAt(strName.length) == " ")
{
strName = strName.subStr(0,strName.length-1);
gEbDbg.debug("getInteractionObj: the interaction name had a space sufix, was removed: " + strName);
}
var interactions = templateObj.interactions;
var lowerName = strName.toLowerCase();
gEbDbg.debug("interaction lower case name: " + lowerName);
return interactions[lowerName];
}catch(e)
{
gEbDbg.error("getInteractionObj: " + e.description);
}
}
function getRefObject(templateObj,strRefObjName)
{
var ebRefObj = templateObj.searchForObj("iframe",strRefObjName);
if (ebRefObj == null)
ebRefObj = templateObj.searchForObj("img",strRefObjName);
if (ebRefObj == null)
ebRefObj = templateObj.searchForObj("object",strRefObjName);
if (ebRefObj == null)
ebRefObj = templateObj.searchForObj("embed",strRefObjName);
return ebRefObj;
}
function canDisplayBannerReminder(templateObj)
{
gEbDbg.debug("canDisplayBannerReminder");
var ad = templateObj.ad;
var metaBannerPos = templateObj.adData.bannerPos;
templateObj.nBannerType = ad.nBannerType;
if(metaBannerPos.nType != -1)
templateObj.nBannerType = metaBannerPos.nType;
gEbDbg.debug("nBannerType: " + templateObj.nBannerType);
if(templateObj.nBannerType == 0)
{
gEbDbg.debug("canDisplayBannerReminder - the reminder type is overlay");
return (1);
}
if(templateObj.nBannerType == 1)
{
if (gEbDisplayPage.fInIframe)
{
gEbDbg.debug("canDisplayBannerReminder - Reminder Type is IFRAME SWAP");
templateObj.bannerToSwap = templateObj.topIframe;
return (1);
}
else
{
gEbDbg.error("canDisplayBannerReminder - Reminder Type is IFRAME SWAP but code is not running from Iframe");
return (3);
}
}
templateObj.strBannerName = ad.strBannerName;
if(metaBannerPos.strBannerName != "")
templateObj.strBannerName = metaBannerPos.strBannerName;
templateObj.strAltBannerName = ad.strAltBannerName;
if(metaBannerPos.strAlternateBanner != "")
templateObj.strAltBannerName = metaBannerPos.strAlternateBanner ;
var bannerToSwap = null;
if(templateObj.strBannerName != "")
{
bannerToSwap = templateObj.findBanner(templateObj.strBannerName);
if( bannerToSwap != null)
{
gEbDbg.debug("canDisplayBannerReminder - Banner: " + templateObj.strBannerName + " was found.");
templateObj.bannerToSwap = bannerToSwap;
return (1);
}
}
if(templateObj.strAltBannerName != "")
{
bannerToSwap = templateObj.findBanner(templateObj.strAltBannerName);
if(bannerToSwap != null)
{
gEbDbg.debug("canDisplayBannerReminder - Alternate Banner: " + templateObj.strAltBannerName + " was found.");
templateObj.bannerToSwap = bannerToSwap;
return (1);
}
}
gEbDbg.error("canDisplayBannerReminder: niether the banner " + templateObj.strBannerName +
" or the alternate banner " + templateObj.strAltBannerName + " were found!");
return (3);
}
function findBanner(src)
{
try{
gEbDbg.info("Searching for banner : " + src);
var banner = null;
var objTypeArr = new Array("img","object","embed");
for(var i=0; i<objTypeArr.length; i++)
{
banner = this.searchForObj(objTypeArr[i],src);
if(banner != null)
{
gEbDbg.info("a matching " + objTypeArr[i] + " was found");
return banner;
}
}
}catch(e)
{
gEbDbg.error("findBanner: " + e.description);
}
return null;
}
function updateAdInteractions(objRef)
{
try{
var tagsInteractions = objRef.interactions;
var adminInteractions = objRef.ad.interactions;
for (attr in adminInteractions) 
{
var inter = adminInteractions[attr];
if ((typeof(inter) == "object") && (typeof(inter.RS) != "undefined"))
{
var lowerAttr = attr.toLowerCase();
if (typeof(tagsInteractions[lowerAttr]) != "object") 
tagsInteractions[lowerAttr] = new ebCInteraction(attr,adminInteractions[attr].nType);
tagsInteractions[lowerAttr].update(adminInteractions[attr]);
}
}
}catch(e)
{
gEbDbg.error("updateAdInteractions: " + e.description);
}
}
function setAutoInteractions(objRef)
{
try{
var interactions = objRef.interactions;
var eyeInter = interactions["_eyeblaster"];
interactions["_ebclick"] = new ebCInteraction("_ebClick",0);
var clickInter = interactions["_ebclick"];
clickInter.update(eyeInter);
clickInter.fCloseFlag = 0;
interactions["ebclose"] = new ebCInteraction("ebClose",0);
var inter = interactions["ebclose"];
inter.fCountAsClick = 0;
inter.fShouldReport = true;
interactions["ebfullplay"] = new ebCInteraction("ebFullPlay",0);
var inter = interactions["ebfullplay"];
inter.fCountAsClick = 0;
inter.fShouldReport = true;
inter.fCloseFlag = 0;
interactions["ebadduration"] = new ebCInteraction("ebAdDuration",1);
var inter = interactions["ebadduration"];
inter.fCountAsClick = 0;
inter.fShouldReport = true;
inter.fCloseFlag = 0;
interactions["ebintduration"] = new ebCInteraction("ebIntDuration",1);
var inter = interactions["ebintduration"];
inter.fCountAsClick = 0;
inter.fShouldReport = true;
inter.fCloseFlag = 0;
interactions["ebreplay"] = new ebCInteraction("ebReplay",0);
var inter = interactions["ebreplay"];
inter.fCountAsClick = 0;
inter.fShouldReport = true;
inter.fCloseFlag = 0;
}catch(e)
{
gEbDbg.error("setAutoInteractions: " + e.description);
}
}
function setBannerType()
{
if(gEbClientInfo.pluginInfo.flFlashVer == 0)
{
this.objType = 1; 
this.fImageOnly = true; 
gEbDbg.info("no flash Plug in - play image only");
return;
}
if (this.adData.fShowOnlyImage)
{
this.objType = 1;
this.fImageOnly = true; 
gEbDbg.info("Show Only Image flag was given");
return;
}
if ((this.ad.flFlashVer <= gEbClientInfo.pluginInfo.flFlashVer) || (this.adData.fPromptForPlugins))
{
if(this.ad.strDefaultFlash == "")
{
this.objType = 1; 
gEbDbg.info("no flash object - set default image");
}
else
{
this.objType=2; 
gEbDbg.info("set default flash");
}
}
else
{
this.objType=1; 
this.fImageOnly = true; 
gEbDbg.info("no sufficent pluginst ad:" + this.ad.flFlashVer + " user:" + gEbClientInfo.pluginInfo.flFlashVer + " - set default image");
}
}
}
function ebCMetaData()
{
readMetaTags();
function readMetaTags()
{
gEbAd = new Object();
gEbAd.nAdType = 1;
gEbInteractions = new Object();
var metaTags = document.getElementsByTagName("META");
var tmp;
if (null != metaTags)
{
gEbDbg.info("Start Reading Meta Tags");
for (var i=0; i<metaTags.length; i++)
{
gEbDbg.debug2("META - NAME: " + metaTags[i].getAttribute("name"));
switch (metaTags[i].getAttribute("name"))
{
case "eyeblasterFlightID" :
case "eyeblasterAdvertismentID" :
case "eyeblasterAdvertisementID" :
gEbAd.nFlightID = metaTags[i].getAttribute("Value");
gEbDbg.debug("eyeblasterFlightID : " + gEbAd.nFlightID);
break;
case "eyeblasterAdID" :
gEbAd.nAdID = metaTags[i].getAttribute("Value");
var tempTestFlag = metaTags[i].getAttribute("Mode");
if((tempTestFlag != null)&&(tempTestFlag.toLowerCase() == "test"))
gEbAd.fTest = true;
if (gEbAd.fTest)
gEbDbg.debug("eyeblasterAdID : " + gEbAd.nAdID + " (TEST MODE)");
else
gEbDbg.debug("eyeblasterAdID : " + gEbAd.nAdID);
break;
case "eyeblasterRightAlignment" :
gEbAd.nRightAlignment = metaTags[i].getAttribute("Value");
gEbDbg.debug("eyeblasterRightAlignment : " + gEbAd.nRightAlignment);
break;
case "eyeblasterSiteID" :
gEbAd.nSiteID = metaTags[i].getAttribute("Value");
gEbDbg.debug("eyeblasterSiteID : " + gEbAd.nSiteID);
break;
case "eyeblasterKeyword" :
gEbAd.strKeyword = metaTags[i].getAttribute("Value");
gEbDbg.debug("eyeblasterKeyword : " + gEbAd.strKeyword);
break;
case "eyeblasterPage" :
gEbAd.strPage = metaTags[i].getAttribute("Value");
gEbAd.fWebPageSrc = true;
gEbDbg.debug("eyeblasterPage : " + gEbAd.strPage);
break;
case "eyeblasterDomain" :
var tmpDomain = metaTags[i].getAttribute("Value");
if (isValid(tmpDomain))
{
gstrEbDomain = tmpDomain;
gEbDbg.debug("eyeblasterDomain : " + gstrEbDomain);
gEbDbg.always("THERE IS A DOMAIN META TAG, THEREFORE THE CLIENT INFO IS INITIATED AGAIN WITH THE NEW DOMAIN: " + gstrEbDomain);
gEbClientInfo.cookieInfo.setDomain(gstrEbDomain);
gEbClientInfo.history.init();
}
break;
case "eyeblasterPreview" :
gfEbPreview = true;
gEbDbg.debug("eyeblasterPreview");
break;
case "eyeblasterInteraction" :
var name = metaTags[i].getAttribute("Value");
if (isValid(name)== false)
continue;
var strNUrl = "";
var strAUrl = "";
tmp = metaTags[i].getAttribute("NetworkReportingURL");
if (isValid(tmp))
strNUrl = tmp;
else
{
tmp = metaTags[i].getAttribute("ReportingURL"); 
if (isValid(tmp))
strNUrl = tmp;
}
tmp = metaTags[i].getAttribute("AgencyReportingURL");
if (isValid(tmp))
strAUrl = tmp;
gEbInteractions[name] = "";
if(strAUrl != "")
gEbInteractions[name] = "ebA=" + strAUrl + ";" ;
if(strNUrl != "")
gEbInteractions[name] += "ebN=" + strNUrl + ";";
gEbDbg.debug("eyeblasterInteraction : name - " + name + " Network - " + strNUrl + " Agency - " + strAUrl);
break;
case "eyeblasterClickURL" :
var strNUrl = "";
var strAUrl = "";
var url = metaTags[i].getAttribute("Network");
if (isValid(url))
strNUrl = url;
url = metaTags[i].getAttribute("Agency");
if (isValid(url))
strAUrl = url;
gEbInteractions["_eyeblaster"] = "";
if(strAUrl != "")
gEbInteractions["_eyeblaster"] = "ebA=" + strAUrl + ";" ;
if(strNUrl != "")
gEbInteractions["_eyeblaster"] += "ebN=" + strNUrl + ";";
gEbDbg.debug("eyeblasterClickURL : Network - " + strNUrl + " Agency - " + strAUrl);
break;
case "eyeblasterPlayURL" :
gEbAd.playRS = new Object();
var url = metaTags[i].getAttribute("Network");
if (isValid(url))
gEbAd.playRS.strNUrl = url;
url = metaTags[i].getAttribute("Agency");
if (isValid(url))
gEbAd.playRS.strAUrl = url;
gEbDbg.debug("eyeblasterPlayURL : Network - " + gEbAd.playRS.strNUrl + " Agency - " + gEbAd.playRS.strAUrl);
break;
case "eyeblasterDisplayPosition" :
tmp = metaTags[i].getAttribute("Value");
if (isValid(tmp))
gstrEbDisplayPos = tmp;
gEbDbg.debug("eyeblasterDisplayPosition : " + gstrEbDisplayPos);
break;
case "eyeblasterBannerPosition" :
gEbAd.bannerPos = new Object();
gEbAd.bannerPos.strType = "Object";
tmp = metaTags[i].getAttribute("PositionType");
if (isValid(tmp))
{
switch (tmp.toLowerCase())
{
case "overlay" :
gEbAd.bannerPos.nType = 0;
break;
case "iframe banner swap" :
gEbAd.bannerPos.nType = 1;
break;
case "banner swap" :
gEbAd.bannerPos.nType = 2;
break;
default :
gEbAd.bannerPos.nType = -1;
gEbDbg.error("Error in meta tag eyeblasterBannerPosition. unknown PositionType:" + tmp);
break;
}
}
gEbDbg.debug("eyeblasterBannerPosition : '" + tmp + "' (" + gEbAd.bannerPos.nType + ")");
tmp = metaTags[i].getAttribute("BannerName");
if (isValid(tmp))
gEbAd.bannerPos.strBannerName = tmp;
tmp = metaTags[i].getAttribute("AlternateBannerName");
if (isValid(tmp))
gEbAd.bannerPos.strAlternateBanner = tmp;
gEbDbg.debug("eyeblasterBannerPosition : Name - '" + gEbAd.bannerPos.strBannerName + "' Alternate - '" + gEbAd.bannerPos.strAlternateBanner + "'");
break;
case "eyeblasterDownloadMode":
var tmpVal = metaTags[i].getAttribute("Value");
if(document.body != null)
{
if((tmpVal != null)&&(tmpVal != "")&&(tmpVal != 'undefined'))
gEbAd.nDownloadMode = parseInt(tmpVal);
}
else
{
gEbAd.nDownloadMode = 1;
gEbDbg.attention("the tags are in the head section - ad will run on polite downloadMode ");
}
gEbDbg.debug("eyeblasterDownloadMode : " + gEbAd.nDownloadMode);
break;
}
}
gEbDbg.info("Done Reading Meta Tags");
}
}
function isValid(str)
{
if ((typeof(str) != "undefined") && (str != null) && (str != ""))
return(true)
return(false);
}
}
function ebCAdFromCookie()
{
this.run = run;
this.buildAd = buildAd;
this.runWinAd = runWinAd;
if ((typeof(gEbAdWindow) == "undefined") && (typeof(gfEbBannerInInnerIframe) == "undefined"))
this.run();
else
this.runWinAd();
function runWinAd()
{
try{
gEbDbg.setDbgLvl(ebDbgLvl);
gEbDbg.always("runWinAd");
this.buildAd(strEbAd);
buildInteractions(strEbInteraction);
if (typeof(gEbAdWindow) != "undefined")
gEbAd.nDownloadMode=3;
}catch(e)
{
gEbDbg.error("ebCAdFromCookie.runWinAd: " + e.description);
}
}
function run()
{
try{
var strReadyAd = gEbClientInfo.cookieInfo.getReadyAd();
if(strReadyAd != "")
{
if(!isValidType())
return;
eval(strReadyAd);
if( (typeof(strCookieAd) == "undefined") ||
(typeof(strCookieInteractions) == "undefined"))
{
gEbDbg.attention("ebCAdFromCookie: Not a valid cookie format");
gEbClientInfo.cookieInfo.setReadyAd("");
gEbClientInfo.cookieInfo.setReadyAdType("");
return;
}
this.buildAd(strCookieAd);
gEbAd.nDownloadMode=3;
buildInteractions(strCookieInteractions);
gEbClientInfo.cookieInfo.setReadyAd("");
gEbClientInfo.cookieInfo.setReadyAdType("");
}
else
{
gEbDbg.attention("the ready ad cookie is empty.");
}
}catch(e)
{
gEbDbg.error("ebCAdFromCookie.run: " + e.description);
}
}
function isValidType()
{
var strAdType = gEbClientInfo.cookieInfo.getReadyAdType();
if(strAdType != "")
{
eval(strAdType);
if( (typeof(strCookieAdType) == "undefined") ||
(strCookieAdType != "WindowAd")&&(strCookieAdType != "CommercialBreak") )
{
gEbClientInfo.cookieInfo.setReadyAdType("");
gEbDbg.attention("ebCAdFromCookie.isValidType: the ready ad type is no valid(" + strCookieAdType + ")");
return false;
}
if(typeof(gEbAd.nFlightID) == "undefined")
{
gEbDbg.attention("ebCAdFromCookie: there is no flight id or siteID + keyword on gEbAd - do not run from cookie");
return false;
}
if( (typeof(nCookieFlightId) == "undefined")||
(nCookieFlightId != gEbAd.nFlightID))
{
gEbDbg.attention("ebCAdFromCookie: the ready ad not from this flight");
return false;
}
return true;
}
return false;
}
function buildAd(strCookieAd)
{
try{
gEbAd = new Object();
var adParams = strCookieAd.split("::");
gEbAd.fAdFromCookie = true;
gEbAd.nFlightID = adParams[0];
gEbAd.nAdID = adParams[1];
gEbAd.strLogID = adParams[2] ;
gEbAd.nSiteInterval = parseInt(adParams[3]);
gEbAd.strAdUrl = unescape(adParams[4]);
gEbAd.strTemplateName = adParams[5] ;
gEbAd.strPage = adParams[6];
gEbAd.fWebPageSource = parseInt(adParams[7]);
gEbAd.nSiteID = adParams[8];
gEbAd.playRS = new Object();
gEbAd.playRS.strNUrl = unescape(adParams[9]);
gEbAd.playRS.strAUrl = unescape(adParams[10]);
gEbAd.strRand = adParams[11];
gEbAd.nFlightInterval = parseInt(adParams[12]);
gEbAd.strBlankUrl = unescape(adParams[13]);
gEbAd.fPromptForPlugins = parseInt(adParams[14]);
gEbAd.nAdType = parseInt(adParams[15]);
gEbClientInfo.history.setLength(parseInt(adParams[16])); 
gEbAd.strOnPlay = unescape(adParams[17]); 
gEbAd.strOnStartDnl = unescape(adParams[18]); 
gEbAd.nImpressions = parseInt(adParams[19]);
gEbAd.bannerPos = new Object();
gEbAd.bannerPos.nType = parseInt(adParams[20]);
gEbAd.bannerPos.strBannerName = adParams[21];
gEbAd.bannerPos.strAlternateBanner = adParams[22];
gEbAd.fShowOnlyImage = parseInt(adParams[23]);
gEbAd.nLowBWLimit = parseInt(adParams[24]);
gEbAd.strInvitationUrl = unescape(adParams[25]);
gEbAd.nInvitationWidth = adParams[26];
gEbAd.nInvitationHeight = adParams[27];
gEbAd.nSurveyID = adParams[28];
gEbAd.strInvitationBannerUrl = unescape(adParams[29]);
gEbAd.nWidth = adParams[30];
gEbAd.nHeight = adParams[31];
gEbAd.nDownloadMode = parseInt(adParams[32]);
gEbAd.fCollectWebPages = parseInt(adParams[33]);
gEbAd.strDemoFolder = adParams[34];
}catch(e)
{
gEbDbg.error("ebCAdFromCookie.buildAd: " + e.description);
}
}
function buildInteractions(strCookieInteractions)
{
gEbInteractions = new Object();
var interactionsArr = strCookieInteractions.split("::");
var nLength = interactionsArr.length;
for(var i=0; i<nLength; i++)
{
interactionsArr[i] = interactionsArr[i].substr(1,interactionsArr[i].length-2);
var fields = interactionsArr[i].split(",");
var strName = fields[0];
gEbInteractions[strName] = new Object();
var inter = gEbInteractions[strName];
inter.strName = strName;
inter.fCloseFlag = fields[1];
inter.strJumpUrl = unescape(fields[2]);
inter.strTarget = fields[3];
inter.RS = new Object();
inter.RS.strNUrl = unescape(fields[4]);
inter.RS.strAUrl = unescape(fields[5]);
inter.jumpWin = new Object();
inter.jumpWin.strPosX = fields[6];
inter.jumpWin.strPosY = fields[7];
inter.jumpWin.strWidth = fields[8];
inter.jumpWin.strHeight = fields[9];
inter.jumpWin.strAddressBar = fields[10];
inter.jumpWin.strMenuBar = fields[11];
inter.fCountAsClick = fields[12];
inter.fShouldReport = fields[13];
inter.nType = fields[14];
inter.nValue = fields[15];
inter.nStartTime = fields[16];
}
}
}
function ebCDisplayPage()
{
this.TI = gEbTI;
this.topIframe = null;
this.fInIframe = false;
this.fValid = true;
this.ResizeIntervalId = -1;
this.getIframeData = getIframeData;
init(this);
function getIframeData()
{
try
{
if (!this.fInIframe)
return;
gEbDbg.info("ebCDisplayPage: Trying to get Iframe data");
var displayWin;
var browser = new ebCBrowserCheck();
if (browser.getEbBrowser() != 16)
displayWin = eval(gstrEbDisplayPos);
else
displayWin = top; 
var displayDoc = displayWin.document;
if (browser.getEbBrowser() != 16)
{
var currWindow = self;
do
{
var newWindow = currWindow.parent;
var framesArr = newWindow.frames;
var nFrameID = -1;
for (var i=0; i<framesArr.length;i++)
{
try {
if (framesArr[i] == currWindow)
{
nFrameID = i;
break;
}
}catch (e) {}
}
currWindow = newWindow;
}
while (currWindow != displayWin)
if (nFrameID == -1)
{
gEbDbg.fatal("getIframeData() - Can't find matching IFRAME");
this.fValid = false;
return;
}
var framesList = displayDoc.getElementsByTagName("iframe");
if (nFrameID >= framesList.length)
{
gEbDbg.fatal("ebCDisplayPage() - frameList is too short (" + framesList.length + "). Needed frame is " + nFrameID);
this.fValid = false;
return;
}
gEbDbg.info("Reference Iframe was found in index " + nFrameID);
this.topIframe = framesList[nFrameID];
}
else 
{
var frames = displayWin.document.getElementsByTagName("Iframe");
for (var i=0; i<frames.length; i++)
{
if (frames[i].contentDocument == parent.document)
{
this.topIframe = frames[i];
break;
}
}
if (this.topIframe == null)
{
gEbDbg.info("Reference Iframe was NOT found (NN6.2)");
this.fValid = false;
}
}
}
catch (e)
{
gEbDbg.fatal("exception in ebCDisplayPage:getIframeData() - " + e.description);
this.fValid = false;
}
}
function init(myObj)
{
try
{
if ((typeof(gfEbOnInternalIframe) != "undefined") && gfEbOnInternalIframe)
{
if (typeof(gstrEbDisplayPos) == "undefined")
eval("gstrEbDisplayPos = 'parent'");
gstrEbDisplayPos = "parent." + gstrEbDisplayPos;
myObj.fInIframe = true;
}
else
{
setEvents(myObj);
return;
}
myObj.getIframeData();
if (!myObj.fValid)
return;
var browser = new ebCBrowserCheck();
var displayWin = top;
if (browser.getEbBrowser() != 16)
displayWin = eval(gstrEbDisplayPos);
myObj.TI = new ebCTagInsertor(displayWin);
if(myObj.TI.doc.getElementById("eyeDiv") == null)
{
gEbDbg.info("ebCDisplayPage: Initializing eyeDiv on the main window");
var styleObj = new Object();
styleObj.position = "absolute";
styleObj.width = "0px";
styleObj.height = "0px";
styleObj.top = "0px";
styleObj.left = "0px";
var tempDiv = myObj.TI.addTable(myObj.topIframe,"eyeDiv",styleObj);
tempDiv.dir = "ltr";
}
else
gEbDbg.info("ebCDisplayPage: eyeDiv was already initialized on main window");
setEvents(myObj);
}
catch (e)
{
gEbDbg.fatal("exception in ebCDisplayPage() - " + e.description);
myObj.fValid = false;
}
}
function setEvents(myObj)
{
var browser = new ebCBrowserCheck();
if (browser.isIE())
{
if (myObj.TI.doc.readyState == 'complete') 
{
gEbDocLoaded = true;
myObj.TI.addEyeDiv("append","eyeDiv2");
}
else
{
myObj.TI.addEventHandler("load","ebOnloadHandler");
}
}
else
{
if (myObj.fInIframe)
{
gEbDocLoaded = true; 
myObj.TI.addEyeDiv("append","eyeDiv2");
}
else
myObj.TI.addEventHandler("load","ebOnloadHandler");
}
if (browser.isIE())
{
myObj.TI.addEventHandler("scroll","ebOnScroll");
}
else 
gEbTI.win.setInterval("ebOnScroll()",200);
myObj.TI.addEventHandler("resize","ebOnResize");
gEbTI.addEventHandler("unload","ebOnUnloadHandler");
if (!ebIsPreview())
{
gEbTI.addEventHandler("beforeunload","ebReportAllInteractions");
gEbTI.addEventHandler("unload","ebReportAllInteractions");
}
}
}
function ebInitEye()
{
try{
var nID = gEbEyes.length;
gEbDbg.always("<BR>Initializing Ad " + nID + " (Type : " + gEbAd.nAdType + ")");
if (typeof(gEbInteractions) == "undefined")
gEbEyes[nID] = new ebCEye(nID,gEbAd);
else
gEbEyes[nID] = new ebCEye(nID,gEbAd,gEbInteractions);
gEbAdForWindow = gEbAd;
gEbAd = null;
if (typeof(gEbInteractions) != "undefined")
{
gEbInteractionsForWindow = gEbInteractions;
gEbInteractions = null;
}
if(gEbDocLoaded || (gEbEyes[nID].adData.nAdType == 2)||(gEbEyes[nID].adData.nDownloadMode > 1))
gEbEyes[nID].startFlow();
}catch(e)
{
gEbDbg.error("ebInitEye: " + e.description);
}
}
function ebBannerBWDetectHandler()
{
gEbDbg.always("the band width image was loaded");
gEbClientInfo.pluginInfo.bandWidth.detect();
}
function ebOnloadHandler()
{
try{
gEbDbg.always("ebOnloadHandler: the page was loaded" );
gEbDocLoaded = true;
gEbDisplayPage.TI.addEyeDiv("append","eyeDiv2");
if(gEbDisplayPage.ResizeIntervalId != -1)
{
gEbDbg.always("clear the resize interval");
var strFunc = "gEbDisplayPage.TI.win.clearInterval('" + gEbDisplayPage.ResizeIntervalId + "');";
window.setTimeout(strFunc,1000);
gEbDisplayPage.ResizeIntervalId = -1;
}
for(i=0;i<gEbEyes.length;i++)
{
gEbEyes[i].doOnLoad();
if (gEbEyes[i].displayUnit != null)
if(typeof(gEbEyes[i].displayUnit.doOnload) == 'function')
gEbEyes[i].displayUnit.doOnload();
}
}catch(e)
{
gEbDbg.error("ebOnloadHandler: " + e.description);
}
}
function ebOnUnloadHandler()
{
try{
gEbDbg.always("ebOnUnloadHandler: unload was fired" );
for(i=0;i<gEbEyes.length;i++)
{
if (gEbEyes[i].displayUnit != null)
{
if(typeof(gEbEyes[i].displayUnit.doOnUnload) == 'function')
gEbEyes[i].displayUnit.doOnUnload();
var win = gEbEyes[i].displayUnit.adTI.win;
gEbEyes[i].displayUnit.showHidePageElements(true,win)
}
}
}catch(e)
{
gEbDbg.error("ebOnUnloadHandler: " + e.description);
}
}
function ebOnResize()
{
try{
gEbDbg.always("ebOnResize: " );
for(i=0;i<gEbEyes.length;i++)
{
if (gEbEyes[i].displayUnit != null)
if(typeof(gEbEyes[i].displayUnit.doOnResize) == 'function')
gEbEyes[i].displayUnit.doOnResize();
}
}catch(e)
{
gEbDbg.error("ebOnResize: " + e.description);
}
}
function ebOnScroll()
{
try{
for(i=0;i<gEbEyes.length;i++)
{
if (gEbEyes[i].displayUnit != null)
if(typeof(gEbEyes[i].displayUnit.doOnScroll) == 'function')
gEbEyes[i].displayUnit.doOnScroll();
}
}catch(e)
{
gEbDbg.error("ebOnScroll: " + e.description);
}
}
function eyeEventListener(id, arg)
{
try{
for(i=0;i<gEbEyes.length;i++)
{
if (gEbEyes[i].displayUnit != null)
if(typeof(gEbEyes[i].displayUnit.handleEyewonderEvent) == 'function')
gEbEyes[i].displayUnit.handleEyewonderEvent(id,arg);
}
}catch(e)
{
gEbDbg.error("eyeEventListener id= "+ id + " : " + e.description);
}
}
function ebLoadIframe(src)
{
gEbDbg.debug("ebLoadIframe("+src +")");
var iframeAttr = new ebCTIObj();
iframeAttr.src = src;
iframeAttr.style.width = "0px";
iframeAttr.style.height = "0px";
iframeAttr.frameborder = 0;
gEbTI.addIframe("append",iframeAttr);
}
function ebLoadScript(scriptID, scriptSrc)
{
try{
gEbDbg.debug("ebLoadScript("+scriptSrc +"," + scriptID + ")");
gEbTI.addScript("append",scriptSrc,scriptID,"");
}catch(e)
{
gEbDbg.error("ebLoadScript: " + e.description);
}
}
function ebScriptLoaded(name)
{
try{
if (name.indexOf("eb") != 0)
name = "eb" + name;
gEbDbg.info("ebScriptLoaded() - script: " + name + " was loaded");
gEbEyes[0].addLoadedScript(name);
for(var i=0;i<gEbEyes.length; i++)
gEbEyes[i].doOnScriptLoad();
}catch(e)
{
gEbDbg.error("ebScriptLoaded: " + e.description);
}
}
function ebCompatContinue()
{
try{
if (typeof(gEbDisplayPage) == "undefined") 
{
gEbDisplayPage = new ebCDisplayPage();
if (gEbDisplayPage.fValid == false)
{
gEbDbg.fatal("Can't run Ad : Error in creating Display Page object");
return;
}
}
if(gEbfOfflineDemo)
{
if(typeof(gEbAd) == "undefined")
new ebCAdFromCookie();
ebInitEye();
return;
}
if (typeof(gfEbBannerInInnerIframe) != "undefined")
{
new ebCAdFromCookie();
ebInitEye();
return;
}
var fAdExist = ((typeof(gEbAd) != "undefined") && (gEbAd != null));
var fBannerExist = ((typeof(gEbBanner) != "undefined") && (gEbBanner != null));
var fMetaExist = false;
if (fBannerExist)
gnEbCounter--;
if (fAdExist)
gnEbCounter--;
if (gnEbCounter > 0)
fMetaExist = true;
var tmpAd = null;
var tmpInteractions = null;
if (fAdExist)
{
tmpAd = gEbAd;
if (typeof(gEbAd.interactions) != "undefined")
{
tmpInteractions = gEbAd.interactions;
gEbAd.interactions = "";
}
else
if ((typeof(gEbInteractions) != "undefined") && (gEbInteractions != null))
tmpInteractions = gEbInteractions;
}
if (fBannerExist)
{
gEbAd = gEbBanner;
gEbAd.nAdType = 2;
if (typeof(gEbBanner.interactions) != "undefined")
{
gEbInteractions = gEbAd.interactions;
gEbAd.interactions = "";
}
gEbBanner = null;
if(gEbAd.nAdType == 1)
ebCompatibleOOB();
else
ebCompatibleBanner();
}
if (fAdExist)
{
gEbAd = tmpAd;
if (typeof(gEbAd.nAdType) == "undefined")
gEbAd.nAdType = 1; 
gEbInteractions = tmpInteractions;
if(gEbAd.nAdType == 1)
ebCompatibleOOB();
else
ebCompatibleBanner();
}
if (fMetaExist)
{
gEbDbg.attention("gEBAd does not exist - trying to read meta tags (backward compatability)");
var metaData = new ebCMetaData();
ebCompatibleOOB();
}
}catch(e)
{
gEbDbg.error("ebCompatContinue: " + e.description);
}
}
function ebCompatibleBanner()
{
ebInitEye();
}
function ebCompatibleOOB()
{
if ((typeof(gfEbInIframe) != "undefined") && gfEbInIframe)
{
gEbDbg.attention("OOB will be handled in the inner Iframe");
return;
}
ebTimeBetweenAnn();
}
function ebTimeBetweenAnn()
{
try{
var dtCurrentTime = new Date().getTime();
dtCurrentTime = parseFloat(dtCurrentTime);
var cookieTime = gEbClientInfo.cookieInfo.getBurstingTime();
cookieTime = parseFloat(cookieTime);
if (isNaN(cookieTime))
cookieTime = 0;
if(dtCurrentTime >= cookieTime)
{
if((typeof(gEbAd.fShowIfReady) == "undefined")||(gEbAd.fShowIfReady))
new ebCAdFromCookie();
if((typeof(gEbAd.nFlightID) != "undefined") && (typeof(gEbAd.fAdFromCookie) == "undefined"))
{
var histItem = gEbClientInfo.history.getItem(gEbAd.nFlightID);
if(histItem != null)
{
if(dtCurrentTime < histItem.dtNextDisplay)
{
gEbDbg.always("flight next display time didn't pass");
gEbDbg.always("current time: " + histItem.getDateAsStr(dtCurrentTime,true) );
gEbDbg.always("flight next display time: " + histItem.getDateAsStr(histItem.dtNextDisplay,true));
return;
}
}
}
ebInitEye();
}
else
{
gEbDbg.always("minnimun time between announcements didn't pass");
}
}catch(e)
{
gEbDbg.error("ebTimeBetweenAnn: " + e.description);
}
}
function ebMaxTime()
{
try{
ebMaxTimePassed = true;
ebReportAllInteractions(true);
var browser = new ebCBrowserCheck();
if(browser.isIE())
{
window.detachEvent("onunload",ebReportAllInteractions);
window.detachEvent("onbeforeunload",ebReportAllInteractions);
}
else
{
window.removeEventListener("beforeunload",ebReportAllInteractions,false);
window.removeEventListener("unload",ebReportAllInteractions,false);
}
}catch(e)
{
gEbDbg.error("ebMaxTime: " + e.description);
}
}
function ebAddInteractionsFlash()
{
var TIobj = new ebCTIObj("ebReportingFlash");
TIobj.src = ebBigS + "/res/Empty_Movie.swf";
TIobj.style.position = "absolute";
TIobj.style.width = "0px";
TIobj.style.height = "0px";
TIobj.play = false;
gEbTI.addFlash("write" , TIobj);
}
function ebReportAllInteractions(fUseImg)
{
try{
if(gEbfOfflineDemo)
{
gEbDbg.warning("ebReportAllInteractions: offline demo there will be no report ");
return;
}
if(gEbfIntReported)
{
gEbDbg.warning("ebReportAllInteractions: interactions were allready reported");
return;
}
var browser = new ebCBrowserCheck();
if(typeof(fUseImg) != "boolean")
fUseImg = false;
gEbDbg.info("ebReportAllInteractions: " );
var strIntToReport = "";
var nValidIntIndex = 0;
for(var index=0;index<gEbEyes.length;index++)
{
if (gEbEyes[index].displayUnit != null)
{
if(strIntToReport != "")
strIntToReport += '|';
strIntToReport += gEbEyes[index].displayUnit.collectTimers(false);
nValidIntIndex = index;
}
}
if(strIntToReport != "")
{
gEbDbg.debug2("ebReportAllInteractions: the pipe url will be taken from eye " + nValidIntIndex);
var interact = gEbEyes[nValidIntIndex].displayUnit.interactions["_eyeblaster"];
var reportUrl = interact.getPipeUrl() + "?interactionsStr=" +
escape(strIntToReport) + "&ebRandom=" + Math.random();
gEbDbg.attention("reporting all interactions: ");
gEbDbg.debug(reportUrl);
var reportingFlash = document.getElementById("ebReportingFlash");
if(fUseImg || (reportingFlash == null))
{
interact.reportingImg = new Image();
interact.reportingImg.src = reportUrl;
gEbDbg.debug2("ebReportAllInteractions: use image to report");
}
else
{
reportingFlash.LoadMovie(0,reportUrl);
gEbDbg.debug2("ebReportAllInteractions: use flash to report");
}
}
ebMaxTimePassed = true;
gEbfIntReported = true;
}catch(e)
{
gEbDbg.error("ebReportAllInteractions: " + e.description);
}
}
function ebShowInvitation()
{
try{
gEbDbg.attention("ebShowInvitation");
if(gEbfInvitaionWasOpened)
{
gEbDbg.warning("ebShowInvitation - invitation was allready shown");
return;
}
for(var index=0;index<gEbEyes.length;index++)
{
var adData = gEbEyes[index].adData;
gEbDbg.debug2("ebShowInvitation " + adData.nAdID + " " + adData.nSurveyID);
if(adData.nSurveyID != -1)
{
gEbEyes[index].openInvitationPopUp();
gEbfInvitaionWasOpened = true;
gEbDbg.info("a brand study invatation was opened to ad " + adData.nAdID);
return;
}
}
gEbDbg.warning("ebShowInvitation: there is no invitation to show" );
}catch(e)
{
gEbDbg.error("ebShowInvitation: " + e.description);
}
}
function ebLoadSurvey(strObjName)
{
try{
var eyeObj = eval(strObjName);
var adData = eyeObj.adData;
var browser = new ebCBrowserCheck();
var strUrl = eyeObj.buildSurveyUrl(adData);
gEbDbg.debug2("ebLoadSurvey: the survey url is:");
gEbDbg.debug(strUrl);
var strWinAttr = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=775,height=700";
window.open(strUrl,"_blank",strWinAttr);
if(browser.isIE())
{
window.detachEvent("onunload",ebShowInvitation);
window.detachEvent("onbeforeunload",ebShowInvitation);
}
else
{
window.removeEventListener("unload",ebShowInvitation,false);
window.removeEventListener("beforeunload",ebShowInvitation,false);
}
}catch(e)
{
gEbDbg.error("ebLoadSurvey: " + e.description);
}
}
var gEbDocLoaded = false;
var ebMaxTimePassed = false;
var gEbfIntReported = false;
var gEbfInvitaionWasOpened = false;
var gEbDbg = new ebCDebug();
var gEbTI = new ebCTagInsertor(self);
if (typeof(gfEbActiveXPreview) == "undefined") 
gEbTI.addEyeDiv("write","eyeDiv");
if (typeof(gstrEbDomain) != "undefined")
var gEbClientInfo = new ebCClientInfo("gEbClientInfo",gstrEbDomain);
else
var gEbClientInfo = new ebCClientInfo("gEbClientInfo");
gEbClientInfo.init();
var gEbEyes = new Array();
if((typeof(gEbAd) == "undefined")||(typeof(gEbAd.fNoStartOnLoad) == "undefined")||(gEbAd.fNoStartOnLoad == false))
ebCompatContinue();
else
gEbDbg.info("the scripts were loaded without running the ad!");
if (!ebIsPreview()&&!gEbfOfflineDemo)
{
window.setTimeout("ebMaxTime()",gEbnMaxTimerTime);
if (gEbClientInfo.pluginInfo.flFlashVer >= 6)
ebAddInteractionsFlash();
}
if(typeof(ebDoOnMainLoad) == "function")
ebDoOnMainLoad();
