



var outbanner_edge_datas = [];

var outbanner_edge_codes = [];



outbanner_edge_datas[0] = "<iframe width='990' id='openmatch_ad_frame' height='660' onload='scrollBottom()' frameborder='0' scrolling='no' marginwidth='0' marginheight='0' src='http://outbanner.hu.co.kr/@files/human_banner/remarketing/edge.html?cid=25020000000000&bannerkey=1&site_id=khan&ver=11'></iframe>";

outbanner_edge_codes[0] = '52';


var rand_edge_num = Math.floor((Math.random()*outbanner_edge_datas.length));

var banner_HtmlTag = outbanner_edge_datas[rand_edge_num];





var scriptObjEdge;

var SiteUrl = window.location.host; 
var szUrl = escape(window.location.pathname + window.location.search);
var killScroll = false;
var adURL = "";

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();

	//document.getElementById("asdsadsad").innerHTML = scrollHeight+'½ºÅ©·Ñ³ôÀÌ/'+clientHeight+'´ÙÅ¥¸àÆ®È­¸éÅ©±â/'+getScrollTop()+'½ºÅ¬·Ñ»ó´Ü<br /> '+scrollPos +'<= ('+clientHeight+' + 100)';

	if (scrollPos <= (clientHeight + 100)){
		if (!killScroll) {
			killScroll = true;
			viewAd();
		}
	}
}
function viewAd() {
	if (adURL != "") {

		document.getElementById("openmatch_ad").innerHTML = adURL;

	}
}

function scrollBottom() {
	var clientHeight = document.compatMode == "CSS1Compat" ? document.documentElement.clientHeight : document.body.clientHeight;
	var scrollHeight = document.compatMode == "CSS1Compat" ? document.documentElement.scrollHeight : document.body.scrollHeight;
	var frameHeight = document.getElementById("openmatch_ad_frame").height;
//alert(frameHeight);
	if (frameHeight >= clientHeight) {
		document.getElementById("openmatch_ad").style.paddingBottom = "0px";
		//scrollTo(0, scrollHeight);

		$("html, body").animate({ scrollTop: scrollHeight }, 1500);
	}
	else {

		var paddingSize = parseInt((clientHeight - frameHeight) / 2, 10);
		document.getElementById("openmatch_ad").style.paddingBottom = paddingSize + "px";

		//scrollTo(0, scrollHeight);

		$("html, body").animate({ scrollTop: scrollHeight }, 1500);
	}
}



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()) {
	

	execAdEdge(banner_HtmlTag);

	document.write("<div id='openmatch_ad' style='position:relative; width:100%; margin:10px 0 0 0; z-index:900;text-align:center;padding:0; overflow:hidden;'></div>");
}


