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 positionCenter() // ¼¾ÅÍÁ¤·ÄÇÏ±â
{
	var iClientWidth = getWindowInnerSize().width - 730;
	var iLeftW, iRightW;
	if ((iClientWidth%2) != 0) {
		iLeftW = iClientWidth / 2; iRightW = iClientWidth / 2 + 1;
	} else {
		iLeftW = iClientWidth / 2; iRightW = iClientWidth / 2;
	}
	if (iClientWidth<= 0) { iLeftW = 0; iRightW = 0; }

	document.getElementById('bg-left').style.width = iLeftW;
	document.getElementById('bg-right').style.width = iRightW;
	document.getElementById('bg-bleft').style.width = iLeftW;
	document.getElementById('bg-bright').style.width = iRightW - 3;
}
function positionCenter_club() // ¼¾ÅÍÁ¤·ÄÇÏ±â
{
	var iClientWidth = getWindowInnerSize().width - 730;
	var iLeftW, iRightW;
	if ((iClientWidth%2) != 0) {
		iLeftW = iClientWidth / 2; iRightW = iClientWidth / 2 + 1;
	} else {
		iLeftW = iClientWidth / 2; iRightW = iClientWidth / 2;
	}
	if (iClientWidth<= 0) { iLeftW = 0; iRightW = 0; }

	document.getElementById('bg-left').style.width = iLeftW;
	document.getElementById('bg-right').style.width = iRightW;	
}

function init()
{
	positionFooter("contents-placeholder", "footer");
	positionCenter();
}

function init_club()
{
	positionFooter("contents-placeholder", "footer");
	positionCenter_club();
}


document.title="SANYO KOREA"; // title
window.onresize = init; // À©µµ»çÀÌÁî ¹Ù²î¸é ´Ù½Ã ½ÇÇà

//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 autoBlur(){ // link image auto blur
	try{
		if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus(); 
	}catch(e) {}
}
document.onfocusin=autoBlur;

function setPng24(obj) { 
    obj.width=obj.height=1; 
    obj.className=obj.className.replace(/\bpng24\b/i,''); 
    obj.style.filter = 
    "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" 
    obj.src='';  
    return ''; 
} 
