// start floating
function floatingBanner(objname, posX, posY)
{
	var obj = getRef(objname);
	obj.style.top = document.body.scrollTop + posY;
	obj.style.visibility = "visible";
	//obj.style.setExpression("left", "calXBanner(" + posX + ")", "javascript");
	obj.style.left = (posX+20);
	window.setInterval("calYBanner('" + objname +"', " + posY + ")", 10);
}

function calXBanner(posX)
{
	var edge = 20;
	return posX + edge;
}
function calYBanner(objname, posY)
{
	var obj = getRef(objname);
	var yBannerPos, yScrollTopPos;
	var yLimitPos;
	var interval;
	var yNewPos;
	var yNewTop;
	var dHeight = posY;
	var newtopY = 10;

	yScrollTopPos = parseInt(document.body.scrollTop, newtopY);
	yBannerPos = parseInt(obj.style.top, newtopY);
	if (document.body.scrollTop < dHeight) {
		yLimitPos = dHeight;
	}
	else {
		yLimitPos = document.body.scrollTop + 20;
	}

	if (yBannerPos != yLimitPos) {
		yNewPos = Math.ceil(Math.abs(yLimitPos - yBannerPos) / 20);

		if (yLimitPos < yBannerPos) {
			yNewPos = -yNewPos;
		}

		yNewTop = parseInt(obj.style.top, newtopY) + yNewPos;
		if (yNewTop > document.body.scrollHeight) {
			obj.style.top = document.body.scrollHeight;
		}
		else {
			obj.style.top = yNewTop;
		}
	  }
}
function getRef(id)
{
	if((navigator.userAgent.toLowerCase()).indexOf("firefox") != -1) return document.all[id];
 	else return document.getElementById(id);
}

var flotindoc = "<div style='position:relative;'><div style='position:absolute;top:108px;left:890px;' id='flashFlotinBanner'><div style='position:relative;'>";
function rightBanner(loc) {
	var disp = getrandom(right_promo.length,1);

	//banner
	flotindoc +="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='112' height='195'>";
	flotindoc +="<param name='movie' value='http://images.hangame.co.kr/hangame/flash/banner/floatin/"+right_promo[disp-1]+".swf'>";
	flotindoc +="<param name='allowScriptAccess' value='always'>";
	flotindoc +="<param name='wmode' value='transparent'>";
	flotindoc +="<param name='floating' value='false'>";
	flotindoc +="<param name='quality' value='high'>";
	flotindoc +="<embed src='http://images.hangame.co.kr/hangame/flash/banner/floatin/"+right_promo[disp-1]+".swf' allowScriptAccess='always' wmode='transparent' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='112' height='195'></embed></object>";

	if(loc == 'main') {
		flotindoc += "</div></div></div>";
		document.write(flotindoc);
	}
	
	/*
	//NBMS¹è³Ê·Î º¯°æ(2007.10.26) ¡æ transparent ¹®Á¦·Î º¸·ù..
	flotindoc +="<iframe src='http://ad.nbms.hangame.com/adshow?unit=114C' width='112' height='195' frameborder='0' scrolling='no' marginheight='0' marginwidth='0'></iframe>";
	*/
}

function rightFsadiboyBanner() {
	//banner
	flotinbigdoc ="<div style='position:relative;'><div class='right_floating' id='flashFlotinBanner'>";
	flotinbigdoc += "<table cellspacing='0' cellpadding='0' border='0' width='89' background='http://images.hangame.co.kr/hangame/flash/biggame/fsadigboy/float_bg.gif'>";
	flotinbigdoc += "<tr>";
	flotinbigdoc += "<td valign='top' height='232'>";
	flotinbigdoc += "<p class='title'>ÀÎ±â¼­ºñ½º</p>";
	flotinbigdoc += "<div class='game'><p class='thum'><img src='http://images.hangame.co.kr/hangame/flash/renewal/game/"+fsadigboy_promo[0]+"_55_42.gif' width='55' height='42' onClick='goFlashBanner(\"biggame\",1)' style='cursor:hand;'></p><a href='javascript:void(goFlashBanner(\"biggame\",1))' hidefocus class='name'>"+fsadigboy_name[0]+"</a></div>";
	flotinbigdoc += "<div class='game'><p class='thum'><img src='http://images.hangame.co.kr/hangame/flash/renewal/game/"+fsadigboy_promo[1]+"_55_42.gif' width='55' height='42' onClick='goFlashBanner(\"biggame\",2)' style='cursor:hand;'></p><a href='javascript:void(goFlashBanner(\"biggame\",2))' hidefocus class='name'>"+fsadigboy_name[1]+"</a></div>";
	flotinbigdoc += "<p class='go'><a href='javascript:void(flashTopMenu(\"flist\"));'><strong>100°³ÀÇ°ÔÀÓ</strong><br>¸ðµÎº¸±â</a><img src='http://images.hangame.co.kr/hangame/flash/biggame/fsadigboy/float_go.gif' width='25' height='15' onClick='flashTopMenu(\"flist\")' style='margin-bottom:-4px;cursor:hand;'></p>";
	flotinbigdoc += "</td>";
	flotinbigdoc += "</tr>";
	flotinbigdoc += "</table>";
	flotinbigdoc +="</div></div>";
	
	document.write(flotinbigdoc);
}

function rightFsabariBanner() {
	//banner
	flotinbaridoc ="<div style='position:relative;'><div style='position:absolute; top:349; left:923;' id='flashFlotinBanner'><div style='position:relative;'>";
	flotinbaridoc += "<table cellspacing='0' cellpadding='0' border='0' class='right_floating'>";
	flotinbaridoc += "<tr>";
	flotinbaridoc += "<td valign='top'>";
	flotinbaridoc += "<table cellspacing='0' cellpadding='0' border='0' width='100%'>";
	flotinbaridoc += "<tr><td class='title'><img src='http://images.hangame.co.kr/hangame/flash/biggame/fsabari/common/tit_floation.gif' width='89' height='46'></td></tr>";
	flotinbaridoc += "<tr><td class='game'><p class='thum'><img src='http://images.hangame.co.kr/hangame/flash/renewal/game/"+fsabari_promo[0]+"_55_42.gif' width='55' height='42' onClick='goFlashBanner(\"bari_ft\",1)' style='cursor:hand;'></a></p><a href='javascript:void(goFlashBanner(\"bari_ft\",1))' hidefocus class='name'>"+fsabari_name[0]+"</a></td></tr>";
	flotinbaridoc += "<tr><td class='game'><p class='thum'><img src='http://images.hangame.co.kr/hangame/flash/renewal/game/"+fsabari_promo[1]+"_55_42.gif' width='55' height='42' onClick='goFlashBanner(\"bari_ft\",2)' style='cursor:hand;'></a></p><a href='javascript:void(goFlashBanner(\"bari_ft\",2))' hidefocus class='name'>"+fsabari_name[1]+"</a></td></tr>";
	flotinbaridoc += "<tr><td class='go'><strong>100°³ÀÇ°ÔÀÓ</strong><br>¸ðµÎº¸±â<a href='#'><img src='http://images.hangame.co.kr/hangame/flash/biggame/fsabari/common/float_go.gif' width='25' height='15' style='margin-bottom:-4px' onClick='flashTopMenu(\"flist\")' style='margin-bottom:-4px;cursor:hand;'></td></tr>";
	flotinbaridoc += "</table>";
	flotinbaridoc += "</td>";
	flotinbaridoc += "</tr>";
	flotinbaridoc += "</table>";
	flotinbaridoc +="</div></div></div>";
	
	document.write(flotinbaridoc);
}

function worldRightBanner(wcode) {
	var worldbanner = "";
	var disp = getrandom(world_promo.length,1);
	worldbanner += "<div style='position:relative;'><div style='position:absolute;top:108px;left:900px;' id='flashFlotinBanner'><div style='position:relative;'>";
	//banner
	worldbanner +="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='112' height='195'>";
	worldbanner +="<param name='movie' value='http://images.hangame.co.kr/hangame/flash/banner/"+world_promo[disp-1]+".swf'>";
	worldbanner +="<param name='allowScriptAccess' value='always'>";
	worldbanner +="<param name='wmode' value='transparent'>";
	worldbanner +="<param name='floating' value='false'>";
	worldbanner +="<param name='quality' value='high'>";
	worldbanner +="<embed src='http://images.hangame.co.kr/hangame/flash/banner/"+world_promo[disp-1]+".swf' allowScriptAccess='always' wmode='transparent' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='112' height='195'></embed></object>";
	worldbanner +="</div></div></div>";

	document.write(worldbanner);
}

// end floating