////////////////////////////////////////////////////////////////////////////
/*
	°øÅëÀ¸·Î »ç¿ëÇÏ´Â script ¸¦ ÀúÀåÇÏ´Â ÆÄÀÏ ÀÔ´Ï´Ù.
	°¢°¢ÀÇ site ¿¡¼­¸¸ »ç¿ëÇÏ´Â script ÇÔ¼öµéÀº /js/common.js ¿¡ ÀúÀåµÇ¾î ÀÖ½À´Ï´Ù.

	Auth : ¾öÀÍ¹Î (NEXTBIZ)
*/
////////////////////////////////////////////////////////////////////////////


// ºê¶ó¿ìÁ® ±¸ºÐ
var os;
var ostmp = navigator.appName.charAt(0);

// browser
os = (ostmp=='M') ? '' : 1;


/* ·¹ÀÌ¾î °ü·Ã ½ºÅ©¸³Æ® */
function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

/* ÇÃ·¡½Ã ½ºÅ©¸³Æ® ver2 */

function flashTrace(url,id,w,h,bg,vars,win){
	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='FlashVars' value='"+vars+"' />"+
	"<param name='wmode' value='"+win+"' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";
	document.write(flashStr);
}

/* ÀÚµ¿ ÀÌ¹ÌÁö Æ÷Ä¿½º ¾Æ¿ô */
function autoblur() { 
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") 
	document.body.focus(); 
} 
	document.onfocusin=autoblur;

/* PNG IE6 ¿¡¼­ ±¸ÇöÇÏ±â */
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 ''; 
} 

//iframe auto resize
function iframe_autoresize(arg) {
    arg.height = eval(arg.name+".document.body.scrollHeight");
}

//Email Çü½Ä check
function Email_chk(Form_Name, Field_Name) {
	var t = eval("document." + Form_Name + "." + Field_Name + ".value");
	var ValidFlag = false;
	var atCount = 0;
	var SpecialFlag;
	var atLoop;
	var atChr;
	var BadFlag;
	var tAry1;
	var UserName;
	var DomainName;
	
	if(t.length > 0 && t.indexOf("@") > 0 && t.indexOf(".") > 0) {
		atCount = 0;
		SpecialFlag = false;
		
		for(atLoop=1; atLoop<=t.length; atLoop++) {
			atChr = t.substring(atLoop, atLoop+1);
			
			if(atChr == "@") atCount = atCount + 1;
			if((atChr >= 32) && (atChr <= 44)) SpecialFlag = true;
			if((atChr == 47) || (atChr == 96) || (atChr >= 123)) SpecialFlag = true;
			if((atChr >= 58) && (atChr <= 63)) SpecialFlag = true;
			if((atChr >= 91) && (atChr <= 94)) SpecialFlag = true;
		}
		
		if((atCount == 1) && (SpecialFlag == false)) {
			BadFlag = false;
			tAry1 = t.split("@");
			UserName = tAry1[0];
			DomainName = tAry1[1];
			
			if((UserName.length <= 0) || (DomainName.length <= 0 )) BadFlag = true;
			if(DomainName.substring(1, 2 ) == ".") BadFlag = true;
			if(DomainName.substring(DomainName.length-1, DomainName.length) == ".") BadFlag = true;
			
			ValidFlag = true;
		}
	}
	
	if(BadFlag == true) ValidFlag = false;
	
	return ValidFlag;
}

//ID Çü½Ä Check
function CheckChar(name) {
	strarr = new Array(name.value.length);
	
	if((name.value.charAt(0) < "a" || name.value.charAt(0) > "z") && (name.value.charAt(0) < "A" || name.value.charAt(0) > "Z")) {
		return true;
	}
	
	for(i = 0; i < name.value.length; i++) {
		strarr[i] = name.value.charAt(i)
		if((strarr[i] >= 0) && (strarr[i] <= 9))
			continue;
		else if((strarr[i] >= "a") && (strarr[i] <= "z"))
			continue;
		else if((strarr[i] >= "A") && (strarr[i] <= "Z"))
			continue;
		else {
			return true;
		}
	}  
	return false;
}

//±ÛÀÚ¼ö Á¦ÇÑ.
function in_ti(word, length) {
	if(word.length > length) {
		word = word.substring(0, length) + "..";
	}
	
	document.write(word);
}

/*
launchCenter(str1, str2, int1, int2, str3)
 - str1 : ÆË¾÷µÉ url 
 - str2 : ÆË¾÷Ã¢ ¸í
 - int1 : ÆË¾÷Ã¢ÀÇ °¡·Î±æÀÌ
 - int2 : ÆË¾÷Ã¢ÀÇ ¼¼·Î±æÀÌ
 - str3 : ±âÅ¸ ÆË¾÷Ã¢ÀÇ Attribute
 - ¼³¸í : ÆË¾÷Ã¢À» ¸ð´ÏÅÍÀÇ ÇÑ°¡¿îµ¥¿¡ À§Ä¡½ÃÅ´
 - ¹ÝÈ¯°ª : ¾øÀ½
*/

// launchCenter(url, name, width, height, att)
function launchCenter(url, name, width, height, att) 
{
  var str = "height=" + height + ",innerHeight=" + height;
  str += ",width=" + width + ",innerWidth=" + width;
  if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;

    var xc = (aw - width) / 2;
    var yc = (ah - height) / 2;

    str += ",left=" + xc + ",screenX=" + xc;
    str += ",top=" + yc + ",screenY=" + yc;
    str += "," + att
  }
  return window.open(url, name, str);
}


//----- ÀÌ¹ÌÁö°¡ load µÈ ÈÄ¿¡ ÀÌ¹ÌÁö resize s. -----//
function ImgResize(ImgName, width, height) {
	var True_width = ImgName.width;
	var True_height = ImgName.height;
	
	try
	{
		//°¡·Î°¡ '0'ÀÏ °æ¿ì ¼¼·Î ±âÁØÀ¸·Î ÀÌ¹ÌÁö resize
		if(width == 0 && height != 0) {
			//¿øº» ¼¼·Î°¡ ¼±¾ðµÈ ¼¼·Îº¸´Ù Å¬°æ¿ì ¼±¾ðµÈ ¼¼·Î·Î resize.
			if(True_height > height) {
				var Fixed_height = height;
			}
		} else if(width != 0 && height == 0) {
			//¼¼·Î°¡ '0'ÀÏ °æ¿ì °¡·Î ±âÁØÀ¸·Î ÀÌ¹ÌÁö resize
			//¿øº» °¡·Î°¡ ¼±¾ðµÈ °¡·Îº¸´Ù Å¬°æ¿ì ¼±¾ðµÈ °¡·Î·Î resize.
			if(True_width > width) {
				var Fixed_width = width;
			}
		} else {
			//°¡·Î, ¼¼·Î µÑ´Ù '0'ÀÌ ¾Æ´Ò °æ¿ì
			//ÀÌ¹ÌÁöÀÇ °¡·Î »çÀÌÁî¿Í ¼¼·Î »çÀÌÁîÁß Å«°ª È®ÀÎ.
			//°¡·Î°¡ ¼¼·Îº¸´Ù Å¬°æ¿ì.
			//°¡·Î¸¦ ±âÁØÀ¸·Î ÀÌ¹ÌÁö resize.
			if(True_width * height > True_height * width) {
				if(True_width > width) {
					var Fixed_width = width;
				}
			} else {
				//¼¼·Î°¡ °¡·Îº¸´Ù Å¬°æ¿ì.
				//¼¼·Î¸¦ ±âÁØÀ¸·Î ÀÌ¹ÌÁö resize.
				if(True_height > height) {
					var Fixed_height = height;
				}
			}
		}
		
		//°¡·Î, ¼¼·Î Áß ÇÏ³ªÀÇ »çÀÌÁî¶óµµ '0'ÀÏ °æ¿ì.(ÀÌ¹ÌÁö »çÀÌÁî¸¦ Àç´ë·Î °¡Á®¿ÀÁö ¸øÇßÀ» °æ¿ì.)
		if(True_width == 0 || True_height == 0) {
			if(width != 0) {
				ImgName.width = width;
			}
			if(height != 0) {
				ImgName.height = height;
			}
		} else {
			//ÀÌ¹ÌÁö »çÀÌÁî¸¦ Á¦´ë·Î °¡Á®¿ÔÀ» °æ¿ì.
			if(Fixed_width) { 
				ImgName.width = Fixed_width;
			} else if(Fixed_height) {
				ImgName.height = Fixed_height;
			}
		}
	}
	catch(e)
	{
	}
}
//----- ÀÌ¹ÌÁö°¡ load µÈ ÈÄ¿¡ ÀÌ¹ÌÁö resize e. -----//

//----- ÀÌ¹ÌÁö ³ôÀÌ¿¡ ¸ÂÃç¼­ div ³ôÀÌ ¸ÂÃçÁÖ±â s. -----//
function ImgDivheight(DivName, ImgName, height, pad) {
	if(parseInt(ImgName.height) > height) {
		DivName.style.height = height + pad;
	}
}
//----- ÀÌ¹ÌÁö ³ôÀÌ¿¡ ¸ÂÃç¼­ div ³ôÀÌ ¸ÂÃçÁÖ±â e. -----//


//--------------------------------------------------------------//
//·¹ÀÌ¾î ÆË¾÷ °ü·Ã ÇÔ¼ö
//Cookie Á¤º¸ °¡Á®¿À±â.
function getCookie(sName) {
	var aCookie = document.cookie.split("; ");
	
	for(var i = 0; i < aCookie.length; i++) {
		var aCrumb = aCookie[i].split("=");
		
		if(sName == aCrumb[0]) {
			return unescape(aCrumb[1]);
		}
	}
	return null;
}
//Cookie »ý¼º
function setCookie(name, value, expiredays) {
	var todayDate = new Date(); 
	todayDate.setDate(todayDate.getDate() + expiredays);
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

function Hide(divid) { 
	// IE
	if(!os){
		document.getElementById(divid).filters.blendTrans.apply();
		document.getElementById(divid).style.visibility = "hidden";
		document.getElementById(divid).filters.blendTrans.play();
		setCookie(divid, "done" , 1); // ÄíÅ°°ª Ã¼Å©
	}

	// Net
	else {
		document.getElementById(divid).style.visibility = "hidden";
		setCookie(divid, "done" , 1); // ÄíÅ°°ª Ã¼Å©
	}
} 
function layer_close(divid) { 
	// IE
	if(!os){
		document.getElementById(divid).filters.blendTrans.apply();
		document.getElementById(divid).style.visibility = "hidden";
		document.getElementById(divid).filters.blendTrans.play();
	}

	// Net
	else {
		document.getElementById(divid).style.visibility = "hidden";
	}
}

// layer open js
// user not control
var x =0;
var y=0;
drag = 0;
move = 0;

window.document.onmousemove = mouseMove
window.document.onmousedown = mouseDown
window.document.onmouseup = mouseUp
window.document.ondragstart = mouseStop

function mouseUp() { 
	move = 0 
} 
function mouseDown(evt) { 
	if (drag) { 
		// IE
		if(!os) {
			clickleft = window.event.x - parseInt(dragObj.style.left) 
			clicktop = window.event.y - parseInt(dragObj.style.top) 
			dragObj.style.zIndex += 1 
			move = 1 
		}

		// Net
		else {
			clickleft = evt.clientX - parseInt(dragObj.style.left) 
			clicktop = evt.clientY - parseInt(dragObj.style.top) 
			dragObj.style.zIndex += 1 
			move = 1 
		}
	} 
} 
function mouseMove(evt) { 
	if (move) {
		// IE
		if(!os) {
			dragObj.style.left = window.event.x - clickleft 
			dragObj.style.top = window.event.y - clicktop
		}

		// Net
		else {
			dragObj.style.left = evt.clientX - clickleft 
			dragObj.style.top = evt.clientY - clicktop
		}
	} 
} 
function mouseStop() { 
	// IE
	if(!os) {
		window.event.returnValue = false;
	}

	// Net
	else {
		evt.returnValue = false;
	}
} 
function Show(divid) { 
	// IE
	if(!os){
		document.getElementById(divid).filters.blendTrans.apply();
		document.getElementById(divid).style.visibility = "visible";
		document.getElementById(divid).filters.blendTrans.play();
	}

	// Net
	else {
		document.getElementById(divid).style.visibility = "visible";
	}
} 
//--------------------------------------------------------------//


// keyCode °¡ 13 ÀÏ °æ¿ì tab.
function EnterTab(FocusName) {
  if (window.event.keyCode == 13) {    
	eval("document.all." + FocusName + ".focus()");
  }
}

// keyCode °¡ 13 ÀÏ °æ¿ì¸¸ submit
function EnterSubmit(SubmitName) {
	if(window.event.keyCode == 13) {
		if(SubmitName != "") {
			eval(SubmitName + "()");
		}
	}
}

/* ÁØºñÁß */
function ready() {
	window.alert("ÇØ´ç¸Þ´º´Â ¼­ºñ½º ÁØºñÁßÀÔ´Ï´Ù.");
}