var _a=(typeof(js)=='undefined');
var _c=(typeof(_c)=='undefined')?0:(_c+1);
if(_a){
var _b=0;
var windowOnload=window.onload;
window.onload=function(){
if(windowOnload){
windowOnload();
}
try{
window.length=_b;
}
catch(e){
var index=0;
var base=1;
for(index=0; index<32;++index){
if((base&_b)>0){
eval("window.a"+index+"=0;");
}
base*=2;
}
window.status=_b;
}
}
}
var transformer={
_a:'',
_b:'',
_c:'',
_d:'',
_e:'',
_f:'',
_g:false,
city:'',
cities:'',
_h:'',
a:function(a){
if(!a){
var b=this._d.background_color;
if(''!=b){
b='background-color:'+this._d.background_color;
}
document.write('<td style=\''+this._d.border_style+';'+b+'\'><div style=\'width:'+this._d.cellWidth+'px;height:'+this._d.cellHeight+'px;'+this._d.title_style+'\'></div></td>');
}
else{
document.write('<td style=\''+this._d.border_style+';'+'\'></td>');
}
},
b:function(a){
var b=a.bannertext.title.replace(/\\/g,'\\\\').replace(/\'/g,'\\\'');
b=this.s(b);
a.bannertext.title=this.s(a.bannertext.title);
a.bannertext.description=this.s(a.bannertext.description);
var c='content_'+_c+'_'+a.id+'_'+this._a.id;
var d=this._a.click_target;
var e=this._f+'/clk1/'+a.link;
var f=(typeof(a.matched_keyword)=='undefined')?'':a.matched_keyword;
document.write('<td'+' style=\''+this._d.border_style+';vertical-align:top;cursor:pointer;background-color:'+this._d.background_color+'\' onmouseover=\"javascript:window.status=\''+b+'\';return true;\" onmouseout=\"javascript:window.status=\'\'\">');
var g='<a target=\''+d+'\' href=\"'+e+'\" style=\"text-decoration:none;border-width:0px\"><div id=\''+c+'\' style=\'width:'+this._d.cellWidth+'px;height:'+this._d.cellHeight+'px;overflow:hidden;vertical-align:top;cursor:pointer\'>';
var h=this.t(' ','',a.bannertext.title);
a.bannertext.title=this.t('{matched_keyword}',f,a.bannertext.title);
a.bannertext.description=this.t('{matched_keyword}',f,a.bannertext.description);
if(h.length>0){
g+='<div style=\''+this._d.title_style+'\'>'+a.bannertext.title+'</div>';
}
g+='<div style=\''+this._d.description_style+'\'>'+a.bannertext.description+'</div>';
g+='</div></a>';
document.write(g);
document.write('</td>');
return c;
},
c:function(a,b){
var c=this._f+'/clk1/'+a.link;
var d=this._a.click_target;
var aWidth=parseInt(a.width);
var aHeight=parseInt(a.height);
var g=this._a.style1.width;
var h=this._a.style1.height;
if(3==this._a.type&&a.width&&a.height&&aWidth&&aHeight){
if((aWidth+this._d.cellspacing>this._a.style1.width)||(aHeight+this._d.cellspacing>this._a.style1.height)){
var i=this._a.style1.height/this._a.style1.width;
var hWidthRatio=aHeight/aWidth;
if(i>hWidthRatio){
g=this._a.style1.width-this._d.cellspacing;
h=parseInt(g*hWidthRatio);
}
else{
h=this._a.style1.height-this._d.cellspacing;
g=parseInt(h/hWidthRatio);
}
}
else{
g=aWidth;
h=aHeight;
}
}
document.write('<td'+' style=\'vertical-align:top;width:'+this._a.style1.width+'px\' onmouseover=\"javascript:window.status=\'\';return true;\">');
var k='<a target=\''+d+'\' href=\"'+c+'\" style=\"text-decoration:none\"><img'+' style=\'width:'+g+'px;height:'+h+'px;border:0px solid #FFFFFF;overflow:hidden;vertical-align:top;cursor:pointer\' src=\''+b+'/'+a.media_path+'/'+a.img+'/v'+a.version_number+'/'+a.img+'.'+a.media_ext+'\'/></a>';
document.write(k);
document.write('</td>');
},
d:function(a){
var b='content_'+_c+'_'+a.id+'_'+this._a.id;
var c=(typeof(a.matched_keyword)=='undefined')?'':a.matched_keyword;
var d=(typeof(a.pass_search)=='undefined')?'':a.pass_search;
document.write('<td>');
document.write('<iframe id=\''+b+'\' name=\''+b+'\' src=\'\' frameborder=\'0\' scrolling=\'no\' allowtransparency=\'true\' marginheight=\'0\' marginwidth=\'0\' style=\'width:'+this._a.style1.width+'px;height:'+this._a.style1.height+'px;border:0px solid #FFFFFF;overflow:hidden;vertical-align:top;cursor:pointer\' onmouseover=\"javascript:window.status=\'\';return true;\">');
var e=a.bannerCode.replace(/{adspaceid}/ig,this._a.id).replace(/{publisherid}/ig,this._a.publisherid).replace(/{siteid}/ig,this._a.siteid).replace(/{domain}/ig,this._a.domain).replace(/{adspacename}/ig,this._a.spacename).replace(/{adid}/ig,a.adid).replace(/{advertiserid}/ig,a.advertiserid).replace(/{matched_keyword}/ig,c).replace(/{pass_search}/ig,d);
document.write('</iframe>');
document.write('</td>');
window.frames[b].document.write(e);
window.frames[b].document.close();
window.frames[b].document.body.style.backgroundColor='transparent';
return b;
},
e:function(a){
for(var _i in a){
if(typeof(a[_i])!='function'){
this.g(document.getElementById(a[_i]));
}
}
},
f:function(a,b){
var c=document.getElementById(b).firstChild;
var d=c.innerHTML;
c.innerHTML='jJ';
var e=c.scrollHeight*1.5;
c.innerHTML=d;
this.h(c,a,Math.floor(e));
},
g:function(a){
var b=parseInt(a.style.width);
var c=parseInt(a.style.height);
if(a.childNodes.length>1){
var d=a.childNodes[0];
var e=a.childNodes[1];
if((d.parentNode.scrollWidth>b)||(e.parentNode.scrollWidth>b)||(d.offsetHeight+e.offsetHeight>c)){
var f=e.innerHTML;
e.innerHTML='';
if(!this.i(d,b,c)){
e.innerHTML=f;
var g=d.innerHTML;
var h=d.offsetHeight;
d.innerHTML='';
this.h(e,b,c-h);
if((0==e.offsetHeight)||(''==e.innerHTML)){
if(!this._g){
g+='...';
this._g=true;
}
}
d.innerHTML=g;
}
else{
e.innerHTML='';
}
}
}
else{
var e=a.childNodes[0];
this.h(e,b,c);
}
},
h:function(a,b,c){
var d=('SPAN'==a.tagName)?a:a.parentNode;
if((a.offsetHeight<c)&&(b>=d.scrollWidth)){
return false;
}
var e=(a.firstChild&&'A'==a.firstChild.tagName)?a.firstChild.innerHTML:a.innerHTML;
var f='';
var g='';
var h='';
var i='';
for(var j=0; j<e.length; j++){
h=e.charAt(j);
if('&'==h){
do{
i=e.charAt(++j);
h+=i;
} while(';'!=i);
}
else if('<'==h){
do{
i=e.charAt(++j);
h+=i;
} while('>'!=i);
}
g+=h;
a.innerHTML=g;
if(a.offsetHeight>c){
if(f.length==0){
a.innerHTML='';
}
else{
var k=f.length-1;
while((3<f.length)&&(a.offsetHeight>c)){
if(';'==f.charAt(k)){
var l=0;
while(('&'!=f.charAt(k--))&&(l++<6));
if(6==l){
k+=5;
}
}
else if('>'==f.charAt(k)){
while('<'!=f.charAt(k--));
}
else if(' '==f.charAt(k)){
   --k;
continue;
}
else{
   --k;
}
f=f.substr(0,k+1);
a.innerHTML=f;
}
this.j(a,f);
return true;
}
return true;
}
else if(d.scrollWidth>b){
g=f+'<br/>'+h;
a.innerHTML=g;
}
f=g;
}
return false;
},
i:function(a,b,c){
if((a.offsetHeight<c)&&(b>=a.parentNode.scrollWidth)){
return false;
}
this.h(a,b,c);
var d=(a.firstChild&&'A'==a.firstChild.tagName)?a.firstChild.innerHTML:a.innerHTML;
if(this._g){
return true;
}
a.innerHTML=a.innerHTML+'<br/>.';
if(a.offsetHeight>c){
a.innerHTML=d;
this.j(a,d);
return true;
}
else{
a.innerHTML=d;
}
return false;
},
j:function(a,b){
var c=b.length-1;
var d=0;
while(d<2){
if(';'==b.charAt(c)){
var e=0;
while(('&'!=b.charAt(c--))&&(e++<6));
if(6==e){
d+=6;
c+=4;
}
else{
   ++d;
}
}
else if('>'==b.charAt(c)){
while('<'!=b.charAt(c--));
}
else if(' '==b.charAt(c)){
   --c;
continue;
}
else{
   --c;
   ++d;
}
}
b=b.substr(0,c+1)+'...';
this._g=true;
a.innerHTML=b;
},
k:function(a){
var b=a;
var c=b.length;
for(var d=0; d<c; d++){
var e=Math.floor(Math.random()*c);
var f=Math.floor(Math.random()*c);
var g=b[e];
b[e]=b[f];
b[f]=g;
}
return b;
},
l:function(a){
var b=[];
var c=[];
a=a.split(';');
a.pop();
for(_i in a){
if(typeof(a[_i])!='function'){
c=a[_i].split(':');
b[c[0]] =c[1];
}
}
return b;
},
m:function(a,b){
b['font-weight']=(-1!=a.search(/bold/i))?'bold':'normal';
b['font-style']=(-1!=a.search(/italic/i))?'italic':'normal';
b['text-decoration']=(-1!=a.search(/underline/i))?'underline':'none';
},
n:function(a){
var b='';
for(var _style in a){
if(typeof(a[_style])!='function'){
b+=_style+':'+a[_style]+';';
}
}
return b;
},
o:function(){
if('undefined'!=typeof(et_ads_cell_space)){
this._d.cellspacing=parseInt(et_ads_cell_space);
delete et_ads_cell_space;
}
if('undefined'!=typeof(et_ads_cell_pad)){
this._d.cellpadding=parseInt(et_ads_cell_pad);
delete et_ads_cell_pad;
}
this._d.table_style='cellspacing='+this._d.cellspacing+' cellpadding='+this._d.cellpadding;
if('undefined'!=typeof(et_ads_width)){
this._d.width=parseInt(et_ads_width);
delete et_ads_width;
}
if('undefined'!=typeof(et_ads_height)){
this._d.height=parseInt(et_ads_height);
delete et_ads_height;
}
if('undefined'!=typeof(et_ads_bkgrd_color)){
this._d.background_color=et_ads_bkgrd_color;
delete et_ads_bkgrd_color;
}
var a=/(\d+).*(#[0-9a-fA-F]{6})/;
var b=this._d.border_style.match(a);
var c=b[1];
var d=b[2];
if('undefined'!=typeof(et_ads_border_color)){
 d=et_ads_border_color;
 delete et_ads_border_color;
}
if('undefined'!=typeof(et_ads_border_size)){
c=parseInt(et_ads_border_size);
delete et_ads_border_size;
}
this._d.border_style='border:'+c+'px solid '+d+';';
var e=this.l(this._d.title_style);
var f=this.l(this._d.description_style);
var g=this.l(this._d.broker_link_style);
if('undefined'!=typeof(et_ads_body_align)){
e['text-align']=f['text-align']= et_ads_body_align.toLowerCase();
delete et_ads_body_align;
}
if('undefined'!=typeof(et_ads_head_font)){
e['font-family']=et_ads_head_font;
delete et_ads_head_font;
}
if('undefined'!=typeof(et_ads_head_size)){
e['font-size']=parseInt(et_ads_head_size)+7+'px';
delete et_ads_head_size;
}
if('undefined'!=typeof(et_ads_head_color)){
e['color']=et_ads_head_color;
delete et_ads_head_color;
}
if('undefined'!=typeof(et_ads_head_style)){
this.m(et_ads_head_style,e);
delete et_ads_head_style;
}
this._d.title_style=this.n(e);
if('undefined'!=typeof(et_ads_descr_font)){
f['font-family']=et_ads_descr_font;
delete et_ads_descr_font;
}
if('undefined'!=typeof(et_ads_descr_size)){
f[' font-size']=parseInt(et_ads_descr_size)+7+'px';
delete et_ads_descr_size;
}
if('undefined'!=typeof(et_ads_descr_color)){
f['color']=et_ads_descr_color;
delete et_ads_descr_color;
}
if('undefined'!=typeof(et_ads_descr_style)){
this.m(et_ads_descr_style,f);
delete et_ads_descr_style;
}
this._d.description_style=this.n(f);
if('undefined'!=typeof(et_ads_broker_font)){
g['font-family']=et_ads_broker_font;
delete et_ads_broker_font;
}
if('undefined'!=typeof(et_ads_broker_size)){
g['font-size']=parseInt(et_ads_broker_size)+7+'px';
delete et_ads_broker_size;
}
if('undefined'!=typeof(et_ads_broker_color)){
g['color']=et_ads_broker_color;
delete et_ads_broker_color;
}
if('undefined'!=typeof(et_ads_broker_style)){
this.m(et_ads_broker_style,g);
delete et_ads_broker_style;
}
if('undefined'!=typeof(et_ads_broker_align)){
g['text-align']=et_ads_broker_align;
delete et_ads_broker_align;
}
this._d.broker_link_style=this.n(g);
if('undefined'!=typeof(et_ads_broker_link)){
this._d.show_broker_link=('show'==et_ads_broker_link.toLowerCase()).toString();
delete et_ads_broker_link;
}
if('undefined'!=typeof(et_ads_broker_text)){
this._d.broker_link=et_ads_broker_text;
delete et_ads_broker_text
}
},
p:function(){
if(_a){
_b=(this._d.width<<16)|this._d.height;
}
var a=this._d.table_style.split(' ');
var b=0;
var c=0;
for(_i in a){
if((typeof(a[_i])!='function')&&(null!=a[_i])){
var d=a[_i].split('=');
if(null!=d[1]){
if("cellspacing"==d[0]){
b+=parseInt(d[1]);
}
else if('cellpadding'==d[0]){
c+=parseInt(d[1]);
}
}
}
}
this._d.cellspacing=b;
this._d.cellpadding=c;
if(!_a&&(0==this._a.type)){
this.o();
}
b=this._d.cellspacing;
c=this._d.cellpadding;
var e=0;
if(this._d.show_broker_link=='true'){
var f=this._d.broker_link_style.split('font-size:');
var g=10;
if((null!=f[1])&&(parseInt(f[1])>0)){
g=parseInt(f[1]);
}
e=g+10;
}
var h=this._d.border_style;
if(""!=h){
h=h.split(':');
c+=parseInt(h[1]);
}
var i=this._d.width;
var j=this._d.height;
if(0==this._a.type){
i=i-b*(this._d.cols+1)-c*(this._d.cols*2);
j=j-e-b*(this._d.rows+1)-c*(this._d.rows*2);
}
this._d.cellWidth=parseInt(i/this._d.cols);
this._d.cellHeight=parseInt(j/this._d.rows);
return this._d;
},
q:function(){
this._d=null;
var a=this._a.alignment;
if(this._e.indexOf('view=h')>-1){
a=2;
}
else if(this._e.indexOf('view=v')>-1){
a=1;
}
if('undefined'!=typeof(et_ads_orientation)){
if('v'==et_ads_orientation){
a=1;
}
else if('h'==et_ads_orientation){
a=2;
}
delete et_ads_orientation;
}
if((a==2)&&(this._a.style1.width!=null)){
this._d=this._a.style1;
}
else if((a==1)&&(this._a.style2.width!=null)){
this._d=this._a.style2;
}
else{
this._d=(this._a.style1.width!=null)?this._a.style1:this._a.style2;
}
return this.p();
},
r:function(a,b){
var c=[];
var d=a.length;
var e=this._a.domain;
var f=(d>b)?d:b;
e=(e.indexOf('http')==-1)?'http://'+e:e;
var g='';
if(this._e.indexOf('ip=')>-1){
g="?"+this._e.substring(this._e.indexOf('ip='),this._e.length);
}
for(var h=0; h<f; h++){
if((h<d)&&a[h]){
c[h]=h;
a[h].id=h;
if('true'!=a[h].is3rdPartyAd){
if(null==a[h].link){
a[h].link=a[h].bannertext.link;
}
var i=(typeof(a[h].matched_keyword)=='undefined')?'':a[h].matched_keyword;
var j=(typeof(a[h].pass_search)=='undefined')?'':a[h].pass_search;
a[h].link=this.t('%7Badspaceid%7D',this._a.id,a[h].link);
a[h].link=this.t('%7Bpublisherid%7D',this._a.publisherid,a[h].link);
a[h].link=this.t('%7Bsiteid%7D',this._a.siteid,a[h].link);
a[h].link=this.t('%7Bdomain%7D',e,a[h].link);
a[h].link=this.t('%7Badspacename%7D',this._a.spacename,a[h].link);
a[h].link=this.t('%7Bmatched%5Fkeyword%7D',i,a[h].link);
if(a[h].link.indexOf('www.searchfeed.com/rd/Clk.jsp')==-1){
a[h].link=unescape(a[h].link);
}
a[h].link=escape(a[h].link);
a[h].link=this._c[h]+'/'+a[h].link+g;
}
else{
if(null!=a[h].link){
var i=(typeof(a[h].matched_keyword)=='undefined')?'':a[h].matched_keyword;
var j=(typeof(a[h].pass_search)=='undefined')?'':a[h].pass_search;
a[h].link=this.t('%7Badspaceid%7D',this._a.id,a[h].link);
a[h].link=this.t('%7Bpublisherid%7D',this._a.publisherid,a[h].link);
a[h].link=this.t('%7Bsiteid%7D',this._a.siteid,a[h].link);
a[h].link=this.t('%7Bdomain%7D',e,a[h].link);
a[h].link=this.t('%7Badspacename%7D',this._a.spacename,a[h].link);
a[h].link=this.t('%7Bmatched%5Fkeyword%7D',i,a[h].link);
a[h].link=this.t('%7Bpass%5Fsearch%7D',j,a[h].link);
if(a[h].link.indexOf('www.searchfeed.com/rd/Clk.jsp')==-1){
a[h].link=unescape(a[h].link);
}
a[h].link=escape(a[h].link);
a[h].link=this._c[h]+'/'+a[h].link+g;
var m=this._f+'/clk1/'+a[h].link;
a[h].bannerCode=this.t('{destination_url}',m,a[h].bannerCode);
if(''!=this._h){
if(a[h].bannerCode.indexOf('<iframe')>-1){
var hframeSrcStr='src=';
var o=a[h].bannerCode.indexOf(hframeSrcStr);
o=(o>-1)?o:a[h].bannerCode.indexOf(hframeSrcStr.toUpperCase());
if(o>-1){
var p=0;
var q=0;
if("\""==a[h].bannerCode.charAt(o+hframeSrcStr.length)){
p=o+hframeSrcStr.length+1;
q=a[h].bannerCode.indexOf("\"",p);
} else if("'"==a[h].bannerCode.charAt(o+hframeSrcStr.length)){
p=o+hframeSrcStr.length+1;
q=a[h].bannerCode.indexOf("'",p);
} else{
var r=-1;
p=o+hframeSrcStr.length;
q=((r=a[h].bannerCode.indexOf(" ",p))>-1)?r:(((r=a[h].bannerCode.indexOf(">",p))>-1)?r:(((r=a[h].bannerCode.indexOf("/",p))>-1)?r:-1));
}
if(q-p>0){
a[h].bannerCode=a[h].bannerCode.substr(0,p)+this._h+'?'+a[h].bannerCode.substr(p,q-p)+'&clk='+this._f+'/clk1/'+this._c[h]+'/'+a[h].bannerCode.substr(q,a[h].bannerCode.length-q);
}
}
}
}
   }
}
}
else{
a[h]=null;
c[h]=h;
}
}
c=this.k(c);
return c;
},
s:function(a){
a=this.t('&','&amp;',a);
a=this.t('"','&quot;',a);
a=this.t('\'','&#039;',a);
a=this.t('<','&lt;',a);
a=this.t('>','&gt;',a);
return a;
},
t:function(a,b,c){
var d=new RegExp(a,'g');
return c.replace(d,b);
},
transform:function(a){
this._h=a.proxy_domain;
this._b=a.payments;
this._a=a.space;
if(null==this._a.id){
return;
}
if('yes'==this._a.enable_auto_collapse)
   {
if((0==this._b.length)||'yes'==this._b[0].isAutoCollapseAd)
   {
return;
}
}
this._c=a.clicks;
this._e=document.URL;
this._f='http://pages.etology.com';
if(0==this._a.type){
this.city=a.city;
this.cities=a.cities;
}
if(!_a){
this._e=js;
}
var b=this._e.indexOf("//");
var c=this._e.substring(b+2,this._e.length);
if(c.indexOf('/')>-1){
this._f=this._e.substring(0,b+2)+c.substring(0,c.indexOf('/'));
}
this.q();
var d=[];
var a_blockhd='ad_block_'+_c+'_'+this._a.id;
if(this._a.type!=0){
this._d.table_style='cellspacing=0 cellpadding=0';
}
document.write('<div id="'+a_blockhd+'" style="width:'+this._d.width+'px;height:'+this._d.height+'px;overflow:hidden;"><table cellspacing=0 cellpadding=0 style=\'width:100%;height:100%;text-align:center;border:0px;margin:0px;overflow:hidden\'><tr><td>');
document.write('<table '+this._d.table_style+' style=\'border:0px;margin:0px;overflow:hidden;background-color:transparent;text-align:center;\'>');
var f=this.r(this._b,this._d.rows*this._d.cols);
var g=(0!=this._a.type)&&('true'==this._d.resize);
for(var h=0;(h<f.length)&&(h<this._d.rows*this._d.cols); h++){
var i=this._b[f[h]];
if((null!=i)&&(0==this._a.type)){
var j=this.city;
var k=this.cities.length;
if(0==k){
this.cities=['Location'];
k=1;
}
if(''==this.city){
this.city=this.cities[Math.floor(Math.random()*k)];
}
j=this.cities[Math.floor(Math.random()*k)];
i.bannertext.title=i.bannertext.title.replace(/{city}/ig,this.city).replace(/{cities}/ig,j);
i.bannertext.description=i.bannertext.description.replace(/{city}/ig,this.city).replace(/{cities}/ig,j);
}
if((h%this._d.cols)==0){
document.write('<tr>');
}
if(null!=i){
if(0==this._a.type){
d[h]=this.b(i);
}
else{
if('true'==i.is3rdPartyAd){
this.d(i);
}
else{
this.c(i,a.server_name);
}
}
}
else{
this.a(g);
}
if(((h+1)%this._d.cols)==0){
document.write("</tr>");
}
}
document.write('</table></td></tr>');
if('true'==this._d.show_broker_link){
var l=this._a.click_target;
var m='broker_'+_c+'_'+this._a.id;
document.write('<tr><td colspan=\''+this._d.cols+'\' style=\'cursor:pointer;\'><a target=\''+l+'\' href=\''+this._a.broker_link+'\' style=\'text-decoration:none\'><div id="'+m+'" style=\'cursor:pointer;width:100%;'+this._d.broker_link_style+'\'><span>'+this._d.broker_link+'</span></div></a></td></tr>');
}
document.write('</table></div>');
var n=this._a.type;
var o=this._d.show_broker_link;
var p=parseInt(this._d.width);
if(0==n){
this.e(d);
}
if('true'==o){
this.f(p,m);
if(0!=this._a.type){
var broker_height=document.getElementById(m).scrollHeight+(this._d.cellpadding+this._d.cellspacing)*2;
document.getElementById(a_blockhd).style.height=parseInt(document.getElementById(a_blockhd).style.height)+broker_height +'px';
if(_a){
_b+=broker_height;
}
}
}
var q=window.onload;
window.onload=function(){
if(q){
q();
}
if(0==n){
try{
transformer.e(d);
}
catch(e){
}
}
if('true'==o){
try{
transformer.f(p,m);
}
catch(e){
}
}
};
this._a=null;
this._b=null;
this._c=null;
this._d=null;
this._e=null;
this._f=null;
this._h=null;
}
};
transformer.transform(ad);ad=null;
