
var bottomBanner;
var bannerTimerID;

// °¢ °ÔÀÓ Åä½ºÆ® ¹è³Ê Àû¿ë °øµ¿ js ÆÄÀÏ
function  viewFlash(sDiv, sURL, sId, sCid, sWidth , sHeight, sAlign, sWmode, sBgcolor, sOrder){

	var codeBase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0";
	var pluginsPage = "application/x-shockwave-flash";
	var embedType = "application/x-shockwave-flash";
	var pluginsPage = "http://www.macromedia.com/go/getflashplayer";

	var flashHTML = "";
	flashHTML += "<OBJECT CLASSID=\""+ sCid +"\" CODEBASE=\""+ codeBase +"\" WIDTH=\""+ sWidth +"\" HEIGHT=\""+ sHeight +"\" ID=\"" + sId + "\" ALIGN=\"" + sAlign + "\">";
	flashHTML += "<PARAM NAME=\"movie\" VALUE=\"" + sURL + "\">";
	flashHTML += "<PARAM NAME=\"quality\" VALUE=\"high\">";
	flashHTML += "<PARAM NAME=\"allowScriptAccess\" VALUE=\"always\">";
	flashHTML += "<param name=\"allowFullScreen\" value=\"true\" />";
	if(sWmode) flashHTML += "<PARAM NAME=\"wmode\" VALUE=\""+ sWmode + "\">";
	if(sBgcolor) flashHTML += "<PARAM NAME=\"bgcolor\" VALUE=\""+ sBgcolor + "\">";

	if(sOrder) {
		var arrayTemp = sOrder.split("|");
		var arrayOne;

		for (var i=0; i< arrayTemp.length ; i++)
		{
			if(arrayTemp[i]) {
				arrayOne = arrayTemp[i].split("=");


				if(arrayOne.length > 2) {
					var arrayValue = "";

					arrayValue += arrayTemp[i].replace(arrayOne[0] + "=","");
				}
				else {
					arrayValue = arrayOne[1];
				}

				flashHTML += "<PARAM NAME=\""+ arrayOne[0] + "\" VALUE=\""+ arrayValue + "\">";
			}
		}
	}
	flashHTML += "<EMBED SRC=\""+ sURL + "\" QUALITY=\"high\" WMODE=\"" + sWmode + "\" BGCOLOR=\"" + sBgcolor + "\"  WIDTH=\""+ sWidth +"\" HEIGHT=\""+ sHeight +"\" NAME=\"" + sId + "\" ALIGN=\"" + sAlign + "\"TYPE=\"" + embedType + "\" PLUGINSPAGE=\"" + pluginsPage + "\" />";
	flashHTML += "</OBJECT>";

	document.getElementById(sDiv).innerHTML = flashHTML;

}

function eventpop_layer_banner(d,u,w,h,l,t,z){
	document.write('<div id="'+d+'" name="'+d+'" style="display:;position:absolute;left:'+l+'px;top:'+t+'px;width:'+w+'px;height:'+h+'px; z-index:'+z+'"></div>');

	bottomBanner = getLayer(d);

	var flashDiv = d;
	var flashURL =  u;
	var flashId = "main_tost_banner";
	var flashCid = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
	var flashWidth = w;
	var flashHeight = h;
	var flashAlign = "";
	var flashWmode = "transparent";
	var flashBgcolor = "#ffffff";

	var name = "ares_tost_banner";
	var value = "true";
	var expiredays = 1;
	var expire_date = new Date();
	expire_date.setDate(expire_date.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; expires=" + expire_date.toGMTString() + "; path=/";
	
	viewFlash(flashDiv, flashURL, flashId, flashCid, flashWidth , flashHeight, flashAlign, flashWmode, flashBgcolor);

	showLayer(bottomBanner);
	bannerTimerID = setInterval('moveBottomBanner()', 20);
}

function moveBottomBanner() {
	var x, y;
	x = getPageScrollX() + getWindowWidth() - getWidth(bottomBanner);
	y = getPageScrollY() + getWindowHeight() - getHeight(bottomBanner);
	moveLayerTo(bottomBanner, x, y);
}

var toast_bw = document.documentElement.clientWidth;
var toast_bh = document.documentElement.clientHeight;
if (toast_bw <= 0){ toast_bw = document.body.clientWidth; }
if (toast_bh <= 0){ toast_bh = document.body.clientHeight; }

xpos = toast_bw - 170;
ypos = toast_bh - 150;

/*
tostbannerstate = getCookie_1DIM("ares_tost_banner");
if (tostbannerstate == null || tostbannerstate == "undefined"){
	eventpop_layer_banner("main_tost_layer_banner","http://image.mgame.com/mgamezzang/banner/tostbanner/20080724_toast_asda.swf",170,150,xpos,ypos,10000);
}
*/