if (document.createElement && document.getElementsByTagName) { function findFrame() { // need to find a sibling up the tree var p = window.parent; 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; } function checkDomain() { // In case the parent document has changed its domain //var fullD = document.domain; var q = window.location.search; var f; var gf = '/dynamiclogic/GateFile.html'; if (gf.length > 0) { f = findFrame(); } while (true) { try { if (top.document.domain == document.domain) return true; } catch (e) { // We expect this to happen if the domains are different. if (document.domain.indexOf('.') != -1) { var shortDomain = document.domain.substr(document.domain.indexOf('.')+1); if (shortDomain.indexOf('.') == -1) { if (gf.length > 0 && f) { // debugger; // alert('Referrer: ' + f); if (f.substring(0, 4) == 'http') { var DL_element = document.createElement('script'); DL_element.type="text/javascript"; DL_element.src="http://amch.questionmarket.com/adscgen/log_error.php?errcode=6&details=" + (escape("d210208/4/11918090")); document.getElementsByTagName('head').item(0).appendChild(DL_element); var j = f.substring(8).indexOf('/'); if (j != -1) { var gatefile = f.substring(0, j + 8) + gf + q; // alert('Loading GateFile:' + gatefile); //window.location = gatefile; //debugger var DL_element = document.createElement('iframe'); DL_element.width=0; DL_element.height=0; DL_element.src=gatefile; document.body.appendChild(DL_element); return false; } } } /* we know for 100% that this is not the same domain as the original website since there's only 1 dot left in the domain name.. aka ".com" */ var DL_element = document.createElement('iframe'); DL_element.width=0; DL_element.height=0; DL_element.src="http://amch.questionmarket.com/adscgen/log_error.php?errcode=4&details=" + (escape(" d210208/4/11918090 " + document.location)); document.getElementsByTagName('head').item(0).appendChild(DL_element); } else { document.domain = shortDomain; continue; } } return false; } /* catch */ } /* while */ } if (checkDomain()) { var docframe = top; while (docframe.document.getElementsByTagName('frameset').length) { var doc_area = 0; var biggestframe = null; //alert(docframe.frames.length); for (var i = 0; i < docframe.frames.length; i++) { if(document.body.clientWidth) { DL_width = docframe.frames[i].document.body.clientWidth; DL_height = docframe.frames[i].document.body.clientHeight; } else { DL_width = docframe.frames[i].innerWidth; DL_height = docframe.frames[i].innerHeight; } // Choose the largest frame, but give the later // frame preference if the difference is less than 1%. if (doc_area <= DL_width*DL_height*1.01) { doc_area = DL_width*DL_height; biggestframe = docframe.frames[i]; } } docframe = biggestframe; } doc = docframe.document; script = doc.createElement('script'); script.src = 'http://amch.questionmarket.com/adsc/d210208/d_layer.php?sub=amch&type=d_layer&survey_num=210208&site=4&code=11918090&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=8000&go_delay=15000&hide_selects=1&hide_objects=0&hide_iframes=0&use_brand=0&content_width=0&side=left&space=far&spacecoord=30&endpos=middle&end=near&endcoord=0&speed=5&newwin=0&gf=/dynamiclogic/GateFile.html'; // script.language = 'JavaScript'; script.type = "text/javascript"; script.defer = true; if (document.getElementsByTagName('head').length > 0) { void(doc.getElementsByTagName('head').item(0).appendChild(script)); } } } // if we support DOM constructs