if ( typeof( tpAdtagBase ) == 'undefined' ) {
function tpAdtagBase() {
function fp(o){var x=0;var y=0;if(o&&o.offsetParent){x=o.offsetLeft;y=o.offsetTop;while((o=o.offsetParent)){x+=o.offsetLeft;y+=o.offsetTop;}}return[x,y];}
function gcw(){return fr(window.innerWidth?window.innerWidth:0,document.documentElement?document.documentElement.clientWidth:0,document.body?document.body.clientWidth:0);}
function gch(){return fr(window.innerHeight?window.innerHeight:0,document.documentElement?document.documentElement.clientHeight:0,document.body?document.body.clientHeight:0);}
function gsl(){return fr(window.pageXOffset?window.pageXOffset:0,document.documentElement?document.documentElement.scrollLeft:0,document.body?document.body.scrollLeft:0);}
function gst(){return fr(window.pageYOffset?window.pageYOffset:0,document.documentElement?document.documentElement.scrollTop:0,document.body?document.body.scrollTop:0);}
function fr(n_win,n_docel,n_body){var n_result=n_win?n_win:0;if(n_docel&&(!n_result||(n_result>n_docel)))n_result=n_docel;return n_body&&(!n_result||(n_result>n_body))?n_body:n_result;}
function getAncestors() {
if ( ( typeof(window.location.ancestorOrigins) == 'object' ) ) {
var ancestors = new Array();
for ( var i=0 ; i < window.location.ancestorOrigins.length ; i++) {
ancestors.push( window.location.ancestorOrigins.item(i) );
}
return encodeURIComponent(ancestors.join(","));
} else {
return "null";
}
}
function isVisible() {
var vc = fp( document.getElementById( this.eAd ) );
var vc2 = fp( document.getElementById( this.eCheck ) );
return (vc2[0]-vc[0]==1) &&
(vc2[1]-vc[1]==1) &&
(vc[1]+this.height*this.actvis<=gst()+gch()) &&
(vc[1]+this.height*(1-this.actvis)>gst()) &&
(vc[0]+this.width*this.actvis<=gsl()+gcw()) &&
(vc[0]+this.width*(1-this.actvis)>gsl());
}
function buildQueryPart(prefix, obj) {
var args = new Array();
if ( Object.prototype.toString.call(obj) === '[object Array]' ) {
for ( var i = 0; i < obj.length ; i++ ) {
args[args.length] = buildQueryPart(prefix+'['+i+']', obj[i]);
}
} else if (typeof(obj) == 'object') {
for (var i in obj) {
args[args.length] = buildQueryPart(prefix+'['+encodeURIComponent(i)+']', obj[i]);
}
} else {
args[args.length]=prefix+'='+encodeURIComponent(obj);
}
return args.join('&');
}
function isHTTP(s){
return (new String(s).substring(0, 4)=='http');
}
function getBestParentReferrer( w, depth ) {
var parentAvailable = false;
if ( w.parent != w ) {
for( var p in w.parent.location ) {
parentAvailable = true;
break;
}
}
if (
parentAvailable &&
depth < 50
) {
return getBestParentReferrer( w.parent, depth + 1 );
} else if (
isHTTP(w.location.href) &&
window.top.location.href != "" &&
window.top.location.href == w.location.href
) {
return w.location.href;
} else if (isHTTP(w.document.referrer)) {
return w.document.referrer;
} else if (isHTTP(w.location.href)) {
return w.location.href;
} else {
return null;
}
}
function getOptimizedDocumentReferrer() {
var referrer = null;
try {
referrer = getBestParentReferrer(window, 0);
} catch (e) {
}
if ( referrer == null ) {
return (document.referrer!="")?document.referrer:window.location.href
} else {
return referrer;
}
}
this.render = function() {
if ( this.readyToRender ) {
this.u += '&adtagId=' + tpAdtagBase.prototype.adtagId;
if ( this.container == "" ) {
var innerScriptId = 'tpAdtagInnerScriptId' + this.namespace;
document.write('