var scriptObjEdge; var PartnerIDEdge = "newshankuk_eb"; var SiteUrl = window.location.host; var szUrl = escape(window.location.pathname + window.location.search); var clientWidth = document.compatMode == "CSS1Compat" ? document.documentElement.clientWidth : document.body.clientWidth; var siteWidth = clientWidth < 970 ? clientWidth: 970; var killScroll = false; var adURL = ""; var loadCnt = 0; function getScrollTop() { var scrOfY = 0 if (typeof(window.pageYOffset) == 'number') { scrOfY = window.pageYOffset; } else if (document.documentElement && document.documentElement.scrollTop) { scrOfY = document.documentElement.scrollTop; } else if (document.body && document.body.scrollTop) { scrOfY = document.body.scrollTop; } return scrOfY; } function scrollEnd() { var scrollHeight = document.compatMode == "CSS1Compat" ? document.documentElement.scrollHeight : document.body.scrollHeight; var clientHeight = document.compatMode == "CSS1Compat" ? document.documentElement.clientHeight : document.body.clientHeight; var scrollPos = scrollHeight - getScrollTop(); if (scrollPos <= (clientHeight + 300)){ if (!killScroll) { killScroll = true; viewAd(); } } } function viewAd() { if (adURL != "") { var openmatchAdHtml = document.createElement('div'); openmatchAdHtml.innerHTML = adURL; document.getElementById("openmatch_ad").appendChild(openmatchAdHtml); } } function scrollBottom() { if (loadCnt == 0) { var clientHeight = document.compatMode == "CSS1Compat" ? document.documentElement.clientHeight : document.body.clientHeight; var scrollHeight = document.compatMode == "CSS1Compat" ? document.documentElement.scrollHeight : document.body.scrollHeight; var imgHeight = document.getElementById("openmatch_ad_img").height; if (imgHeight >= clientHeight) { document.getElementById("openmatch_ad").style.paddingBottom = "0px"; scrollTo(0, scrollHeight); } else { var paddingSize = parseInt((clientHeight - imgHeight) / 2, 10); document.getElementById("openmatch_ad").style.paddingBottom = paddingSize + "px"; scrollTo(0, scrollHeight); } resizeMap(); loadCnt++; } } function resizeMap() { var ImageMap = function (map, img) { var n, areas = map.getElementsByTagName('area'), len = areas.length, coords = []; if (typeof(img.naturalWidth) == "undefined") { previousWidth = 1200; } else { previousWidth = img.naturalWidth; } for (n = 0; n < len; n++) { coords[n] = areas[n].coords.split(','); } this.resize = function () { var n, m, clen, x = img.offsetWidth / previousWidth; for (n = 0; n < len; n++) { clen = coords[n].length; for (m = 0; m < clen; m++) { coords[n][m] = Math.round(parseInt(coords[n][m], 10) * x); } areas[n].coords = coords[n].join(','); } previousWidth = img.offsetWidth; return true; }; window.onresize = this.resize; }; if (document.getElementById('OPENMATCH_IMGMAP_ID') != null) { imageMap = new ImageMap(document.getElementById('OPENMATCH_IMGMAP_ID'), document.getElementById('openmatch_ad_img')); imageMap.resize(); } return; } function AdOpenmatchRequestEdge(fullUrl) { this.fullUrl = fullUrl; this.noCacheIE = '&noCacheIE=' + (new Date()).getTime(); this.headLoc = document.getElementsByTagName("head").item(0); this.scriptId = 'JscriptId' + AdOpenmatchRequestEdge.scriptCounter++; } AdOpenmatchRequestEdge.scriptCounter = 1; AdOpenmatchRequestEdge.prototype.buildScriptTag = function () { this.scriptObjEdge = document.createElement("script"); this.scriptObjEdge.setAttribute("type", "text/javascript"); this.scriptObjEdge.setAttribute("charset", "euc-kr"); this.scriptObjEdge.setAttribute("src", this.fullUrl + this.noCacheIE); this.scriptObjEdge.setAttribute("id", this.scriptId); } AdOpenmatchRequestEdge.prototype.removeScriptTag = function () { this.headLoc.removeChild(this.scriptObjEdge); } AdOpenmatchRequestEdge.prototype.addScriptTag = function () { this.headLoc.appendChild(this.scriptObjEdge); } function addEvent(obj, type, listener) { if (window.addEventListener) obj.addEventListener(type, listener, false); else obj.attachEvent('on'+type, listener); } function execAdEdge(value) { //Scroll Event Add adURL = value; addEvent(window, "scroll", scrollEnd); scriptObjEdge.removeScriptTag(); } function execNoAdEdge() { scriptObjEdge.removeScriptTag(); } function sleep(msecs) { var start = new Date().getTime(); var cur = start; while (cur - start < msecs) { cur = new Date().getTime() } } function checkBrowserEdge() { if (navigator.userAgent.indexOf("Chrome") > -1) { return false; } else if (navigator.userAgent.indexOf("Safari") > -1) { return false; } else return false; } if (!checkBrowserEdge()) { var url = "http://ad.openmatch.co.kr/AppCm/cm_ad_edgebanner.asp?siteUrl=" + SiteUrl + "&szUrl="+ szUrl +"&cddtc="+ PartnerIDEdge; scriptObjEdge = new AdOpenmatchRequestEdge(url); scriptObjEdge.buildScriptTag(); scriptObjEdge.addScriptTag(); document.write("
"); } document.write('');