/* a162.dl - Wed Jan 11 17:25:51 EST 2006 */
function findFrame() {
// need to find a sibling up the tree
//var p = window.parent; -- small variation for our tag we need to start w/ current window.
var p = window;
var ref;
//debugger
//alert('HOP Location:' + p.parent.location.href);
while (p != top) {
try {
if (p.location.host == window.location.host) {
ref = p.document.referrer;
}
//return p.document.referrer;
} catch (e) { // We expect this to happen if the domains are different.
}
p = p.parent;
}
return ref;
}
var DL_noiframe = (self == top);
var f = findFrame();
var host;
if (f) {
host = f;
} else {
host = document.referrer != '' ? document.referrer : document.location.href;
}
var shortDomain = document.domain;
while (shortDomain.indexOf('.') != -1 && !DL_noiframe) {
// Don't bother with gatefile if we're already in the right domain
try {
if (top.document.domain == document.domain) DL_noiframe = true;
} catch (e) {
shortDomain = document.domain.substr(document.domain.indexOf('.')+1);
if (shortDomain.indexOf('.') != -1) {
document.domain = shortDomain;
}
}
} /* while */
var DL_params = '&type=d_layer&survey_num=0&site=1604&code=0&survey_server=survey.questionmarket.com&dl_logo=&dl_invite=&dl_autoskip=&img=http://amch.questionmarket.com/static/opinion_li-250x250-1l-eng-nul.gif&delay=1000&go_delay=20000&hide_selects=1&hide_objects=0&hide_iframes=0&use_brand=0&content_width=0&side=right&space=far&spacecoord=50&endpos=coord&end=far&endcoord=45&speed=25&newwin=0';
if (!DL_noiframe) {DL_params = DL_params + '&gf=/dynamiclogic/GateFile.html';
var strIframeLocation = "/dynamiclogic/GateFile.html";
// Is /dynamiclogic/GateFile.html a directory or a complete filename?
if (strIframeLocation.substr(-1) == '/' ||
strIframeLocation.indexOf(".") == -1)
strIframeLocation += "/GateFile.html";
strIframeLocation += "?sub=amch";
function ebGetHostName(a) {
var i;
var host = '';
if ((a.length >= 7) && (a.substr(0,7) == "http://")) {
host = a.substr(7);
} else {
if ((a.length >= 8) && (a.substr(0,8) == "https://")) {
host = a.substr(8);
} else {
host=a;
}
}
i=host.indexOf("/");
if (i>0) {
host = host.substr(0,i);
}
return(host);
}
if (strIframeLocation.substr(0,4) != "http") {
var siteHost = ebGetHostName(host);
if (strIframeLocation.charAt(0) != "/")
strIframeLocation = '/' + strIframeLocation;
strIframeLocation = "http://" + siteHost + strIframeLocation;
// for testing purposes: send another request if we're in two or more nested iframes
if (parent != top) {
var DL_element = document.createElement('script');
DL_element.type="text/javascript";
DL_element.src="http://amch.questionmarket.com/adscgen/log_error.php?errcode=1&details="+
(escape("d0/1604/0 " + siteHost ));
document.getElementsByTagName('head').item(0).appendChild(DL_element);
}
}
// Make sure it's not on Yahoo. They never use the Gatefile, and do not want
// erroneous requests to it in their logs, as can happen if the campaign is
// configured incorrectly.
// Temporary hack: exclude 3dgamers.com and cnet as well.
var strlow = strIframeLocation.toLowerCase();
if (strlow.indexOf('yahoo.com') == -1 &&
strlow.indexOf('3dgamers.com') == -1 &&
strlow.indexOf('cnet.com') == -1) {
var DL_element = document.createElement('iframe');
DL_element.frameborder=0;
DL_element.width=0;
DL_element.height=0;
DL_element.src=strIframeLocation+DL_params;
DL_element.setAttribute('style', 'display:none; visibility:hidden; border:none');
document.body.insertBefore(DL_element, document.body.firstChild);
} // Temporary hack: never recruit on 3dgamers.com. (This will have
// to be made more sophisticated when they want to make exceptions.)
} else {
if (document.URL.toLowerCase().indexOf('3dgamers.com') == -1) {
var DL_element = top.document.createElement('script');
DL_element.type="text/javascript";
DL_element.src="http://amch.questionmarket.com/adscgen/dynamiclink.js.php?sub=amch"+DL_params+"&"+
(window == top? "noiframe=true" : "")+"&onload=1";
top.document.getElementsByTagName('head').item(0).appendChild(DL_element);
}
}