/* a134.dl - Tue May 23 15:07:35 EDT 2006 */ function findFrame() { // need to find a sibling up the tree var p = window; var ref; while (p != top) { try { if (p.location.host == window.location.host) { ref = 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_link&survey_num=0&site=5084&code=0&survey_server=survey.questionmarket.com&dl_logo=nyt-775x100-1l-eng-nul.jpg&dl_invite=generic_nonincentive&dl_autoskip=40&dl_exclude=select.nytimes.com&img=http://amch.questionmarket.com/static/&delay=0&go_delay=0&use_brand=&dl_delay_capture=5000'; if (!DL_noiframe) {DL_params = DL_params + '&gf=/ads/dynamiclogic/GateFile.html'; var strIframeLocation = "/ads/dynamiclogic/GateFile.html"; // Is /ads/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/5084/0 " + siteHost )); document.getElementsByTagName('head').item(0).appendChild(DL_element); } } 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); } else { 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); }