var ntom_innerHTML = "";
var ntom_width = document.body.clientWidth;
var ntom_height = document.body.clientHeight;
var _document = document;
var _refer = _document.referrer;
var _patt = /(http(s)?:\/\/)?\w+(\.\w+)+/gi;
var _listSession = getCookieValueNtom("SESSION");
var _redirectUrl = getCookieValueNtom("REDIRECTURL");

function _goPage(){	
	location.href = _redirectUrl;		
}

function check_point(){	
	ntom_width = document.body.clientWidth;	
	ntom_height = document.body.clientHeight;
	resize();
}
window.onresize = check_point;

function resize(){		
	document.all.ntom_powervision.style.position = "absolute";
	document.all.ntom_powervision.style.top = (ntom_height/2)- 160;
	document.all.ntom_powervision.style.left = (ntom_width/2) - 296;
}

function skip_btn(){
	skip_innerHTML = '<img src="http://20231.cacheclip-cdn.ntomap.com/aps/20231/imbc/skip_0316.gif" onclick="javscript:_goPage();" onMouseOver=this.style.cursor="hand">';
	document.getElementById("skip_btn").innerHTML = skip_innerHTML;
	clearTimeout(_skipBtn);
}

function _ntomonLoad(){
	if (_listSession)
	{
		ntom_innerHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="592" height="333" id="power_vision" align="middle" />';
		ntom_innerHTML += '<param name="allowScriptAccess" value="always" />';
		ntom_innerHTML += '<param name="allowFullScreen" value="false" />';
		ntom_innerHTML += '<param name="movie" value="http://20231.cacheclip-cdn.ntomap.com/aps/20231/imbc/ntom_interstitial.swf" />';
		ntom_innerHTML += '<param name="FlashVars" value="interSession=' + _listSession + '" />';
		ntom_innerHTML += '<param name="quality" value="high" />';
		ntom_innerHTML += '<PARAM NAME=wmode VALUE=transparent /><PARAM NAME=bgcolor VALUE=#FFFFFF />';
		ntom_innerHTML += '</object>';

		ntom_innerHTML += '<div id="skip_btn" style="margin-left:528px;margin-top:15px;"></div>';

		document.getElementById("ntom_powervision").innerHTML = ntom_innerHTML;
		document.all.ntom_powervision.style.position = "absolute";
		document.all.ntom_powervision.style.top = (ntom_height/2)- 160;
		document.all.ntom_powervision.style.left = (ntom_width/2) - 296;

		_skipBtn = setTimeout(skip_btn, 5000);
	}
	else
	{
		_goPage();
	}
}

// ÄíÅ° °ª °¡Á®¿À±â
function getCookieValueNtom(strName){
	var strCookieName = strName + "=";
	var objCookie = _document.cookie;

	if (objCookie.length > 0){
		var nBegin = objCookie.indexOf(strCookieName);

		if (nBegin < 0){
			return;
		}

		nBegin += strCookieName.length;
		var nEnd = objCookie.indexOf(";", nBegin);

		if (nEnd == -1){
			nEnd = objCookie.length;
		}		
	}
	return unescape(objCookie.substring(nBegin, nEnd));
}

_ntomonLoad();
