/*===========·Î±× °ü·Ã ½ºÅ©¸³Æ® Ãß°¡=========================*/
function Nethru_getCookieVal(offset)
{
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function Nethru_SetCookie(name, value){
   var argv = Nethru_SetCookie.arguments;
   var argc = Nethru_SetCookie.arguments.length;
   var expires = (2 < argc) ? argv[2] : null;
   var path = (3 < argc) ? argv[3] : null;
   var domain = (4 < argc) ? argv[4] : null;
   var secure = (5 < argc) ? argv[5] : false;

  // alert("DOMAIN = " + domain);
   document.cookie = name + "=" + escape (value) +
        ((expires == null) ? "" : ("; expires="+expires.toGMTString())) +
     ((path == null) ? "" : ("; path=" + path)) +
     ((domain == null) ? "" : ("; domain=" + domain)) +
        ((secure == true) ? "; secure" : "");

//	alert(document.cookie);
}

function Nethru_GetCookie(name){
   var arg = name + "=";
   var alen = arg.length;
   var clen = document.cookie.length;
   var i = 0;
   while (i < clen)
      {
      var j = i + alen;
      if (document.cookie.substring(i, j) == arg)
         return Nethru_getCookieVal (j);
      i = document.cookie.indexOf(" ", i) + 1;
      if (i == 0)
         break;
      }
  return null;
}

function Nethru_makePersistentCookie(name,length,path,domain)
{
    var today = new Date();
    var expiredDate = new Date(2011,1,1);
    var cookie;
	var value;

    cookie = Nethru_GetCookie(name);
    if ( cookie ) {
//		alert(cookie);
        return 1;
	}

	var values = new Array();
	for ( i=0; i < length ; i++ ) {
		values[i] = "" + Math.random();
	}

	value = today.getTime();

	// use first decimal
	for ( i=0; i < length ; i++ ) {
		value += values[i].charAt(2);
	}

    Nethru_SetCookie(name,value,expiredDate,path,domain);
}

function Nethru_getDomain() {
	var _host   = document.domain;
	var so      = _host.split('.');
	var dm    = so[so.length-2] + '.' + so[so.length-1];
	return (so[so.length-1].length == 2) ? so[so.length-3] + '.' + dm : dm;
}

var Nethru_domain  = Nethru_getDomain();

Nethru_makePersistentCookie("PCID",10,"/",Nethru_domain);

/*===========·Î±× °ü·Ã ½ºÅ©¸³Æ® Ãß°¡ END=========================*/


/************************************************************/

// °øÅë-±âº»ÀÌ¹ÌÁö·Ñ¿À¹ö
function ch(name,img){
	var imgUrl = "/future/images/"
	name.src = imgUrl + img;
}	

// Æ÷Ä¿½ººí·¯
function bluring(){ 
if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus(); 
} 
document.onfocusin=bluring;

// °øÅë-Ã§¸°Àú¼­ºê
function CheckUIElements_2()
{
        var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;
                yButtonFrom = parseInt (challenger1.style.top, 10);
                yButtonTo   = document.body.scrollTop + 105;
        timeoutNextCheck = 500;
        if ( Math.abs (yButtonFrom - (yMenuTo + 152)) < 6 && yButtonTo < yButtonFrom ) {
                setTimeout ("CheckUIElements_2()", timeoutNextCheck);
                return;
        }
        if ( yButtonFrom != yButtonTo ) {
                yOffset = Math.ceil( Math.abs( yButtonTo - yButtonFrom ) / 10 );
                if ( yButtonTo < yButtonFrom )
                        yOffset = -yOffset;
                        challenger1.style.top = parseInt (challenger1.style.top, 10) + yOffset;
             			timeoutNextCheck = 10;
        }
        if ( yMenuFrom != yMenuTo ) {
                yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 20 );
                if ( yMenuTo < yMenuFrom )
                        yOffset = -yOffset;
                        challenger1.style.top = parseInt (challenger1.style.top, 10) + yOffset;
                		timeoutNextCheck = 10;
        }
        setTimeout ("CheckUIElements_2()", timeoutNextCheck);
}
function challenger() {
/*	var ch = document.body.scrollHeight - 230 ;
	document.all.challenger.style.pixelTop = ch ;
	document.all.challenger.style.visibility = "visible";*/
    var y;
    challenger1.style.top = document.body.scrollTop + 105;
    challenger1.style.visibility = "visible";
    CheckUIElements_2();
    return true;    
}

/************************************************************/

function home(){
	window.location.href = '/index.jsp';
}

/************************************************************/

// Å¾¹öÆ°½ºÅ©·Ñ
function CheckUIElements()
{
        var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;
                yButtonFrom = parseInt (divMenu.style.top, 10);
                yButtonTo   = document.body.scrollTop + document.body.clientHeight - 165;
        timeoutNextCheck = 500;
        if ( Math.abs (yButtonFrom - (yMenuTo + 152)) < 6 && yButtonTo < yButtonFrom ) {
                setTimeout ("CheckUIElements()", timeoutNextCheck);
                return;
        }
        if ( yButtonFrom != yButtonTo ) {
                yOffset = Math.ceil( Math.abs( yButtonTo - yButtonFrom ) / 10 );
                if ( yButtonTo < yButtonFrom )
                        yOffset = -yOffset;
                        divMenu.style.top = parseInt (divMenu.style.top, 10) + yOffset;
             			timeoutNextCheck = 10;
        }
        if ( yMenuFrom != yMenuTo ) {
                yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 20 );
                if ( yMenuTo < yMenuFrom )
                        yOffset = -yOffset;
                        divMenu.style.top = parseInt (divMenu.style.top, 10) + yOffset;
                		timeoutNextCheck = 10;
        }
        setTimeout ("CheckUIElements()", timeoutNextCheck);
}
function OnLoad()
{
        var y;
                divMenu.style.top = document.body.scrollTop + document.body.clientHeight - 165;
                divMenu.style.visibility = "visible";
        CheckUIElements();
        return true;
}


// °ø°¨
function community(){
	var opt = "width=780,height=620,top=0,left=0,scrollbars=no";
//	window.open('/community/index.jsp', 'community',opt);
}

function community_12(){
	var opt = "width=780,height=620,top=0,left=0,scrollbars=no";
	window.open('/community/12/index.jsp', 'community',opt);
}

// °ø°¨°¡ÀÚº°
function community_member(loginid){
  var opt = "width=780,height=620,top=0,left=0,scrollbars=no" ; 
//	window.open('/community/main.jsp?id='+loginid, 'community',opt) ;
}

function community_member_12(loginid){
  var opt = "width=780,height=620,top=0,left=0,scrollbars=no" ; 
	window.open('/community/12/main.jsp?id='+loginid, 'community',opt) ;
}


/************************************************************/
function right_banner()
{
	document.write('<a href="http://future.lg.co.kr/" target="_blank"><img src="http://image1.lg.co.kr/korean/banner/lg_future03.jpg" border="0" alt="THE FACE OF THE FUTURE"></a>\n')	
}

function popEvent(url,name,w,h,scroll){
	document.open(url,name,'width='+w+',height='+h+',scrollbars='+scroll+',top=0,left=0')
}

/**
* ÀÌ¹ÌÁö ¸®»çÀÌÁî
* img ÀÌ¹ÌÁö
* maxWidth ÃÖ´ë ³Êºñ (0ÀÎ °æ¿ì Á¦ÇÑ ¾øÀ½)
* maxHeight ÃÖ´ë ³ôÀÌ (0ÀÎ °æ¿ì Á¦ÇÑ ¾øÀ½)
*/
function resizeImage(img, maxWidth, maxHeight)
{
	var w = img.width;
	var h = img.height;
		
	var isOver = (maxWidth > 0 && w > maxWidth) || (maxHeight > 0 && h > maxHeight);
		
	if (isOver)
	{
		var adjustByWidth = true;
		var changedWidth = w;
		var changedHeight = h;
			
		if (maxWidth == 0)
		{
			adjustByWidth = false;
		}
		else if (maxHeight == 0)
		{
			adjustByWidth = true;
		}
		else 
		{
			adjustByWidth = (w / maxWidth) > (h / maxHeight);
		}
			
		if (adjustByWidth)
		{
			changedWidth = maxWidth;
			changedHeight = Math.round((h * changedWidth) / w);
		}
		else 
		{
			changedHeight = maxHeight;
			changedWidth = Math.round((changedHeight * w) / h);
		}
			
		img.width = changedWidth;
		img.height = changedHeight;
	}
}

/**
* ÀÌ¹ÌÁö ¸®»çÀÌÁî
* img ÀÌ¹ÌÁö
* maxWidth ÃÖ´ë ³Êºñ (0ÀÎ °æ¿ì Á¦ÇÑ ¾øÀ½)
* maxHeight ÃÖ´ë ³ôÀÌ (0ÀÎ °æ¿ì Á¦ÇÑ ¾øÀ½)
*/
function getResizeWidth(img, maxWidth, maxHeight)
{
	var w = img.width;
	var h = img.height;
	
	var changedWidth = w;
	var changedHeight = h;
		
	var isOver = (maxWidth > 0 && w > maxWidth) || (maxHeight > 0 && h > maxHeight);
		
	if (isOver)
	{
		var adjustByWidth = true;
	//	var changedWidth = w;
	//	var changedHeight = h;
			
		if (maxWidth == 0)
		{
			adjustByWidth = false;
		}
		else if (maxHeight == 0)
		{
			adjustByWidth = true;
		}
		else 
		{
			adjustByWidth = (w / maxWidth) > (h / maxHeight);
		}
			
		if (adjustByWidth)
		{
			changedWidth = maxWidth;
			changedHeight = Math.round((h * changedWidth) / w);
		}
		else 
		{
			changedHeight = maxHeight;
			changedWidth = Math.round((changedHeight * w) / h);
		}
		
		if (changedWidth == 0)
		{
			changedWidth = maxWidth;
		}
			
	//	img.width = changedWidth;
	//	img.height = changedHeight;
	}
	
	return changedWidth;
}

/**
* ÀÌ¹ÌÁö ¸®»çÀÌÁî
* img ÀÌ¹ÌÁö
* maxWidth ÃÖ´ë ³Êºñ (0ÀÎ °æ¿ì Á¦ÇÑ ¾øÀ½)
* maxHeight ÃÖ´ë ³ôÀÌ (0ÀÎ °æ¿ì Á¦ÇÑ ¾øÀ½)
*/
function getResizeHeight(img, maxWidth, maxHeight)
{
	var w = img.width;
	var h = img.height;
	
	var changedWidth = w;
	var changedHeight = h;
		
	var isOver = (maxWidth > 0 && w > maxWidth) || (maxHeight > 0 && h > maxHeight);
		
	if (isOver)
	{
		var adjustByWidth = true;
	//	var changedWidth = w;
	//	var changedHeight = h;
			
		if (maxWidth == 0)
		{
			adjustByWidth = false;
		}
		else if (maxHeight == 0)
		{
			adjustByWidth = true;
		}
		else 
		{
			adjustByWidth = (w / maxWidth) > (h / maxHeight);
		}
			
		if (adjustByWidth)
		{
			changedWidth = maxWidth;
			changedHeight = Math.round((h * changedWidth) / w);
		}
		else 
		{
			changedHeight = maxHeight;
			changedWidth = Math.round((changedHeight * w) / h);
		}
		
		if (changedHeight == 0)
		{
			changedHeight = maxHeight;
		}
			
	//	img.width = changedWidth;
	//	img.height = changedHeight;
	}
	
	return changedHeight;
}

function indo() {
	window.open("/future/community/indo/story_view01.html","indo","width=370,height=542,scrollbars=no")
}

function top_flash() {
document.write( "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' WIDTH=700 HEIGHT=85 id=mainFlash>");
document.write( "<PARAM NAME=menu VALUE=false>");
document.write( "<PARAM NAME=movie VALUE='/future/images/"+tmenuPath+"/flash/nav.swf?tmenu="+tmenu+"&smenu="+smenu+"&login="+nTop_Id+"'>");
document.write( "<PARAM NAME=quality VALUE=high>");
document.write( "<param name=wmode value=transparent>");
document.write( "<EMBED src='/future/images/"+tmenuPath+"/flash/nav.swf?tmenu="+tmenu+"&smenu="+smenu+"&login="+nTop_Id+"' quality=high bgcolor=#FFFFFF WIDTH=700 HEIGHT=85 TYPE='application/x-shockwave-flash' PLUGINSPAGE=http://www.macromedia.com/go/getflashplayer>");
document.write( "</EMBED>");
document.write( "</OBJECT>");
}

function top_flash_new() {
document.write( "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' WIDTH=893 HEIGHT=83 id=mainFlash>");
document.write( "<PARAM NAME=menu VALUE=false>");
document.write( "<PARAM NAME=movie VALUE='/future/images/"+tmenuPath+"/flash/nav.swf?tmenu="+tmenu+"&smenu="+smenu+"&login="+nTop_Id+"'>");
document.write( "<PARAM NAME=quality VALUE=high>");
document.write( "<param name=wmode value=transparent>");
document.write( "<EMBED src='/future/images/"+tmenuPath+"/flash/nav.swf?tmenu="+tmenu+"&smenu="+smenu+"&login="+nTop_Id+"' quality=high bgcolor=#FFFFFF WIDTH=700 HEIGHT=85 TYPE='application/x-shockwave-flash' PLUGINSPAGE=http://www.macromedia.com/go/getflashplayer>");
document.write( "</EMBED>");
document.write( "</OBJECT>");
}

function subright_flash() {
document.write( "	<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' WIDTH=200 HEIGHT=565 id=mainFlash>");
document.write( "	<PARAM NAME=menu VALUE=false>");
document.write( "	<PARAM NAME=movie VALUE='/future/images/"+tmenuPath+"/flash/rp_sub.swf'>");
document.write( "	<PARAM NAME=quality VALUE=high>");
document.write( "	<param name=wmode value=transparent>");
document.write( "	<EMBED src='/future/images/"+tmenuPath+"/flash/rp_sub.swf' quality=high bgcolor=#FFFFFF WIDTH=200 HEIGHT=565 TYPE='application/x-shockwave-flash' PLUGINSPAGE=http://www.macromedia.com/go/getflashplayer>");
document.write( "	</EMBED>");
document.write( "	</OBJECT><br>");
}

function flash01(url,id,name,bgcol,wmode,w,h) {
document.write( "	<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH='"+w+"' HEIGHT='"+h+"' id='stage' ALIGN=''>");
document.write( "	<PARAM NAME=menu VALUE=false>");
document.write( "	<PARAM NAME=movie VALUE='"+url+"'>");
document.write( "	<PARAM NAME=quality VALUE=high>");
document.write( "	<PARAM NAME=bgcolor VALUE="+bgcol+">");
document.write( "	<param name=wmode value="+wmode+">");
document.write( "	<EMBED src='"+url+"' quality=high bgcolor="+bgcol+"  WIDTH='"+w+"' HEIGHT='"+h+"' NAME='"+name+"' ALIGN='' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'>");
document.write( "	</EMBED>");
document.write( "	</OBJECT>");
}

function flash02(url,id,name,bgcol,wmode,w,h) {
document.write( "	<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH='"+w+"' HEIGHT='"+h+"' id='stage' ALIGN=''>");
document.write( "	<PARAM NAME=menu VALUE=false>");
document.write( "	<PARAM NAME=movie VALUE='"+url+"'>");
document.write( "	<PARAM NAME=quality VALUE=high>");
document.write( "	<PARAM NAME=bgcolor VALUE="+bgcol+">");
document.write( "	<param name=wmode value="+wmode+">");
document.write( "	<EMBED src='"+url+"' quality=high bgcolor="+bgcol+"  WIDTH='"+w+"' HEIGHT='"+h+"' NAME='"+name+"' ALIGN='' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'>");
document.write( "	</EMBED>");
document.write( "	</OBJECT>");
}

function girlnboy_ind(){
document.write( "<object id=min type='application/x-oleobject' classid='clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11'>");
document.write( "<param name='Command' value='Minimize'>");
document.write( "</object>");
}

function trendview(url){
document.write( "	<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' WIDTH=258 HEIGHT=203 id=trendview>");
document.write( "	<PARAM NAME=menu VALUE=false>");
document.write( "	<PARAM NAME=movie VALUE='"+url+"'>");
document.write( "	<PARAM NAME=quality VALUE=high>");
document.write( "	<param name=wmode value=transparent>");
document.write( "	<EMBED src='"+url+"' quality=high bgcolor=#FFFFFF WIDTH=258 HEIGHT=203 TYPE='application/x-shockwave-flash' PLUGINSPAGE=http://www.macromedia.com/go/getflashplayer>");
document.write( "	</EMBED>");
document.write( "	</OBJECT><br>");


function bookmark(){
window.external.AddFavorite('http://future.lg.co.kr/', '¹Ì·¡ÀÇ ¾ó±¼')
}

function open_win(url){
	window.open(url,'','')
}
}