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() { 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) { if (f.substring(0, 4) == 'http') { var dle = new Image(); dle.src="http://amch.questionmarket.com/adscgen/log_error.php?errcode=6&details=" + (escape("d422741/0/")); var j = f.substring(8).indexOf('/'); if (j != -1) { var gatefile = f.substring(0, j + 8) + gf + q; 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; } } } var dle = new Image(); dle.src="http://amch.questionmarket.com/adscgen/log_error.php?errcode=4&details=" + (escape(" d422741/0/ " + document.location)); } 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/adscgen/d_layer.php?sub=amch&type=d_layer&survey_num=422741&lang=&from_node=3403'; // script.language = 'JavaScript'; script.type = "text/javascript"; if (document.getElementsByTagName('head').length > 0) { void(doc.getElementsByTagName('head').item(0).appendChild(script)); } }