// byte ¼ö¸¦ ¼¼¼­ ÇØ´ç byte°¡ ³Ñ´Â °æ¿ì °æ°í¸¦ ¶ç¿öÁÖ°í, ÇØ´ç byte·Î ¸¸µé¾îÁØ´Ù.
function cal_byte(aquery, maxbyte) 
{
	var tmpStr;
	var onechar;
	var tcount,k;
	tcount = 0;
	
	tmpStr = new String(aquery.value);

	for (k = 0 ;k < tmpStr.length; k++)
	{
		onechar = tmpStr.charAt(k);
	
		if (escape(onechar).length > 4) 
		{
		    tcount += 2;
		}
		else if (onechar!='\r') 
		{
		    tcount++;
		}
		if(tcount > maxbyte) 
		{
			alert("Áö±Ý ¾²½Å ³»¿ëÀº " + maxbyte + "¹ÙÀÌÆ® ÀÌ»óÀ» ¾²½Ç¼ö ¾ø½À´Ï´Ù.\r\n ÃÊ°úµÈ ºÎºÐÀº ÀÚµ¿À¸·Î »èÁ¦µË´Ï´Ù.");
			aquery.value = tmpStr.substring(0,k);
			return;
		}    
	}
}


// ¼ýÀÚ¸¸ ÀÔ·Â °¡´ÉÇÏ°Ô ÇÑ´Ù. (Onkeypress ¿¡¼­ ¼³Á¤)
function onlynum()
{
	if (event.keyCode!=44)
		if ((event.keyCode<48)||(event.keyCode>57)) event.returnValue=false;
}

// DB¿¡ ¾²ÀÏ inputbox¿¡¼­ Æ¯Á¤Å°ÀÇ ÀÔ·ÂÀ» ¹æÁöÇÑ´Ù.
function checkforDB()
{
	// 34,39 " '
	if ((event.keyCode == 34)||(event.keyCode == 39)) event.returnValue=false;
}


// upload ½Ã progress¸¦ º¸¿©ÁÖ´Â function
function ShowProgress(inpfile) 
{ 
   strAppVersion = navigator.appVersion; 
   if (inpfile.value != "") {
      if (strAppVersion.indexOf('MSIE')!=-1 && 
          strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4) { 

          winstyle = "dialogWidth=385px; dialogHeight:150px; center:yes"; 
          window.showModelessDialog("/include/show_progress.asp?nav=ie", null, winstyle); 
      } 
      else { 
          winpos = "left=" + ((window.screen.width-380)/2)+",top=" +
               ((window.screen.height-110)/2); 
          winstyle = "width=380,height=110,status=no,toolbar=no,menubar=no," + 
               "location=no,resizable=no,scrollbars=no,copyhistory=no," + winpos; 
          window.open("/include/show_progress.asp",null,winstyle); 
      } 
   }
   return true; 
} 

// scrollbar°¡ ¾ø´Â popupÀ» ¶ç¿ì´Â ÇÔ¼ö
function win_open(p_name, p_width, p_height)
{
	var N = p_name;
	var W = p_width;
	var H = p_height;
	
	var left =  (window.screen.width  - W) / 2 ; //Ã¢ÀÌ ¶ã¶§ °¡¿îµ¥·Î ¶ß±â
	var top  =  (window.screen.height - H) / 2 ;
	
	window.open (N, "_blank", "width=" + W + "; height=" + H + "; toolbar=no; menubar=no; scrollbars=no; resizable=no; top=" + top + "; left=" + left);
}

// scrollbar°¡ ÀÖ´Â popupÀ» ¶ç¿ì´Â ÇÔ¼ö
function win_open_scroll(p_name, p_width, p_height)
{
	var N = p_name;
	var W = p_width;
	var H = p_height;
	
	var left =  (window.screen.width  - W) / 2 ; //Ã¢ÀÌ ¶ã¶§ °¡¿îµ¥·Î ¶ß±â
	var top  =  (window.screen.height - H) / 2 ;
	
	window.open (N, "_blank", "width=" + W + ",height=" + H + ",scrollbars=yes,toolbar=no,menubar=no,top=" + top + ",left=" + left);
}
function StartPage()
{
	this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.mylv.net/');
}
function home()
{
	window.self.location = "/";
}
function sitemap()
{
	window.self.location = "/sitemap/sitemap.htm";
}
function winopen()
{
	var x = (window.screen.width / 2) - 150;
	var y = (window.screen.height / 2) - 215;
	window.open('./invite/invite.asp', 'pop_invite', 'width=300, height=430, left=' + x + ', top=' + y + 'scrollbars=no, status=no, menubar=no, resizable=no');
}
function winopen2()
{
	var x = (window.screen.width / 2) - 150;
	var y = (window.screen.height / 2) - 215;
	window.open('./semina_13.htm','kmi','width=566, height=600, left=' + x + ', top=' + y + ', scrollbars=YES, status=no, menubar=no, resizable=YES');
}
function eventopen()
{
	var x = (window.screen.width / 2) - 150;
	var y = (window.screen.height / 2) - 125;
	filename = "./popup/point_01.asp";
	window.open(filename,'kmi','width=500, height=677, left=20, top=20, scrollbars=no, status=no, menubar=no, resizable=no');
}
function pop()
{
	window.open('./popup_01.asp', 'pop', 'width=240, height=400, left='+ x + ', top=' + y + 'scrollbars=no, status=no, menubar=no, resizable=no');
}
function result(idno)
{
	location.href = "/poll/result.asp?idno=" + idno + "&page=1&search_in=";
}
function pollin()
{
	var rvalue = 0;
	var i = 0;
	for (i=0; i<document.forms.pf.spoll.length; i++)
    {
		if (document.forms.pf.spoll[i].checked == true)
			rvalue = document.forms.pf.spoll[i].value;
    } 
	if (rvalue < 1)
	{
		alert("¼±ÅÃÇÑ Ç×¸ñÀÌ ¾ø½À´Ï´Ù.");
		return;
	}
	else
		pf.submit();
}
function pollloginchk()
{
	alert("·Î±×ÀÎ ÇÏ¼Å¾ß Âü¿©ÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.");
}
function coupon()
{
	var x = window.screen.width / 2 - 250;
	var y = window.screen.height / 2 - 143;
	window.open("/mail/cupon_12.asp", "coupon", "width=499, height=286, left=" + x + ", top=" + y + ", resizable=no, scrollbars=no")
}
function address_event()
{
	var x = window.screen.width / 2 - 230;
	window.open('/update/main.asp', 'update', 'width=519, height=280, left='+x+', top=30, scrollbars=yes, status=no, resizable=no');
}
function linkpage(tbtype,id)
{
	location.href = "../" + tbtype + "/list.asp?tbID=" + id;
}
function labview_paper()
{
	var strTargetID = submenuform.use_id.value;
	var filename = "/mini_menu/aslip_send.asp?send_code=<%=strMyLabVIEWUserCode%>&return_code=" + strTargetID;
	var x = window.screen.width / 2 - 175;
	var y = window.screen.height / 2 - 150;
	window.open(filename, 'slip','width=390, height=320, left=' + x + ', top=' + y + ', scrollbars=no, status=no, resizable=no');
}
function labview_mail()
{
	var strTargetID = submenuform.use_id.value;
	var filename = "/mini_menu/mail_send.asp?send_code=<%=strMyLabVIEWUserCode%>&return_code=" + strTargetID;
	var x = window.screen.width / 2 - 175;
	var y = window.screen.height / 2 - 150;
	window.open(filename, 'slip','width=390, height=320, left=' + x + ', top=' + y + ', scrollbars=no, status=no, resizable=no');
}
function labview_point()
{
	var strTargetID = submenuform.use_id.value;
	var filename = "/mini_menu/point.asp?view_code=" + strTargetID;
	var x = window.screen.width / 2 - 137;
	var y = window.screen.height / 2 - 80;
	window.open(filename, 'slip','width=273, height=160, left=' + x + ', top=' + y + ', scrollbars=no, status=no, resizable=no');
}
function nsearchcount()
{
	var svaluechk = allsearchform.sscnt.value;

	if (svaluechk == "F")
	{
		allsearchform.txtsearch.value = "";
		allsearchform.sscnt.value = "T";
	}
}
function mainsearch()
{
	if (allsearchform.txtsearch.value == "" || allsearchform.sscnt.value == "F")
	{
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä.");
		allsearchform.txtsearch.focus();
		return;
	}
	allsearchform.action = "/include/mainsearch.asp";
	allsearchform.submit();
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}