/*=================================================================================
' ÆÄ  ÀÏ À§ Ä¡  : /html_common/common_javascript.js
' ÇÁ·Î±×·¥ ±â´É : °øÅëÀûÀ¸·Î »ç¿ëµÇ´Â ÀÚ¹Ù½ºÅ©¸³Æ®
' ÀÛ   ¼º   ÀÚ  : ¾ç¿ë¼ö(05.09.06)
'=================================================================================*/
	

// »õÃ¢¶ç¿ì±â ÇÔ¼ö
function OpenWin(dest,title,scroll,width,height,top,left)
{
   window.open(dest,title, "scrollbars="+scroll+",toolbar=no,location=no,directories=no,status=no,width="+width+",height="+height+",resizable=no,menubar=no,top="+top+",left="+left+"");
}

// »èÁ¦½Ã ÀÀ´äÀ» ¹Þ´Â ÇÔ¼ö.
function QuestionDelete(msg){
	if(msg == ""){
		msg = "Á¤¸» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?";
	}

	return confirm(msg);
}
// °¡¿îµ¥ ÆË¾÷ ¶ç¿ì±â
function NewWindow(mypage,myname,w,h,scroll){
var win = null;
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=no';
win = window.open(mypage,myname,settings);
}

function NewWindow_popup(mypage, myname, w, h, scroll, attr)
{	//attr = ',resizable=no, status=yes';
	var win = null;
	var args = "";
	if(attr.length > 5)
		args = attr;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll + args;
	win = window.open(mypage, myname, settings);
	return win;
}

function callme(msg)
{
	var popWin = window.createPopup();
	var tot_msg, msg1, msg2, msg;
	msg1 = "<DIV STYLE='background:#ffffcc; border:1px solid black; padding:4px; width:200px; font-family:verdana; font-size:70%; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=yellowgreen, EndColorStr=#FFFFFF)'>";
	msg2 = "</DIV>";
	tot_msg = msg1 + msg + msg2;
	
	 popWin.document.body.innerHTML = tot_msg;
    
    var popupBody = popWin.document.body;
        popWin.show(0, 0, 200, 50);
    var realHeight = popupBody.scrollHeight;
        popWin.hide();
    popWin.show(0, 15 , 200, realHeight, event.srcElement);
}

function callme2(msg)
{
	var popWin = window.createPopup();
	var tot_msg, msg1, msg2, msg;
	msg1 = "<DIV STYLE='background:#ffffff; border:0px solid black; padding:4px; width:110px; font-family:verdana; font-size:70%'>";
	msg1 = msg1 + "<table border='0' cellpadding='0' cellspacing='0' width='61' height='23' background='/images/back_amble.gif'> <tr><td height='4'></td></tr> <tr> <td align='center'> <font size='1' color='white'>";
	msg2 = "</font></td></tr></table></DIV>";
	tot_msg = msg1 + msg + msg2;
	
	 popWin.document.body.innerHTML = tot_msg;
    
    var popupBody = popWin.document.body;
        popWin.show(0, 0, 70, 50);
    var realHeight = popupBody.scrollHeight;
        popWin.hide();
    popWin.show(0, 15 , 70, realHeight, event.srcElement);
}

function callme2_close(){
//	location.href = "#top";
}

// Æ÷Ä¿½ºÀÌµ¿ ÇÔ¼ö
function moveFocus(num,fromform,toform){
	var str = fromform.value.length;
	if(str == num)
		 toform.focus();
}

// ¼ýÀÚ¸¦ Ã¼Å©ÇÏ´Â ÇÔ¼ö
function IsNumeric(checkStr){
	 var strLength = 0;
	 for (i=0; i<checkStr.length; i++)
	 {
	  		ch = checkStr.charAt(i);
	  if (ch < "0" || ch > "9")
	   		return (false);
	 }
	 return(true);
}

// ÁÖ¹Îµî·Ï¹øÈ£¸¦ Ã¼Å©ÇÏ´Â ÇÔ¼ö
function juminCheck(source_temp1, source_temp2){
	 var  jumin;
  	var  gop="234567892345";
  	var  i=0;
  	var  sum=0;
  	var  a, b;
  	var  endpoint;

	 jumin=source_temp1 + source_temp2;

  	while(i<=5) {
		a=jumin.charAt(i);	
		b=gop.charAt(i);
		sum+=eval(a*b);
		i++;
  	}

  	i=6;
  	while(i<=11) {
		a=jumin.charAt(i);
		b=gop.charAt(i);
		sum+=eval(a*b);
		i++;
  	}

  	endpoint=11-(sum%11)+"";
  	endpoint=endpoint.substring(endpoint.length-1,endpoint.length);
  	bunho=jumin.charAt(12)+"";
  	
	if(bunho!=endpoint) {
		return (false);
  	}else
  	{
		return(true);
  	}
}

function IsImage(source_temp){
	var image_name2 = source_temp.substring(source_temp.length-3,source_temp.length);
	//¼±ÅÃµÈ ÆÄÀÏÀÇ È®ÀåÀÚ°¡ gif, jpgÀÎÁö Ã¼Å©ÇÑ´Ù.
	if((image_name2 != "gif")&&(image_name2 != "jpg")&&(image_name2 != "GIF")&&(image_name2 != "JPG")){
		return(false);
	}

	return(true);
}

//¸ÞÀÏÁÖ¼Ò°¡ ¿Ã¹Ù¸¥ Çü½ÄÀÎÁö Ã¼Å©ÇÏ´Â ÇÔ¼ö
function checkEmail(strEmail){	
	var arrMatch = strEmail.match(/^(\".*\"|[A-Za-z0-9_-]([A-Za-z0-9_-]|[\+\.])*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z0-9][A-Za-z0-9_-]*(\.[A-Za-z0-9][A-Za-z0-9_-]*)+)$/);
	if (arrMatch == null) {
		return false;
	}

	var arrIP = arrMatch[2].match(/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/);
	if (arrIP != null) {
		for (var i = 1; i <= 4; i++) {
			if (arrIP[i] > 255) {
				return false;
				}
			}
	}
	
	return true;
}



function page_login_check(){
	var login_source_temp;

	login_source_temp = document.all_login_check_form.lc_jumin.value;

	if(login_source_temp == ""){
		if(confirm("·Î±×ÀÎÀ» ÇÏ¼Å¾ß ¼­ºñ½º¸¦ ÀÌ¿ëÇÏ½Ç¼ö ÀÖ½À´Ï´Ù. ·Î±×ÀÎ ÇÏ½Ã°Ú½À´Ï±î")){
			all_login_check_form.submit();
			return(false);
		}else{
			return(false);
		}
	}

	return(true);
}


// ÆÀ¼±ÅÃ ·¹ÀÌÅÍ ¼±ÅÃÇÔ¼ö
function g_item_style(){
	var tmp = "plainCmtEmo.style.display";
	var check_status = eval(tmp);
	if( check_status == "none")
	{
		tmp = tmp + "= ''";
		eval(tmp);
	}
	else
	{
		tmp = tmp + "= 'none'";
		eval(tmp)
	}
}

function g_item_select(no, img_name){
	form1.abata_img.src ="../images/team/imo_"+img_name+".gif";
	form1.item_sel2.value = no;

	var tmp = "plainCmtEmo.style.display";
	tmp = tmp + "= 'none'";
	eval(tmp)
}


function CheckLen(transfer_form)
{
	var t;
	var msglen2;
	msglen2 = 0;
	msglen2 = Math.floor(form1.content.value.length);
	
	form1.msglen.value = msglen2;
	

	if(msglen2 > 300) {
	  var reserve = msglen2-300;
	  alert("¸®ÇÃ ³»¿ëÀÌ 300ÀÚ¸¦ ÃÊ°úÇÏ¿´½À´Ï´Ù.");
	  cutText();
	  return;
	}
} 

 function cutText(){
  nets_check(document.form1.content.value);
 }//

 function nets_check(aquery){
  var tmpStr;
  var temp=0;
  var onechar;
  var tcount;
  
  tcount = 0;
  tmpStr = new String(aquery);
  temp = tmpStr.length;

  for(k=0;k<temp;k++){
	 onechar = tmpStr.charAt(k);
	if(escape(onechar).length > 4)
	  tcount += 1;
	else if(onechar!='\r')
	  tcount++;
	if(tcount > 295){
	  tmpStr = tmpStr.substring(0,k);
	  break;
	}
  }
  document.form1.content.value = tmpStr;
 // cal_byte(tmpStr);
 }

/////////////////////////////////////////////////////////
// TEXTAREA ÇÊµå ¹®ÀÚ ÀÔ·Â ¼ö Á¦ÇÑ
function checkLengthLimit(objname, maxlen)
{
	var strdata		= objname.value;	// ÀÌº¥Æ®°¡ ÀÏ¾î³­ ÄÁÆ®·ÑÀÇ value °ª
	
	if(strdata.length > maxlen)	{		// ÇöÀç ±æÀÌ
		alert( maxlen + " ±ÛÀÚ¸¦ ÃÊ°ú ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù.\nÃÊ°úµÈ ³»¿ëÀº ÀÚµ¿À¸·Î »èÁ¦ µË´Ï´Ù.");
		objname.value = strdata.substring(0, maxlen);
	}
	return;
}

//////////////////////////////////////////////////////////////////////
// ±â´É : ¼ýÀÚ¸¸ ÀÔ·Â ¹Þ°íÀÚ ÇÒ¶§.. style="ime-mode:disabled"
// Å°º¸µå ÀÌº¥Æ® Ã¼Å© ÇÔ¼ö onKeyPress="isCheckDigit()"
function isCheckDigit()
{
	if ( event.keyCode<48 || event.keyCode>57 ) {
		event.returnValue=false;
		alert("¼ýÀÚ¸¸ ÀÔ·Â °¡´ÉÇÕ´Ï´Ù.");
	}
}

/////////////////////////////////////////////////////////////////////
// ±â´É : input °´Ã¼¸¦ ¹Þ¾Æ °ø¹é Á¦°ÅÈÄ °´Ã¼¿¡ ÀúÀåÇÑ ÈÄ ¹®ÀÚ¿­ ¹ÝÈ¯
// ÀÎ¼ö : strobj : input object
// °á°ú : °ø¹é Á¦°ÅÇÑ ¹®ÀÚ¿­ object¿¡ ³ÖÀº ÈÄ ¹®ÀÚ¿­ ±æÀÌ ¹ÝÈ¯
function trim(strobj) 
{ 
	var newstr = strobj.value; 
	var return_str = ''; 
	for(idx = 0; idx < newstr.length; idx++) { 
		if(newstr.charAt(idx) == ' ') continue; 
		return_str = newstr.substring(idx, newstr.length);
		break;
	}

	newstr = return_str;
	return_str = '';
	for(idx = newstr.length - 1; idx >= 0; idx--) { 
		if(newstr.charAt(idx) == ' ') continue; 
		return_str = newstr.substring(0, idx + 1);
		break;
	}
	strobj.value = return_str;
	return return_str.length; 
}

//////////////////////////////////////////////////////////////////////
//  ±â´É : ¹®ÀÚ¿­À» ¹Þ¾Æ °ø¹éÀ» Á¦°ÅÇÑÈÄ ¹ÝÈ¯
//  ÀÎ¼ö : ¹®ÀÚ¿­À» ¹ÞÀ½
//  °á°ú : °ø¹é Á¦°ÅÇÑ ¹®ÀÚ¿­À» ¹ÝÈ¯
function trimvalue(str) 
{ 
	var newstr = str; 
	var return_str = ''; 
	for(idx = 0; idx < newstr.length; idx++) { 
		if(newstr.charAt(idx) == ' ') continue; 
		return_str = newstr.substring(idx, newstr.length);
		break;
	}

	newstr = return_str;
	return_str = '';
	for(idx = newstr.length - 1; idx >= 0; idx--) { 
		if(newstr.charAt(idx) == ' ') continue; 
		return_str = newstr.substring(0, idx + 1);
		break;
	}
	return return_str; 
}

////////////////////////////////////////////////////////////////////////////////////////////////
// ÀÎ¼â ÄÄÆ÷³ÍÆ® (MeadCO) »ç¿ë ÇÔ¼ö : ¾Æ·¡ object¸¦ ÆäÀÌÁö¿¡ ¼±¾ð
// <!-- MeadCo ScriptX Control -->
// <object id="factory" style="display:none" viewastext classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
// codebase="http://www.meadroid.com/scriptx/ScriptX.cab#Version=6,1,432,1"></object>


function scriptx_print() 
{	// ¹Ì¸®º¸±â ÆäÀÌÁö¸¦ º¸¿©ÁØ´Ù..
	if (!factory.object) {
		alert("MeadCo's ScriptX ActiveX ÄÁÆ®·ÑÀÌ Á¤»óÀûÀ¸·Î ¼³Ä¡µÇÁö ¾Ê¾Ò½À´Ï´Ù!\n\nº» ÆäÀÌÁö¿¡¼­ Á¦°øÇÏ´Â MeadCo's ScriptX ¸¦ ¼³Ä¡ÇÏ¿© ÁÖ½Ê½Ã¿À.");
		return;
	} 
	else {
		factory.printing.header = ""; //À­ÂÊÅ¸ÀÌÆ²
		factory.printing.footer = ""; //¾Æ·§ÂÊÅ¸ÀÌÆ²
		factory.printing.portrait = true; //ÀÎ¼â·¹ÀÌ¾Æ¿ô¼³Á¤, °¡·Î(false), ¼¼·Î(true)
		factory.printing.leftMargin = 15.0; //¿ÞÂÊ¿©¹è
		factory.printing.topMargin = 25.0; //À­ÂÊ¿©¹é
		factory.printing.rightMargin = 15.0; //¿À¸¥ÂÊ¿©¹é
		factory.printing.bottomMargin = 20.0; //¾Æ·§ÂÊ¿©¹é
		//factory.printing.printBackground = true;

		factory.printing.Preview();    //preview
		//factory.printing.Print(true, window); // Ã¹¹øÂ° ÀÎÀÚ : ´ëÈ­»óÀÚÇ¥½Ã¿©ºÎ , µÎ¹øÂ°ÀÎÀÚ : Ãâ·ÂµÉ ÇÁ·¹ÀÓ

		//self.close();
	}
}

function direct_print() 
{	// ¹Ù·Î ÀÎ¼â½Ã È£Ãâ ÇÔ¼ö..
	if (!factory.object) {
		alert("MeadCo's ScriptX ActiveX ÄÁÆ®·ÑÀÌ Á¤»óÀûÀ¸·Î ¼³Ä¡µÇÁö ¾Ê¾Ò½À´Ï´Ù!\n\nº» ÆäÀÌÁö¿¡¼­ Á¦°øÇÏ´Â MeadCo's ScriptX ¸¦ ¼³Ä¡ÇÏ¿© ÁÖ½Ê½Ã¿À.");
		return;
	} 
	else {
		factory.printing.header = ""; //À­ÂÊÅ¸ÀÌÆ²
		factory.printing.footer = ""; //¾Æ·§ÂÊÅ¸ÀÌÆ²
		factory.printing.portrait = true; //ÀÎ¼â·¹ÀÌ¾Æ¿ô¼³Á¤, °¡·Î(false), ¼¼·Î(true)
		factory.printing.leftMargin = 15.0; //¿ÞÂÊ¿©¹è
		factory.printing.topMargin = 25.0; //À­ÂÊ¿©¹é
		factory.printing.rightMargin = 15.0; //¿À¸¥ÂÊ¿©¹é
		factory.printing.bottomMargin = 20.0; //¾Æ·§ÂÊ¿©¹é
		//factory.printing.printBackground = true;

		//factory.printing.Preview();    //preview
		factory.printing.Print(true, window); // Ã¹¹øÂ° ÀÎÀÚ : ´ëÈ­»óÀÚÇ¥½Ã¿©ºÎ , µÎ¹øÂ°ÀÎÀÚ : Ãâ·ÂµÉ ÇÁ·¹ÀÓ

		//self.close();
	}
}

// ÇÃ·¡½Ã ¹× ¾ÖÇÃ¸´ ºÎºÐ ÀÚ¹Ù½ºÅ©¸³Æ®·Î Ãâ·ÂÇÏ´Â ºÎºÐ.
function flashWrite2( content ) {
   document.writeln( content );
}

function document_write(obj)
{
	document.write(obj);
}
