var MediaSmart={site:'',promoSite:'',areaPattern:'',area:'',subArea:'OTHER',ads:[],keyword:'',pageId:'',adRemarket:true,skinActive:false,adsInserted:false,adDomain:'http://media.sensis.com.au',adProtocol:'http',innerHeight:0,initialised:false,util:{polite:true,aboveBelowFold:false,island_expand:false,random:function(){return Math.round(Math.abs(Math.sin((new Date()).getTime()))*1000000000000)},isEmpty:function(a){if((a===null)||(typeof(a)==='undefined')||(a==='')){return true}
return false},notEmpty:function(a){if((a!==null)&&(typeof(a)!=='undefined')&&(a!=='')){return true}
return false},makeURLSafe:function(a){if(this.notEmpty(a)){a=a.replace(/ |-|<|>|\/|\?|\+/g,'_');a=a.replace(/&/,'AND');a=a.replace(/_+/g,'_');a=a.replace(/^_|_$/g,'')}
return a}},initialise:function(){if(this.initialised===true){return}
var a,b,c='',d=[];if(arguments.length>0){a=arguments[0];if((a.site!=='')&&(typeof(a.site)==='string')){this.site=this.util.makeURLSafe(a.site.toUpperCase())}
if((a.promoSite!=='')&&(typeof(a.promoSite)==='string')){this.promoSite=this.util.makeURLSafe(a.promoSite.toUpperCase())}
if((a.area!=='')&&(typeof(a.area)==='string')){this.subArea=this.util.makeURLSafe(a.area.toUpperCase())}
if((a.areaPattern!=='')&&(typeof(a.areaPattern)==='string')){this.areaPattern=a.areaPattern.toUpperCase()}}
d=this.areaPattern.split('$');for(b=0;b<d.length-1;b=b+1){c+=d[b]+this.subArea}
c+=d[d.length-1];this.area=c;if(this.util.notEmpty(top.MediaSmart.pageId)){this.pageId=top.MediaSmart.pageId}else{this.pageId=this.util.random()}
this.adProtocol="http";if((document.location+'').indexOf('https://')!==-1){this.adProtocol+='s';this.adRemarket=false}
this.adDomain=this.adProtocol+'://media.sensis.com.au';if(document.location+''=='http://go.bigpond.com/home/index2.jsp'){this.keyword='TEST_PAGE'}
if((document.location+'').indexOf('zmstestingenvironment375')!==-1){this.site='Z_ZORRO';this.area='MOB.TEST.DEMO'}
if(this.util.polite===false){this.keyword='EXPANDABLE'}
this.initialised=true},generateAdCall:function(a){var b='',c=true,d;if(typeof(a.cmd)==='function'){a.cmd()}
if(typeof(a.tags)==='undefined'){a.tags=[]}
if(((typeof(a.polite)!=='undefined')&&(a.polite===false))||(this.util.polite===false)){c=false}
if(c){b='<iframe scrolling="no" frameborder="0" marginwidth="0" marginheight="0" allowTransparency="true" ';b+='style="margin:0;padding:0;border:none;height:';if(a.width=="988"){b+='0';}else{b+=this.util.notEmpty(a.iframeHeight)?a.iframeHeight:a.height;}
b+='px;width:';b+=this.util.notEmpty(a.iframeWidth)?a.iframeWidth:a.width;b+='px;" src="';if((this.adRemarket===true)&&(((a.width===300)&&(a.height===250))||((a.width===728)&&(a.height===90))||(((a.width===160)||(a.width===120))&&(a.height===600))||((a.height==1&&a.width==4)))||((a.height==250&&a.width==988))){b+=this.adProtocol+'://medrx.sensis.com.au/images/sensis/cookieFix.html?acc_random='}else{b+=this.adDomain+'/hserver/acc_random='}}else{b='<script src="'+this.adDomain+'/jserver/acc_random='}
b+=this.util.random();b+='/SITE=';b+=this.util.notEmpty(a.site)?a.site:this.site;b+='/AREA=';b+=this.util.notEmpty(a.area)?a.area:this.area;b+='/AAMSZ='+a.width+'x'+a.height;if(this.util.notEmpty(a.position)){b+='/POSITION=';if(a.abf!==false){if(this.innerHeight-a.top>0||typeof(a.top)==='undefined'){b+='ABV'}else{b+='BLW'}}
if(a.position=="other"){a.position="OTHER"}
b+=a.position}
var tempKeyword="";if(this.util.notEmpty(a.keyword)){tempKeyword=this.util.makeURLSafe(a.keyword.toUpperCase());}else if(this.util.notEmpty(this.keyword)){tempKeyword=this.util.makeURLSafe(this.keyword.toUpperCase());}
if((document.location+'').indexOf('MSTOOTHPASTE')!==-1){tempKeyword+='+MSTOOTHPASTE'}
if(tempKeyword!=""){b+="/KEYWORD="+tempKeyword;}
for(d in this.tags){if(typeof(a.tags[d])==='undefined'){if(this.tags[d]!==''){b+='/'+this.util.makeURLSafe(d.toUpperCase())+'='+this.util.makeURLSafe(this.tags[d].toUpperCase())}}}
if((document.location+"").indexOf("MSTOOTHPASTE")!=-1){b+=(document.location+"").slice((document.location+"").lastIndexOf("MSTOOTHPASTE")+12);}
b+='/pageid='+this.pageId;b+=c?'"></iframe>\n':'"></script>\n';return b},newAd:function(a){if(this.util.island_expand&&a.width===300&&a.height===250&&a.position===1){a.polite=false;a.abf=false;a.keyword="EXPANDABLE"}
if(a.id=="300x250_BIDSMART"){a.polite=false;a.abf=false;a.height=300}
if((this.skinActive===true)&&(a.width===728)&&(a.height===90)&&(a.position===1)&&(this.subArea==="HOME")){a.width=1220}
if(this.util.aboveBelowFold===false){a.abf=false}
if(((typeof(a.polite)!=='undefined')&&(a.polite===false))||(this.util.polite===false)){document.write(this.generateAdCall(a))}else{this.ads[this.ads.length]=a;thisAdWidth=this.util.notEmpty(a.iframeWidth)?a.iframeWidth:a.width;thisAdHeight=this.util.notEmpty(a.iframeHeight)?a.iframeHeight:a.height;if(thisAdWidth=="988"){document.write('<div id="zMSplacement'+this.ads.length+'" style="width:988px;height:0px;"></div>')}else{document.write('<div id="zMSplacement'+this.ads.length+'" style="width:'+thisAdWidth+'px;height:'+thisAdHeight+'px;"></div>')}}},refreshAd:function(){this.insertAd(this.ads)},setRefresh:function(a){if(a>0){setInterval(this.refreshAd(),(a*1000))}},getAdById:function(a){for(var b=0;b<this.ads.length;b=b+1){if(this.ads[b].id===a){this.ads[b].adIndex=b;return this.ads[b]}}
return false},insertAd:function(a,b){var c,d,e;if(typeof(a)==='string'){a=this.getAdById(a);if(a){d=document.getElementById(b);if(d){d=document.getElementById('zMSplacement'+a.adIndex);if(d){d=document.getElementById(a.containerId)}}
if(d){d.innerHTML=this.generateAdCall(a)}}}else{if(typeof(a)==="object"){if((typeof(a.length)==='number')&&!(a.propertyIsEnumerable('length'))&&(typeof a.splice==='function')){for(c=0;c<a.length;c=c+1){d=document.getElementById(a[c].containerId);if(d){d.innerHTML=this.generateAdCall(a[c])}}}else{e=document.getElementById(a.containerId);if(e){e.innerHTML=this.generateAdCall(a)}}}}},insertAllAds:function(){if(((document.location+"").indexOf("sdmtestid")!=-1)){var fileref=document.createElement('script');fileref.setAttribute("type","text/javascript");fileref.setAttribute("src","https://media.sensis.com.au/images/houseads_sensis/sdm_testsite.js");document.getElementsByTagName("head")[0].appendChild(fileref);}else{var a,b,c,d=0;if(arguments.length>0){d=arguments[0]}
if(typeof(window.innerWidth)==='number'){this.innerHeight=window.innerHeight}else if(document.documentElement&&document.documentElement.clientHeight){this.innerHeight=document.documentElement.clientHeight}else if(document.body&&document.body.clientHeight){this.innerHeight=document.body.clientHeight}
for(c=d;c<this.ads.length;c=c+1){a=document.getElementById('zMSplacement'+(c+1));this.ads[c].top=a.offsetParent.offsetTop;if(a&&(a.offsetTop===a.offsetParent.offsetTop)){if(this.ads[c].id.indexOf('300X250_2')!==-1){b=top.document.getElementById('sensis_island_ad_2');if(b){this.ads[c].top=b.offsetTop}}else if(this.ads[c].id.indexOf('300X250_3')!==-1){b=top.document.getElementById('sensis_island_ad_3');if(b){this.ads[c].top=b.offsetTop}}}
if(a===a.offsetParent){this.ads[c].top+=a.offsetTop}
if(((document.location+"").indexOf("preview.cms.bigpond.com")!=-1)&&(MediaSmart.ads[c].width==4&&MediaSmart.ads[c].height==1)){continue;}
if(a){a.innerHTML=this.generateAdCall(this.ads[c])}}
this.adsInserted=true}},checkInsertAllAds:function(){if(MediaSmart.adsInserted===false){MediaSmart.insertAllAds()}},waitInsertAllAds:function(){setTimeout(MediaSmart.checkInsertAllAds,500)},newPromo:function(a){a.site=this.promoSite;a.abf=false;if(((typeof(a.polite)!=='undefined')&&(a.polite===false))||(this.util.polite===false)){document.write(this.generateAdCall(a))}else{this.ads[this.ads.length]=a;document.write('<div id="zMSplacement'+this.ads.length+'" style="width:'+a.width+'px;height:'+a.height+'px;"></div>')}},bigpondPromotions:{newAd:function(a){MediaSmart.newPromo(a)}},Utilities:{initialise:function(){MediaSmart.initialise((arguments.length>0)?arguments[0]:null)}}};MediaSmart.util.aboveBelowFold=true;MediaSmart.site='TEL.BIGPOND.PORTAL.ENTERTAINMENT';MediaSmart.promoSite='TEL.BPPROMO.PORTAL.ENTERTAINMENT';MediaSmart.areaPattern='ENTERTAINMENT.BIGPOND.$';MediaSmart.util.polite=true;MediaSmart.util.island_expand=false;if(window.addEventListener){window.addEventListener('load',MediaSmart.waitInsertAllAds,false)}else{window.attachEvent('onload',MediaSmart.waitInsertAllAds)};
