String.prototype.trim=function(){return this.replace(/^\s\s*/,"").replace(/\s\s*$/,"");};String.prototype.endsWith=function(s){return(s==this.substring(this.length-s.length));};String.prototype.beginsWith=function(s){return(this.indexOf(s)==0);};String.prototype.contains=function(s){return(this.indexOf(s)!=-1);};String.prototype.escapePercents=function(){return this.replace(/%/g,"%%");};String.prototype.unescapePercents=function(){return this.replace(/%%/g,"%");};String.prototype.stripExtension=function(){var _1=this.lastIndexOf(".");return(_1==-1?this:this.substring(0,this.lastIndexOf(".")));};var Base64=function(){var _2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var _3={};function _4(_5){var _6="",c1,c2,c3,e1,e2,e3,e4;for(var i=0;i<_5.length;){c1=_5.charCodeAt(i++);c2=_5.charCodeAt(i++);c3=_5.charCodeAt(i++);e1=c1>>2;e2=((c1&3)<<4)+(c2>>4);e3=((c2&15)<<2)+(c3>>6);e4=c3&63;if(isNaN(c2)){e3=e4=64;}else{if(isNaN(c3)){e4=64;}} _6+=_2.charAt(e1)+_2.charAt(e2)+_2.charAt(e3)+_2.charAt(e4);} return _6;};_3.encode=_4;function _7(_8,cb){var _9="",c1,c2,c3,e1,e2,e3,e4;var _a=0;var _b=function(){for(var i=0;i<100&&_a<_8.length;i++){c1=_8.charCodeAt(_a++);c2=_8.charCodeAt(_a++);c3=_8.charCodeAt(_a++);e1=c1>>2;e2=((c1&3)<<4)+(c2>>4);e3=((c2&15)<<2)+(c3>>6);e4=c3&63;if(isNaN(c2)){e3=e4=64;}else{if(isNaN(c3)){e4=64;}} _9+=_2.charAt(e1)+_2.charAt(e2)+_2.charAt(e3)+_2.charAt(e4);} if(_a<_8.length){window.setTimeout(arguments.callee,100);}else{cb(_9);}}();};_3.iEncode=_7;function _c(_d){var _e="",c1,c2,c3,e1,e2,e3,e4;for(var i=0;i<_d.length;){e1=_2.indexOf(_d.charAt(i++));e2=_2.indexOf(_d.charAt(i++));e3=_2.indexOf(_d.charAt(i++));e4=_2.indexOf(_d.charAt(i++));c1=(e1<<2)+(e2>>4);c2=((e2&15)<<4)+(e3>>2);c3=((e3&3)<<6)+e4;_e+=String.fromCharCode(c1);if(e3!=64){_e+=String.fromCharCode(c2);} if(e4!=64){_e+=String.fromCharCode(c3);}} return _e;};_3.decode=_c;return _3;}();var UrlLib=function(){function _f(_10){_10=_10.replace(/\r\n/g,"\n");var _11="";for(var n=0;n<_10.length;n++){var c=_10.charCodeAt(n);if(c<128){_11+=String.fromCharCode(c);}else{if((c>127)&&(c<2048)){_11+=String.fromCharCode((c>>6)|192);_11+=String.fromCharCode((c&63)|128);}else{_11+=String.fromCharCode((c>>12)|224);_11+=String.fromCharCode(((c>>6)&63)|128);_11+=String.fromCharCode((c&63)|128);}}} return _11;};function _12(_13){var _14="";var i=0;var c,c1,c2,c3;c=c1=c2=c3=0;while(i<_13.length){c=_13.charCodeAt(i);if(c<128){_14+=String.fromCharCode(c);i++;}else{if((c>191)&&(c<224)){c2=_13.charCodeAt(i+1);_14+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}else{c2=_13.charCodeAt(i+1);c3=_13.charCodeAt(i+2);_14+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}} return _14;};var _15={};function _16(_17){return encodeURI(_f(_17));};_15.encode=_16;function _18(_19){return _12(decodeURI(_19));};_15.decode=_18;function _1a(url){var _1b="";var _1c=url.lastIndexOf("/")+1;if(_1c===0){return url;} _1b=url.substring(_1c);var _1d=_1b.lastIndexOf("?");if(_1d!=-1){_1b=_1b.substring(0,_1d);} _1b=_1b.replace(/[^A-Za-z0-9.]/g,"");var _1e=_1b.toLowerCase();if(!(_1e.endsWith(".gif")||_1e.endsWith(".png")||_1e.endsWith(".jpg")||_1e.endsWith(".jpeg")||_1e.endsWith(".zip"))){_1b+=".jpg";} return _1b;};_15.getCreativeFilenameFromUrl=_1a;function _1f(url){return url.replace(/\^/g,"%5E").replace(/\|/g,"%7C");};_15.encodeLimited=_1f;return _15;}();function nowAsStr(){return new Date().getTime().toString();};var AD_SIZE_DELIMITER="$$_GSSZ_$$";var NetworkStatus={OFFLINE:0,CELLULAR:1,WIFI:2};var AdType={STATIC:0,RICH_XML:1,RICH_HTML:2};var Sql={CREATE_IF_NOT_EXISTS_ADS_TABLE:"CREATE TABLE IF NOT EXISTS ads('slotName' TEXT, 'id' TEXT, 'dlTime' INTEGER, 'type' INTEGER, 'content' TEXT, 'trackers' TEXT, 'clickText' TEXT, 'clickthrough' TEXT, 'expiration' INTEGER, PRIMARY KEY ('slotName', 'dlTime'))",CREATE_IF_NOT_EXISTS_ADTAGS_TABLE:"CREATE TABLE IF NOT EXISTS adTags('slotName' TEXT PRIMARY KEY, 'url' TEXT)"};function AdData(_20,ID,_21,_22,_23,_24,_25,_26,_27,_28,_29){this.slotName=_20;this.ID=ID;this.dlTime=_21;this.type=_22;this.content=_23;this.trackers=_24;this.clickText=(typeof _25==="undefined"?"":_25);this.clickthrough=(typeof _26==="undefined"?"":_26);this.expiration=_27;this.width=_28;this.height=_29;};var CBManager=function(){var _2a=[];var _2b=0;var _2c={};var _2d={INT:"%d",FLOAT:"%f",FLOAT_2:"%f, %f",NONE:"",STRING:"%s",VAR_ARGS:"%s"};_2c.ReturnType=_2d;function _2e(_2f,_30){_2a[_2b]=_2f;return"CBManager.execCallback("+_2b+++(_30==_2d.NONE?"":(", "+_30))+");";};_2c.registerCallback=_2e;function _31(id){var _32=_2a[id];if(typeof _32!="function"){}else{_32.apply(null,Array.prototype.slice.call(arguments,1));_2a[id]=null;}};_2c.execCallback=_31;return _2c;}();var DemographicAd=function(){var _33=3;var _34="X";var _35="";function _36(_37,_38){var _39=CBManager.registerCallback(function(_3a){_3b(_3a,_37,_38);},CBManager.ReturnType.STRING);BridgeLib.sqlExecuteWithCallback("SELECT slotName, url FROM adTags",_39);};function _3b(_3c,_3d,_3e){var _3f=eval("("+_3c+")");for(var i=0;i<_3f.length;i++){var _40=_3f[i][0];var _41=_3f[i][1];if(_41.endsWith("&q=")){_41+=_3d;}else{_41+="%%20"+_3d;} BridgeLib.sqlExecute("UPDATE adTags set url='"+_41+"' WHERE slotName='"+_40+"'");} BridgeLib.callback(_3e);};var _42={};var Sql={CREATE_IF_NOT_EXISTS_ANSWERS_TABLE:"CREATE TABLE IF NOT EXISTS demographicAnswers('key' TEXT PRIMARY KEY, 'value' TEXT, 'skipCount' INTEGER default '0')",GET_ALL_ANSWERS:"SELECT value FROM demographicAnswers",CLEAR_ALL_ANSWERS:"DELETE FROM demographicAnswers WHERE value IS NOT NULL"};_42.Sql=Sql;function _43(_44){_35=_44;};_42.init=_43;function _45(_46,_47,_48){var _49=_47;if(_46!=="[]"){var _4a=eval("("+_46+")");for(var i=0;i<_4a.length;i++){if(_4a[i][0]===null){continue;} _49+=_4a[i][0];if(i!==(_4a.length-1)){if(_48){_49+="%%20";}else{_49+="%20";}}}} return _49;};_42.generateKeywordString=_45;function _4b(_4c){var _4d=_35+_34+_4c;BridgeLib.sqlExecute("INSERT OR REPLACE INTO demographicAnswers(key, value, skipCount) VALUES('"+_35+"', '"+_4d+"', 0)");_36(_4d,"RichAd.returnToGame();");};_42.saveDemographicAdAnswer=_4b;function _4e(){BridgeLib.sqlExecuteWithCallback("SELECT skipCount FROM demographicAnswers WHERE key='"+_35+"'","DemographicAd.updateSkipCount(%s,'"+_35+"');");};_42.skipDemographicAd=_4e;function _4f(_50,_51){var _52;if(_50!=="[]"){_52=eval(_50);} if(_50==="[]"||_52[0][0]==="0"){BridgeLib.sqlExecuteWithCallback("INSERT INTO demographicAnswers(key, skipCount) VALUES('"+_51+"', 1)","RichAd.returnToGame(%s);");}else{var _53=parseInt(_52[0][0],10);++_53;var _54="";if(_53>=_33){_54=_51+_34+"skip";BridgeLib.sqlExecute("UPDATE demographicAnswers SET skipCount="+_53+", value='"+_54+"' WHERE key='"+_51+"'");_36(_54,"RichAd.returnToGame();");}else{BridgeLib.sqlExecuteWithCallback("UPDATE demographicAnswers SET skipCount="+_53+" WHERE key='"+_51+"'","RichAd.returnToGame(%s);");}}};_42.updateSkipCount=_4f;return _42;}();var RACNotifier=function(){var _55;var _56=[];function _57(){_55=null;_56.splice(0,_56.length);};var _58={};var _59={DISPLAYED:"displayed",WILL_EXIT:"willexit"};_58.EVENTS=_59;function _5a(_5b){_55=_5b;while(_56.length>0){_5c(_56.shift());}};_58.registerBridgeDelegate=_5a;function _5c(_5d){if(typeof _55=="function"){_55({data:_5d});if(_59.WILL_EXIT===_5d){_57();}}else{if(_59.WILL_EXIT===_5d){_57();}else{_56.push(_5d);}}};_58.notify=_5c;return _58;}();var RichAd=function(){var _5e;var _5f;var _60;var _61;var _62;var _63;var _64;var _65;var _66;var _67;function _68(_69,_6a){if(_69.readyState==4){if(typeof _69.timer!="undefined"){window.clearTimeout(_69.timer);} try{if(typeof _6a!="undefined"){_6a();}} catch(e){}}};function _6b(_6c,_6d){_6c.abort();try{if(typeof _6d!="undefined"){_6d();}} catch(e){}};var _6e={};function _6f(){return _5f;};_6e.getClickthrough=_6f;function _70(){return _61;};_6e.getWidth=_70;function _71(){return _62;};_6e.getHeight=_71;function _72(){return _67;};_6e.isExpanded=_72;function _73(_74,_75,_76,_77,_78){_5e=_74;_5f=_75;_60=_76;_61=_77;_62=_78;_63=false;_67=false;};_6e.init=_73;function _79(_7a){_64=_7a;};_6e.registerAdExitHandler=_79;function _7b(){if(!_63){try{if(_64){_64();_64=null;} RACNotifier.notify(RACNotifier.EVENTS.WILL_EXIT);} catch(e){}} _63=true;};_6e.handleAdExit=_7b;function _7c(){window.location="greystripe://ct/";};_6e.handleClick=_7c;function _7d(url,_7e){var _7f;if(typeof url==="string"){if(_7e){_7f=url;}else{_7f=_5f+url;}}else{_7f=_5f;} if(g_currentAdContext.isFullScreen||_67){_80(_7f);}else{var _81=CBManager.registerCallback(function cb(){_80(_7f);},CBManager.ReturnType.NONE);BridgeDisplay.requestClickthroughWithCallback(_81);}};_6e.goToUrl=_7d;function _80(url){_7b();handleClickthroughClick(url);};_6e.canGoToUrl=_80;function _82(){_7b();clearDisplay();BridgeDisplay.dismiss();};_6e.returnToGame=_82;function _83(_84){document.body.style.background=_84;};_6e.setBackgroundColor=_83;function _85(_86,_87){var _88=new XMLHttpRequest();_88.onreadystatechange=function(){_68(_88,_86);};if(typeof _87!="undefined"){_88.timer=window.setTimeout(function(){_6b(_88,_86);},_87);} var url=_5f;if(_5f.endsWith("k=")){url+="http://www.google.com";} _88.open("GET",url);_88.send(null);};_6e.trackZedoClick=_85;function _89(){return true;};_6e.shouldAdSelfCenter=_89;function _8a(_8b){if(typeof _8b!="undefined"){if(_8b>0){BridgeDisplay.captureAccelerometer(_8b);}else{BridgeDisplay.captureAccelerometer(DISABLED_ACCELEROMETER_INTERVAL);}}else{BridgeDisplay.captureAccelerometer(ENABLED_ACCELEROMETER_INTERVAL);}};_6e.enableAccelerometer=_8a;function _8c(){BridgeAudio.initializeWithSlotNameDlTime(g_currentAdContext.adData.slotName,g_currentAdContext.adData.dlTime);};_6e.initializeAudio=_8c;function _8d(){return _63;};_6e.isDisplayComplete=_8d;function _8e(){return _5e===""||_5f==="";};_6e.isImmersion=_8e;function _8f(_90){_66=_90;BridgeDisplay.requestClickthroughWithCallback("RichAd.canExpand();");};_6e.expand=_8f;function _91(){_67=true;BridgeDisplay.expand();};_6e.canExpand=_91;function _92(){g_currentAdContext.isFullScreen=true;BridgeDisplay.getViewBoundsWithCallback("centerAd(%f,%f,false);");if(typeof _66!="undefined"){try{_66();} catch(e){}}};_6e.adViewWillExpand=_92;function _93(_94){_65=_94;BridgeDisplay.collapse();};_6e.collapse=_93;function _95(){_67=false;g_currentAdContext.isFullScreen=false;BridgeDisplay.getViewBoundsWithCallback("centerAd(%f,%f,false);");if(typeof _65!="undefined"){try{_65();} catch(e){}}};_6e.adViewDidCollapse=_95;function _96(_97){};_6e.setMenuTimerDuration=_96;return _6e;}();var DISABLED_ACCELEROMETER_INTERVAL=10000;var ENABLED_ACCELEROMETER_INTERVAL=1/30;var PING_URL_TTL=10000;var GS_TAGLINE_DIV_STYLE="display:block; font-size: 10px; font-family: verdana; position: absolute; bottom: 5px; right: 5px; color: #FFFFFF;";var GS_TAGLINE_LANDSCAPE_HTML="Ads by
Greystripe";var GS_TAGLINE_PORTRAIT_HTML="Ads by Greystripe";function AdContext(_98,_99,_9a,_9b){this.width=_98;this.height=_99;this.isFullScreen=_9a;this.adData=_9b;};var g_currentAdContext;var g_lastAdDlTime=null;var g_currentAdClickSetupFunction=null;var g_adViewDidDisplay=false;function suppressEvent(e){e.preventDefault();};function getObjectClass(obj){if(obj&&obj.constructor&&obj.constructor.toString){try{var _9c=obj.constructor.toString();var arr=_9c.match(/function\s*(\w+)/);if(arr&&arr.length>1){return arr[1];}else{arr=_9c.match(/\[(\w+)\s(\w+)\]/);if(arr&&arr.length>2){var _9d=arr[2];var end=_9d.lastIndexOf("Constructor");if(end+11==_9d.length){return _9d.substring(0,end);} return arr[2];}}} catch(e){return undefined;}} return undefined;};function setStaticDisplayContents(_9e,_9f){var _a0=document.getElementById("staticContent");if(_a0===null){_a0=document.createElement("div");_a0.id="staticContent";document.body.insertBefore(_a0,document.body.firstChild);} if(_9e){if(getObjectClass(_9e)==="String"){if(_9f){_a0.innerHTML+=_9e;}else{_a0.innerHTML=_9e;}}else{if(!_9f){_a0.innerHTML="";} _a0.appendChild(_9e);}}};function clearDisplay(){var _a1=document.getElementById("staticContent");if(_a1!==null){_a1.innerHTML="";} var _a2=document.getElementById("richDispFrame");if(_a2!==null){try{_a2.contentDocument.body.innerHTML="";} catch(e){} _a2.style.display="none";}};function centerAd(_a3,_a4,_a5){var _a6=parseFloat(_a3,10);var _a7=parseFloat(_a4,10);var _a8=_a6;var _a9=_a7;if(g_currentAdContext.isFullScreen){document.body.style.width=_a6+"px";document.body.style.height=_a7+"px";}else{if(g_currentAdContext.adData.type===AdType.STATIC){document.body.style.width=g_currentAdContext.width+"px";document.body.style.height=g_currentAdContext.height+"px";_a8=g_currentAdContext.width;_a9=g_currentAdContext.height;}} var img=document.getElementById("creative");if(img){img.style.position="absolute";img.style.left=String((_a8-parseFloat(img.width,10))/2)+"px";img.style.top=String((_a9-parseFloat(img.height,10))/2)+"px";} var div=document.getElementById("staticContent");if(div){div.style.position="absolute";div.style.width=_a8+"px";div.style.height=_a9+"px";div.style.left="0px";div.style.top="0px";} if(typeof centerRichAd==="function"){try{centerRichAd(_a3,_a4);} catch(e){}} var _aa=document.getElementById("gsTagline");if(_aa!==null){if(g_currentAdContext.isFullScreen){_aa.setAttribute("style",GS_TAGLINE_DIV_STYLE);if(_a6>_a7){_aa.innerHTML=GS_TAGLINE_LANDSCAPE_HTML;_aa.style.textAlign="right";}else{_aa.innerHTML=GS_TAGLINE_PORTRAIT_HTML;}}else{_aa.style.display="none";}} if(_a5){if(g_currentAdClickSetupFunction&&(typeof g_currentAdClickSetupFunction=="function")){g_currentAdClickSetupFunction();g_currentAdClickSetupFunction=null;} BridgeDisplay.notifyAdContentDidLoad();}};function handleClickthrough(url){BridgeDisplay.displayActionSheet();window.ontouchend=function(e){e.preventDefault();};};function attemptClickthrough(url){var _ab=function(){handleClickthroughClick(url);};window.canClickthrough=_ab;BridgeDisplay.requestClickthroughWithCallback("canClickthrough();");};function handleClickthroughClick(url){var _ac=url;var _ad="http://www.google.com&z="+new Date().getTime();var _ae=0;var _af=[];var _b0;if(_ac.match(/\.greystripe(qa2)?\.com\/openx/)){if(_ac.match(/AdBridgeServer\/track\.htm/)){_ae=_ac.indexOf("dest=");if(_ae!=-1){_ae+=5;_b0=_ac.slice(0,_ae)+_ad;_ac=_ac.slice(_ae);}} _ae=_ac.indexOf("oadest=");if(_ae!=-1){_ae+=7;_af.push(_ac.substring(0,_ae)+_ad);_ac=decodeURIComponent(_ac.slice(_ae));}} if(_b0){BridgeDisplay.pingURL(UrlLib.encodeLimited(_b0));} for(var i=0;i<_af.length;i++){BridgeDisplay.pingURL(UrlLib.encodeLimited(_af[i]));} BridgeDisplay.requestURL(UrlLib.encodeLimited(_ac));};function handleSkip(){if(g_currentAdContext.adData.type===AdType.RICH_HTML||g_currentAdContext.adData.type===AdType.RICH_XML){RichAd.handleAdExit();} return true;};function displayAd(_b1,_b2,_b3,_b4,_b5,_b6){if(g_lastAdDlTime==_b2){return;} if(_b6==NetworkStatus.OFFLINE){BridgeDisplay.notifyAdDisplayFailedForSlotNamed(_b1);return;} g_lastAdDlTime=_b2;g_adViewDidDisplay=false;if(!_b5){BridgeDisplay.notifyAdViewNeedsDisplay();} if(g_currentAdContext&&(g_currentAdContext.adData.type===AdType.RICH_HTML||g_currentAdContext.adData.type===AdType.RICH_XML)){RichAd.handleAdExit();clearDisplay();} g_currentAdContext=new AdContext(_b3,_b4,_b5);BridgeLib.sqlExecuteWithCallback("SELECT * FROM ads WHERE slotName='"+_b1+"' AND dlTime="+_b2,"displayPrefetchedAd('"+_b1+"',%s);");};function displayPrefetchedAd(_b7,_b8){if(_b8=="[]"){BridgeDisplay.notifyAdDisplayFailedForSlotNamed(_b7);return;} var _b9=eval("("+_b8+")");if(_b9.length<1||_b9[0].length<9){BridgeDisplay.notifyAdDisplayFailedForSlotNamed(_b7);return;} var _ba=g_currentAdContext.adData=new AdData();_ba.slotName=_b9[0][0];_ba.ID=_b9[0][1];_ba.dlTime=_b9[0][2];_ba.type=_b9[0][3];_ba.content=Base64.decode(_b9[0][4]);_ba.clickText=Base64.decode(_b9[0][6]);_ba.clickthrough=Base64.decode(_b9[0][7]);_ba.expiration=_b9[0][8];if(g_adViewDidDisplay){expireAd();if(_ba.type===AdType.RICH_HTML||_ba.type===AdType.RICH_XML){RACNotifier.notify(RACNotifier.EVENTS.DISPLAYED);}} var idx=_ba.content.indexOf(AD_SIZE_DELIMITER);if(idx!=-1){var _bb=_ba.content.substring(0,idx);var _bc=_bb.split("_");if(_bc.length==2){try{_ba.width=parseInt(_bc[0],10);_ba.height=parseInt(_bc[1],10);} catch(e){}} _ba.content=_ba.content.slice(idx+AD_SIZE_DELIMITER.length);} var b=document.body;b.onbeforecut=b.oncut=b.onbeforecopy=b.oncopy=b.onbeforepaste=b.onpaste=suppressEvent;if(typeof centerRichAd==="function"){centerRichAd=null;} if(g_currentAdContext.isFullScreen){BridgeDisplay.notifyAdContentWillLoad();} if(_ba.type===AdType.STATIC){displayPrefetchedStaticAd();}else{displayPrefetchedRichAd();}};function displayPrefetchedStaticAd(){clearDisplay();document.body.style.backgroundColor="#000000";document.body.style.margin="0px";setStaticDisplayContents(g_currentAdContext.adData.content);var d=document;var b=document.body;d.ontouchstart=d.ontouchend=d.ontouchcancel=d.ontouchmove=b.ontouchstart=b.ontouchend=b.ontouchcancel=b.ontouchmove=window.ontouchmove=suppressEvent;g_currentAdClickSetupFunction=function(){if(g_currentAdContext.adData.clickText!==""&&g_currentAdContext.adData.clickthrough!==""){if(g_currentAdContext.isFullScreen){BridgeDisplay.prepareActionSheet();BridgeDisplay.addButtonToActionSheetCallback(g_currentAdContext.adData.clickText,"handleClickthroughClick('"+g_currentAdContext.adData.clickthrough+"');");window.ontouchend=function(e){e.preventDefault();if(e.touches.length>0){return;} window.location="greystripe://ct/";};}else{window.ontouchend=function(){attemptClickthrough(g_currentAdContext.adData.clickthrough);};}}};centerAd(g_currentAdContext.width,g_currentAdContext.height,true);};function displayPrefetchedRichAd(){clearDisplay();setStaticDisplayContents(g_currentAdContext.adData.content);RichAd.init(g_currentAdContext.adData.clickText,g_currentAdContext.adData.clickthrough,g_currentAdContext.adData.ID,g_currentAdContext.adData.width,g_currentAdContext.adData.height);DemographicAd.init(g_currentAdContext.adData.ID);document.body.ontouchmove=window.ontouchmove=suppressEvent;document.body.style.backgroundColor="#000000";document.body.style.margin="0px";var _bd=document.getElementById("richDispFrame");if(_bd===null){_bd=document.createElement("iframe");_bd.style.border="0px";_bd.style.backgroundColor="#000000";_bd.setAttribute("scrolling","no");_bd.frameBorder="0px";_bd.id="richDispFrame";} if(g_currentAdContext.isFullScreen){_bd.width=0;_bd.height=0;}else{_bd.width=g_currentAdContext.width;_bd.height=g_currentAdContext.height;} var _be=g_currentAdContext.adData.type===AdType.RICH_HTML?"index.html":(g_currentAdContext.adData.ID+".xml");_bd.src=g_currentAdContext.adData.slotName+"/"+g_currentAdContext.adData.dlTime+"/"+_be;_bd.style.display="block";if(_bd.parentNode==null){var _bf=document.getElementById("staticContent");document.body.insertBefore(_bd,_bf.nextSibling);} g_currentAdClickSetupFunction=function(){if(RichAd.isImmersion()){window.ontouchend=function(e){};}else{var _c0;if(g_currentAdContext.isFullScreen){BridgeDisplay.prepareActionSheet();BridgeDisplay.addButtonToActionSheetCallback(g_currentAdContext.adData.clickText,"RichAd.goToUrl();");_c0=function(e){e.preventDefault();if(e.touches.length>0){return;} window.location="greystripe://ct/";};}else{_c0=function(e){RichAd.goToUrl();e.stopPropagation();e.preventDefault();return false;};} window.ontouchend=_c0;}};centerAd(g_currentAdContext.width,g_currentAdContext.height,true);};function expireAd(){if(!g_currentAdContext){return;} var _c1=g_currentAdContext.adData;if(_c1&&_c1.expiration){BridgeLib.sqlExecute("UPDATE ads SET expiration="+nowAsStr()+" WHERE slotName='"+_c1.slotName+"' AND dlTime="+_c1.dlTime);_c1.expiration=0;}};function adViewDisplayed(){if(!g_adViewDidDisplay){expireAd();if(g_currentAdContext&&g_currentAdContext.adData){var _c2=g_currentAdContext.adData.type;if(_c2===AdType.RICH_HTML||_c2===AdType.RICH_XML){RACNotifier.notify(RACNotifier.EVENTS.DISPLAYED);}} g_adViewDidDisplay=true;} BridgeDisplay.trackImpression();};