function ImgOverOut (obj, onoff) {

	var imgpath = obj.src;
	var idx = imgpath.lastIndexOf('_o.');

	if (idx < 0) { idx = imgpath.lastIndexOf('.'); }
	else { idx += 2; }

	var fname = imgpath.substr(0, idx-2);
	if ( onoff == 1 ) { fname += '_o'; }
	else { fname += '_n'; }

	fname += '.gif';
	obj.src = fname;
}


function openWinCenter(URL,winName,w,h,scroll) {
	var x = (screen.width - w) / 2;
	var y = (screen.height - h) / 2;
	var option = "";
		option = option + "location=no,directories=no,resizable=no,status=no,toolbar=no,menubar=no,channelmode=no,";
		option = option + "scrollbars="+scroll+",left="+x+",top="+y+",width="+w+",height="+h;

	return window.open(URL,winName,option);
}


function openWinDefault(URL,winName,w,h,scroll) {
	var option = "";
		option = option + "location=no,directories=no,resizable=no,status=no,toolbar=no,menubar=no,channelmode=no,";
		option = option + "scrollbars="+scroll+",left=0,top=0,width="+w+",height="+h;

	window.open(URL,winName,option);
}


function openWinFree(URL,winName,w,h,x,y,scroll) {
	var option = "";
		option = option + "location=no,directories=no,resizable=no,status=no,toolbar=no,menubar=no,channelmode=no,";
		option = option + "scrollbars="+scroll+",left="+x+",top="+y+",width="+w+",height="+h;

	window.open(URL,winName,option);
}


function resizeMoveToCenter(URL,w,h) {
	var x = (screen.width - w) / 2;
	var y = (screen.height - h) / 2;

	window.moveTo(x,y);
	window.resizeTo(w,h);
	location.href=URL;
}


function getByteLength(str) {
	var len=0;
	if (str == null) return 0;
	for (var i=0;i<str.length;i++){
		var c=escape(str.charAt(i));
		if (c.length == 1) len++;
		else if (c.indexOf("%u") != -1) len+=2;
		else if (c.indexOf("%") != -1) len+=c.length/3;
	}
	return len;
}


function getByteLength_Replace(s) {
	var general = getByteLength(s);
	var space = (s.split(" ").length - 1) * 5;
	var lt = (s.split("<").length - 1) * 3;
	var gt = (s.split(">").length - 1) * 3;
	var br = (s.split("\n").length - 1) * 2;
	var sq = (s.split("'").length - 1);
	var len = general + space + lt + gt + br + sq;

	return len;
}


function getByteLength_general(s) {
	var general = getByteLength(s);
	var lt = (s.split("<").length - 1) * 3;
	var gt = (s.split(">").length - 1) * 3;
	var br = (s.split("\n").length - 1) * 2;
	var sq = (s.split("'").length - 1);
	var len = general + lt + gt + br + sq;

	return len;
}

function checkNumber(str){
	var sInt="0123456789";
	for (i=0;i<str.length;i++){
		if (sInt.indexOf(str.charAt(i)) == -1){
			return false;
			break;
		}
	}
	return true;
}

function checkSpaces(strValue) {
	for (var i=0;i<strValue.length;i++){
		if (strValue.charAt(i) != " "){
			return false;
			break;
		}
	}
	return true;
}

function checkString_userID(str) {
	var strOnly=/^([°¡-ÆRa-zA-Z0-9])/;
	for (i=0;i<str.length;i++){
		if(!strOnly.test(str.charAt(i))){
			return true;
		}
	}
}

function checkString_userPWD(str) {
	var sChar="0123456789abcdefghijklmnopqrstuvwxyzABCEDFGHIJKLMNOPQRSTUVWXYZ";
	for (i=0;i<str.length;i++){
		if (sChar.indexOf(str.charAt(i)) == -1){
			return true;
		}
	}
	return false;
}

function checkString(str) {
	var sChar="`~!@#$%^*|'=+\{};<>?";
	for (i=0; i<str.length; i++){
		if (sChar.indexOf(str.charAt(i)) != -1){
			return true;
			break;
		}
	}
	return false;
}

function checkString_hangle(str){
	var strOnly=/^([°¡-ÆR])/;
	for (i=0;i<str.length;i++){
		if(!strOnly.test(str.charAt(i))){
			return true;
		}
	}
}

function isEmail(e){
  return e.search(/^\s*[\w\_\-\.]+\@[\w\_\-]+(\.[\w\_\-]+)+\s*$/g)>=0;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

// ¸ñ Àû : trim ÇÔ¼ö
function trim(str) 
{
	return str.replace(/(^\s*)|(\s*$)/g, "");
}

// ¸ñ Àû : ÅÇ ÀÚµ¿ÀÌµ¿ (½ÃÀÛ°³Ã¼, ÀÌµ¿ÇÒ°³Ã¼, ÁöÁ¤ÀÔ·Â¼ö)
// »ç¿ë¿¹ : <input type="text" name="tel2" size=4 maxlength=4 onKeyUp="tabMove(this, memTel3, 4)">
function tabMove(fromInput, toInput, num) 
{
	if (trim(fromInput.value).length == num) 
	{
		toInput.focus();
	}
}


function resize_iframe(o) {
	var obj = document.getElementById(o);
	var minheight = 90;

	if (obj.contentWindow.document.location.href == 'about:blank') {
		setTimeout("resize_iframe('" + o + "')", 500);
	}
	else {
		obj.style.height = obj.contentWindow.document.body.scrollHeight + "px";
	}
}

/*
	//ÇÃ·¡½Ã »ç¿ë ½ºÅ©¸³Æ®
*/
function GnxFlashActivate( strFlashUrl , n4Witdh , n4Height , strWmode , strId , strClassName , strFlashvar, strFullScreen ){
	//width,height ¿©ºÎ & ¹­À½ (width,height°¡ ¾øÀ»¶§´Â 0 À¸·Î ¼±¾ð)
	if (n4Witdh != 0) {
		objSize_attribute = " width='"+ n4Witdh +"' height='"+ n4Height +"'";
	} else {
		objSize_attribute = "";
	}
	//id ¿©ºÎ (ID ¼¿·º·ºÅÍ°¡ ¾øÀ»°æ¿ì 0À¸·Î¼±¾ð)
	if (strId != 0) {
		objId_attribute = " id='" + strId + "'";
		objId_IE_attribute = " id='" + strId + "'";
	} else {
		objId_attribute = "";
		objId_IE_attribute = "";
	}
	//class ¿©ºÎ (class°¡ ¾øÀ»¶§´Â 0 À¸·Î ¼±¾ð)
	if (strClassName != 0) {
		className_attribute = " class='" + strClassName + "'";
	} else {
		className_attribute = "";
	}
	//wmode ¿©ºÎ (wmode°¡ ¾øÀ»¶§´Â 0 À¸·Î ¼±¾ð)
	if (strWmode != 0) {
		wmode_param = "<param name='wmode' value='" + strWmode + "' />";
		wmode_attribute = " wmode='" + strWmode + "'";
	} else {
		wmode_param = "";
		wmode_attribute = "";
	}
	//Flashvar ¿©ºÎ (wmode°¡ ¾øÀ»¶§´Â 0 À¸·Î ¼±¾ð)
	if (strFlashvar != 0) {
		Flashvar_param = "<param name='flashvars' value='" + strFlashvar + "' />";
		Flashvar_attribute = " Flashvars='" + strFlashvar + "'";
	} else {
		Flashvar_param = "";
		Flashvar_attribute = "";
	}
	// allowFullScreen ¿©ºÎ 
	if (strFullScreen != undefined){
		FullScreen_param = "<param name='allowFullScreen' value='" + strFullScreen + "' />";
		FullScreen_attribute = " allowFullScreen='" + strFullScreen + "'";
	}else{
		FullScreen_param = "";
		FullScreen_attribute = "";
	}
	document.writeln( "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,42,34' " + objSize_attribute + objId_IE_attribute + className_attribute + ">" );
	document.writeln( "<param name='movie' value='"+ strFlashUrl +"' />" );
	document.writeln( "<param name='quality' value='high' />" );
	document.writeln( "<param name='menu' value='0' />" );
	document.writeln( "<param name='name' value='pdsMovie' />" );
	document.writeln( "<param name='allowScriptAccess' value='always' />" );
	document.writeln( "<param name='scale' value='noscale' />" );
	document.writeln( "<param name='salign' value='t' />" );
	document.writeln( wmode_param );
	document.writeln( Flashvar_param );
	document.writeln( FullScreen_param );
	document.writeln( "<!-- Hixie method -->" );
	document.writeln( "<!--[if !IE]> <-->" );
	document.writeln( "<object type='application/x-shockwave-flash' showLiveConnect='true' allowScriptAccess='always' data='"+ strFlashUrl +"'" + Flashvar_attribute + objSize_attribute + objId_attribute + wmode_attribute + className_attribute + FullScreen_attribute + "></object>" );
	document.writeln( "<!--> <![endif]-->" );
	document.writeln( "</object>" );
}

/* »ç¿ë¹ý
<script type="text/javascript" language="JavaScript">
// <![CDATA[
	GnxFlashActivate('./sub_nav.swf',890,175,'opaque','TopNavi','TopNavi','Flashvars');
// ]]>
</script>
*/

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="http://www.lostsaga.com/images/null.gif";
	return null;
}

//ÄíÅ° »ý¼º
function setCookie(name, value, expiredays){
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

//ÀÎÆ®·Î ÆäÀÌÁö ÄíÅ° »ý¼º ÇÔ¼ö
function setIntroClose() {
	setCookie( "introPage", "introPageDone", 7);
	location.href="/main/index.asp";
}


//Àü¼Û È®ÀÎ º¯¼ö
var sndFlag = false;
