/*
window.onload = function()
{
	/* <A> ÅÂ±×¿¡ ÀÚµ¿À¸·Î setStatus() ±â´É ºÎ¿©ÇÏ±â
	for( var i = 0; i < document.all.length; i++ )
	{
		var obj = document.all[i];

		if( obj.tagName == 'A' )
		{
			obj.onmouseout = function()
			{
				window.status = '';
				return true;
			}

			obj.onmouseover = function()
			{
				window.status = this.title ? this.title : this.innerText;
				return true;
			}
		}
	}
}
*/

var stepX;
var stepY;

function popBoxSetting( ImagePath )
{
	popBoxImage = new Array(4)

	for( var i = 0; i < popBoxImage.length; i++ )
	{
		popBoxImage[i] = new Image();
	    popBoxImage[i].src = ImagePath + '/box/dial_b' + (i + 10) + '.gif'
	}

	print( "<span id=mesgBox class=hideLayer style='z-index:999'>" );
	print( "<table border=0 width=100% cellspacing=0 cellpadding=0>" );
	print( "<tr><td id=mesgBoxTD1 colspan=3>" );
	print( "<tr bgcolor=white>" );
	print( " <td><img src='"+ ImagePath +"/box/dial_b01.gif' border=0></td>" );
	print( " <td background='"+ ImagePath +"/box/dial_b02.gif'></td>" );
	print( " <td><img src='"+ ImagePath +"/box/dial_b03.gif' border=0></td>" );
	print( "<tr bgcolor=white>" );
	print( " <td background='"+ ImagePath +"/box/dial_b04.gif'></td>" );
	print( " <td width=100% id=mesg nowrap class=text></td>" );
	print( " <td background='"+ ImagePath +"/box/dial_b05.gif'></td>" );
	print( "<tr bgcolor=white>" );
	print( " <td><img src='"+ ImagePath +"/box/dial_b06.gif' border=0></td>" );
	print( " <td background='"+ ImagePath +"/box/dial_b07.gif'></td>" );
	print( " <td><img src='"+ ImagePath +"/box/dial_b08.gif' border=0></td>" );
	print( "<tr><td id=mesgBoxTD2 colspan=3>" );
	print( "</table>" );
	print( "</span>" );
}



function popBox( num )
{
	var currObj = window.event.srcElement;

    if( event.y + document.body.scrollTop + mesgBox.offsetHeight > document.body.offsetHeight - 50 )
    {
        objTD = mesgBoxTD2
        stepY = mesgBox.offsetHeight + 4;
    }
    else
    {
        objTD = mesgBoxTD1
        stepY = - 2
    }

    if( event.x + document.body.scrollLeft + mesgBox.offsetWidth > document.body.offsetWidth )
    {
        if( stepY > 0 )
        objTD.innerHTML = "<img src=" + popBoxImage[3].src + " border=0 style='position:relative;top:-1'>"; else
        objTD.innerHTML = "<img src=" + popBoxImage[1].src + " border=0 style='position:relative;top:1'>";
        objTD.align = 'right'
        stepX = mesgBox.offsetWidth + 4;
    }
    else
    {
        if( stepY > 0 )
        objTD.innerHTML = "<img src=" + popBoxImage[2].src + " border=0 style='position:relative;top:-1'>"; else
        objTD.innerHTML = "<img src=" + popBoxImage[0].src + " border=0 style='position:relative;top:1'>";
        objTD.align = 'left'
        stepX = - 2
    }

    currObj.onmousemove = popBox
    currObj.onmouseout = function()
    {
        mesgBox.style.visibility = 'hidden';
        mesgBoxTD1.innerHTML = ''
        mesgBoxTD2.innerHTML = ''
    }

	if( num != null )  mesg.innerHTML = eval( 'popMesg' + num ).innerHTML;
	else if( currObj.title ) mesg.innerHTML = currObj.title;

    mesgBox.style.pixelTop = event.y + document.body.scrollTop - stepY;
    mesgBox.style.pixelLeft = event.x + document.body.scrollLeft - stepX;
    mesgBox.style.visibility = 'visible';
}



function layerToggle( mObject )
{
	if( mObject.opened )
	{
		mObject.opened = false
		mObject.style.position = 'absolute'
		mObject.style.visibility = 'hidden'
	}
	else
	{
		mObject.opened = true
		mObject.style.position = 'static'
		mObject.style.visibility = 'visible'
	}
}



function mwin( url, name, xsize, ysize, scroll, top, left, resize, status )
{
	var option = 'toolbar=0,location=0,directories=0,menubar=0,copyhistory=0'

	option += ',status='    + ( status == null ? 0 : status );
	option += ',resizable=' + ( resize == null ? 0 : resize );
	option += ',scrollbars='+ ( scroll == null ? 1 : scroll );
	option += ',width='     + ( xsize = xsize == null ? 500 : xsize );
	option += ',height='    + ( ysize = ysize == null ? 400 : ysize );
	option += ',left='      + ( left == null ? ((screen.availWidth  - xsize) / 2) : left );
	option += ',top='       + ( top  == null ? ((screen.availHeight - ysize) / 2 - 15) : top );
	gimawin = window.open( url, name, option )
	gimawin.focus()
}



function iwin( imagefile )
{
	mwin( '', 'gimaImage', 10, 10, 0, top.screenTop + 2, top.screenLeft + 2 );

	gimawin.document.open();
	gimawin.document.write( '<html><body>' )
	gimawin.document.write( '<title>±×¸²º¸±â - Áö¸¶ÀÇ Çàº¹ÇÑÈ¯»ó( http://gima.pe.kr )</title>' );
	gimawin.document.write( '<style> body { margin:0 } </style>' );
	gimawin.document.write( '<a href=javascript:self.close() title="Å¬¸¯ÇÏ¸é Ã¢À» ´Ý½À´Ï´Ù.">' );
	gimawin.document.write( '<img src=' + imagefile + ' border=0' );
	gimawin.document.write( ' onload=resizeTo(this.width+10,this.height+29)>' );
	gimawin.document.write( '</a></body></html>' );
	gimawin.document.close();
}


function setStatus()
{
	var object = window.event.srcElement;

	if( !object.onmouseout )
	{
		object.onmouseout = function()
		{
			window.status = ' ';
			return true;
		}
	}

	window.status = object.title ? object.title : object.innerText;
	return true;
}



/*----------------------------------------------------------------------------*/
// ´ÙÁß¹è¿­ ¼±¾ð ¹× ÃÊ±â°ªÀ» ÁÙ ¼ö ÀÖ´Â ÇÔ¼ö (Test: MSIE 5.0)
// ex) var Variable = new DefineArray( 10 )
// ex) var Variable = new DefineArray( 10, 10 )
// ex) var Variable = new DefineArray( 10, 10, 1 )
// ex) var Variable = new DefineArray( 10, null, 1 )
/*----------------------------------------------------------------------------*/
function DefineArray( mIndex1, mIndex2, mValue )
{
	this.length = mIndex1;

	if( mIndex2 == null )
	{
		if( mValue != null )
			for( var i = 0; i < mIndex1; i++ )
				this[i] = mValue;
	}
	else
	{
		for( var i = 0; i < mIndex1; i++ )
			this[i] = new Array( mIndex2 );

		if( mValue != null )
			for( var i = 0; i < mIndex1; i++ )
				for( var j = 0; j < mIndex2; j++ )
					this[i][j] = mValue
	}
}


function html_option( startNum, endNum, selected, text )
{
	for( var i = startNum; i < endNum; i++ )
		if( i == selected )
			print( "<option value="+ i +" selected>"+ i +" "+ text ); else
			print( "<option value="+ i +">"+ i +" "+ text );
}


/*
** ±×·¡ÇÈÀ¸·Î µÈ Å×ÀÌºíÀ» Ãâ·ÂÇØ ÁÜ
*------------------------------------------------------------------------*/
function html_grapTable( type, image, tableOption, tdOption )
{
	if( type == 'head' )
	{
		print( "<table width=100% border=0 cellpadding=0 cellspacing=0 "+ tableOption +">" );
		print( " <tr>" );
		print( "  <td><img src='"+ image +"01.gif'></td>" );
		print( "  <td width=100% background='"+ image +"02.gif'></td>" );
		print( "  <td><img src='"+ image +"03.gif'></td>" );
		print( " <tr>" );
		print( "  <td background='"+ image +"04.gif'></td>" );
		print( "  <td "+ tdOption +">" );
	}
	else if( type == 'tail' )
	{
		print( "  <td background='"+ image +"05.gif'></td>" );
		print( " <tr>" );
		print( "  <td><img src='"+ image +"06.gif'></td>" );
		print( "  <td width=100% background='"+ image +"07.gif'></td>" );
		print( "  <td><img src='"+ image +"08.gif'></td>" );
		print( " </tr>" );
		print( "</table>" );
	}
}



function html_bottomLogo( startdate, countdb )
{
	var lastdate = document.lastModified.split( /[ \/]+/ );
	var update = lastdate[2] +'.' + lastdate[0] +'.' + lastdate[1];
	
	if( typeof(startdate) != 'undefined' && startdate != '' )
		startdate = 'create: '+ startdate +', '; else
		startdate = '';

	print( "<div align=center style='font-family:µ¸¿ò; font-size:8pt; width:100%'>" );
	print( "<hr size=1 style='color:silver'>" );
	print( "<a href='http://gima.pe.kr' target=_top style='color:gray; text-decoration:none' title='http://gima.pe.kr'>" );
	print( "document "+ startdate +"update: "+ update );

	//if( typeof(countdb) != 'undefined' )
	//print( ", visit: <img src='http://gima.easytown.co.kr/php/count.php?db="+ countdb +"' align=top>" )
	print( "<br>" );
	print( "Homepage Designed by gima. 1997-"+ lastdate[2] +". http://gima.pe.kr</a>" );
	print( "</div>" );
}


function print( mesg )
{
	document.write( mesg );
}



//- °´Ã¼ÀÇ Àý´ëÁÂÇ¥(pixel)¸¦ ±¸ÇÑ´Ù
//-------------------------------------------------------------------------
function get_absolute( type, obj )
{
	var tmp = type == 'y' || type == 'top' ? obj.offsetTop : obj.offsetLeft;
	return tmp + ( obj.offsetParent ? get_absolute( type, obj.offsetParent ) : 0 );
}



//- num1, num2 »çÀÌÀÇ Á¤¼ö¸¦ ·£´ýÇÏ°Ô ¸®ÅÏ
//-------------------------------------------------------------------------
function get_random( num1, num2 )
{
	with(Math) return floor( random() * ( num2 - num1 + 1 ) ) + num1;
}
