function getPos(id) // idÀÇ À§Ä¡ ÆÄ¾Ç (return id.left, id.top)
{
	var obj = document.getElementById(id);
	var pos = {left:0, top:0};

	if(typeof obj.offsetLeft != 'undefined') {

		while (obj) {
			pos.left += obj.offsetLeft;
			pos.top += obj.offsetTop;
			obj = obj.offsetParent;
		}
	} else {
		pos.left = obj.left;
		pos.top = obj.top;
	}

	return pos;
}

function maxPosition()
{
	var iMaxPos = -Number.MAX_VALUE;

	for(var i = 0; i < maxPosition.arguments.length; i++) {
		if(maxPosition.arguments[i] > iMaxPos) {
			iMaxPos = maxPosition.arguments[i];
		}
	}
	return iMaxPos;
}

function setObjectHeight(id, height) // id °´Ã¼ÀÇ ³ôÀÌ¸¦ height·Î ¼³Á¤ÇÔ
{
	var obj = document.getElementById(id);
	obj.style.height = height + "px";
}

function getObjectHeight(id) // id °´Ã¼ÀÇ ³ôÀÌ¸¦ °¡Á®¿È
{
	var obj = document.getElementById(id);
	var iObjectHeight = 0;
	iObjectHeight = obj.offsetHeight;
	return parseInt(iObjectHeight);
}

function getWindowInnerSize(win) // Ã¢ÀÇ ¾ÈÂÊ »çÀÌÁî¸¦ °¡Á®¿È. firefox¿Í ieÀÇ °´Ã¼ÀÌ¸§ÀÇ Â÷ÀÌ.
{
	if(!win) win = window;
		var objWin = new Object();
		if(typeof win.innerWidth != 'undefined') {
			objWin.width = win.innerWidth;
			objWin.height = win.innerHeight;
		} else {
			var obj = getBody(win);
			objWin.width = parseInt(obj.clientWidth);
			objWin.height = parseInt(obj.clientHeight);
		}
		return objWin;
}

function getBody(w) // body °´Ã¼ Æ¯Á¤È­
{
	return (w.document.compatMode && w.document.compatMode == "CSS1Compat") ? w.document.documentElement : w.document.body || null;
}

function positionFooter(sMiddleColPHId, sFooterId) // ÇªÅÍÀÇ À§Ä¡ ÁöÁ¤
{
	var iContentPos = getPos(sMiddleColPHId).top;

	var iWindowInnerHeight = getWindowInnerSize().height;
	var iWindowMinPos = iWindowInnerHeight - getObjectHeight(sFooterId);

	var iMaxValue = maxPosition(iContentPos, iWindowMinPos);

	var iContentFooterPHHeight = 0;

	if (iMaxValue > iContentPos) {
		iContentFooterPHHeight = iMaxValue - iContentPos;
	}

	setObjectHeight(sMiddleColPHId, iContentFooterPHHeight);
}

function init()
{
	positionFooter("Contents-placeholder", "Footer");
}

document.title="Teens - ²ÞÀÌ ÀÚ¶ó´Â ¿µ¾î Áö¸§±æ"; // title
//window.onresize = init; // À©µµ»çÀÌÁî ¹Ù²î¸é ´Ù½Ã ½ÇÇà

function autoBlur(){ // link image auto blur
	try{
		if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus(); 
	}catch(e) {}
}
document.onfocusin=autoBlur;

//START: Fix IE 6 Text Selection Bug
if (window.createPopup && document.compatMode && document.compatMode=="CSS1Compat")
{
	document.onreadystatechange = function fixIE6AbsPos() {
		if( !document.body ) { return; }
		document.body.style.height = document.documentElement.scrollHeight + 'px';
	}
}
//END: Fix IE 6 Text Selection Bug

function Flash(id,url,w,h,bg,t,vars){ // flash view code
	document.write("\
	<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width="+w+" height="+h+" id="+id+">\
	<param name='movie' value="+url+" />\
	<param name='wmode' value="+t+" />\
	<param name='bgcolor' value="+bg+" />\
	<param name='allowScriptAccess' value='Always' />\
	<param name='quality' value='high' />\
	<param name='menu' value='false' />\
	<param name='flashvars' value="+vars+" />\
	<embed src="+url+" width="+w+" height="+h+" name="+id+" bgcolor="+bg+" allowScriptAccess='sameDomain' quality='high' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />\
	</object>\
	");
}

function pop(url,name,w,h) { window.open(url,name,'width='+w+',height='+h+',scrollbars=auto') } // Popup(½ºÅ©·Ñ¹Ù¾øÀ½)
function pops(url,name,w,h) { window.open(url,name,'width='+w+',height='+h+',scrollbars=yes') } // Popup(½ºÅ©·Ñ¹ÙÀÖÀ½)

function toggleLayer(id) {
	try {
	var obj = document.getElementById(id);
	obj.style.display = (obj.style.display == "none") ? "block" : "none";
	} catch (e) { }
	return true;
}
function showLayer(id) {
	document.getElementById(id).style.display = "block";
	return true;
}
function hideLayer(id) {
	document.getElementById(id).style.display = "none";
	return true;
}


/****************************************/
/* templates by c.h.roh */
/* snatch */ 
/****************************************/
