// Àü¿ª º¯¼ö
var errmsg = "";
var errfld;

     function show(i,j) {

        if(j == "link1")   contentHide(i);
        if(j == "link2")   contentShow(i);
     }

     function contentShow(i) {
        i.style.display = "";
     }

     function contentHide(i) {
        //document.f.reset();
        i.style.display = "none";
     }
     
// ÇÊµå °Ë»ç
function check_field(fld, msg) 
{
    if ((fld.value = trim(fld.value)) == "") 			   
        error_field(fld, msg);
    else
        clear_field(fld);
    return;
}

// ÇÊµå ¿À·ù Ç¥½Ã
function error_field(fld, msg) 
{
    if (msg != "")
        errmsg += msg + "\n";
    if (!errfld) errfld = fld;
    fld.style.background = "#dbdbdb";
}

// ÇÊµå¸¦ ±ú²ýÇÏ°Ô
function clear_field(fld) 
{
    fld.style.background = "#FFFFFF";
}

// ¿ø·¡ ÀÌ¹ÌÁö Ã¢
function large_image_board(img, width, height)
{
        var top = 10;
        var left = 10;
        url = "source_image.htm?img=" + img;
        opt = 'scrollbars=no,width='+width+',height='+height+',top='+top+',left='+left;
        popup_window(url, "largeimage", opt);
}

function trim(s)
{
	var t = "";
	var from_pos = to_pos = 0;

	for (i=0; i<s.length; i++)
	{
		if (s.charAt(i) == ' ')
			continue;
		else 
		{
			from_pos = i;
			break;
		}
	}

	for (i=s.length; i>=0; i--)
	{
		if (s.charAt(i-1) == ' ')
			continue;
		else 
		{
			to_pos = i;
			break;
		}
	}	

	t = s.substring(from_pos, to_pos);
	//				alert(from_pos + ',' + to_pos + ',' + t+'.');
	return t;
}

// ÀÚ¹Ù½ºÅ©¸³Æ®·Î PHPÀÇ number_format Èä³»¸¦ ³¿
// ¼ýÀÚ¿¡ , ¸¦ Ãâ·Â
function number_format(data) 
{ 
    var tmp = '';
    var number = '';
    var cutlen = 3;
    var comma = ',';
    var i;

    len = data.length;
    mod = (len % cutlen);
    k = cutlen - mod;
    for (i=0; i<data.length; i++) 
	{
        number = number + data.charAt(i);
        if (i < data.length - 1) 
		{
            k++;
            if ((k % cutlen) == 0) 
			{
                number = number + comma;
                k = 0;
            }
        }
    }

    return number;
}

function commify(n) {
  var reg = /(^[+-]?\d+)(\d{3})/;   // Á¤±Ô½Ä
  n += '';                          // ¼ýÀÚ¸¦ ¹®ÀÚ¿­·Î º¯È¯

  while (reg.test(n))
    n = n.replace(reg, '$1' + ',' + '$2');

  return n;
}

// E-Mail °Ë»ç
function email_check(email) 
{
    if (email.value.search(/(\S+)@(\S+)\.(\S+)/) == -1)
        return false;
    else
        return true;
}

// ÁÖ¹Îµî·Ï¹øÈ£ °Ë»ç
function jumin_check(j1, j2) 
{
    if (j1.value.length<6 || j2.value.length<7)
        return false;

    var sum_1 = 0;
    var sum_2 = 0;
    var at=0;
    var juminno= j1.value + j2.value;
    sum_1 = (juminno.charAt(0)*2)+
            (juminno.charAt(1)*3)+
            (juminno.charAt(2)*4)+
            (juminno.charAt(3)*5)+
            (juminno.charAt(4)*6)+
            (juminno.charAt(5)*7)+
            (juminno.charAt(6)*8)+
            (juminno.charAt(7)*9)+
            (juminno.charAt(8)*2)+
            (juminno.charAt(9)*3)+
            (juminno.charAt(10)*4)+
            (juminno.charAt(11)*5);
    sum_2=sum_1%11;

    if (sum_2 == 0) 
	{
        at = 10;
    } 
	else 
	{
        if (sum_2 == 1) 
            at = 11;
		else 
            at = sum_2;
    }
    att = 11 - at;
    if (juminno.charAt(12) != att) 
	{
        return false;
    }

    return true
}

function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

// »õ Ã¢
function popup_window(url, winname, opt)
{
    window.open(url, winname, opt);
}

// ¿ìÆí¹øÈ£ Ã¢
function popup_zip(frm_name, frm_zip1, frm_zip2, frm_addr, rel_dir, top, left)
{
	url = '/zip.htm?frm_name='+frm_name+'&frm_zip1='+frm_zip1+'&frm_zip2='+frm_zip2+'&frm_addr='+frm_addr;
	opt = 'scrollbars=yes,width=368,height=300,top='+top+',left='+left;
	popup_window(url, "winzip", opt);
}


// Æû¸ÞÀÏ Ã¢
function popup_formmail(url)
{
	opt = 'scrollbars=yes,width=417,height=385,top=10,left=20';
	popup_window(url, "wformmail", opt);
}

// Æû¸ÞÀÏ Ã¢
function popup_member(url)
{
	opt = 'scrollbars=yes,width=730,height=500,top=0,left=0';
	popup_window(url, "popup_member", opt);
}

// Å«ÀÌ¹ÌÁö Ã¢
function large_image(it_id, width, height)
{
	var top = 10;
	var left = 10;
	url = "big_image.php?it_id=" + it_id;
	//width = width + 20;
	//height = height + 20;
	opt = 'scrollbars=no,width='+width+',height='+height+',top='+top+',left='+left;
	popup_window(url, "largeimage", opt);
}
// Å«ÀÌ¹ÌÁö Ã¢
function popup_large_image(it_id, width, height)
{
	var top = 10;
	var left = 10;
	url = "large_image.php?it_id=" + it_id;
	width = width + 50;
	height = height + 50;
	opt = 'scrollbars=yes,width='+width+',height='+height+',top='+top+',left='+left;
	popup_window(url, "largeimage", opt);
}

// , ¸¦ ¾ø¾Ø´Ù.
function no_comma(data)
{
	var tmp = '';
    var comma = ',';
    var i;

	for (i=0; i<data.length; i++)
	{
		if (data.charAt(i) != comma)
		    tmp += data.charAt(i);
	}
	return tmp;
}
 
// ½ÃÀÛ °Ë»ç È®ÀÎ
function start_member(href) 
{
    if(confirm("Á¤¸» »ç¿ë ÇÏ½Ã°Ú½À´Ï±î?")) 
        document.location.href = href;
}

// ÁßÁö °Ë»ç È®ÀÎ
function stop_member(href) 
{
    if(confirm("Á¤¸» ÁßÁö ÇÏ½Ã°Ú½À´Ï±î?")) 
        document.location.href = href;
}

// ÁßÁö °Ë»ç È®ÀÎ
function mb_memo(href , mb_id) 
{
    if(confirm( mb_id +"´Ô²² ÂÊÁö¸¦ º¸³»½Ã°Ú½À´Ï±î?")) 
        document.location.href = href;
}

// »èÁ¦ °Ë»ç È®ÀÎ
function del(href) 
{
    if(confirm("ÇÑ¹ø »èÁ¦ÇÑ ÀÚ·á´Â º¹±¸ÇÒ ¹æ¹ýÀÌ ¾ø½À´Ï´Ù.\n\nÁ¤¸» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?")) 
        document.location.href = href;
}

// »èÁ¦ °Ë»ç È®ÀÎ
function anounce(href) 
{
    if(confirm("Á¤¸» Åëº¸ÇÏ½Ã°Ú½À´Ï±î?")) 
        document.location.href = href;
}
// ÁøÇà °Ë»ç È®ÀÎ
function ok_go(href) 
{
    if(confirm("°èÁ¤ Åëº¸ ¸Þ´º ÀÔ´Ï´Ù.\n\n°è¼Ó ÁøÇàÇÏ½Ã°Ú½À´Ï±î?")) 
        document.location.href = href;
}

// ¹é¾÷ °Ë»ç È®ÀÎ
function backup_ok(href) 
{
    if(confirm("°í°´´ÔÀÇ ÆÄÀÏÀ» ¸ðµÎ ¾ÐÃàÇÏ±â À§ÇØ¼­\n\n1~3ºÐ°£ ÁöÃ¼ µÉ ¼ö ÀÖ½À´Ï´Ù.\n\n¼­¹ö¿¡¼­ ¾ÐÃàÀÌ ¿Ï·áµÇ¸é ´Ù¿î·Îµå Ã¢ÀÌ ³ªÅ¸³³´Ï´Ù.\n\nÁøÇàÇÏ½Ã°Ú½À´Ï±î?")) {
		newwindow=window.open("");
		newwindow.location= href;
	}
}

// ÄíÅ° ÀÔ·Â
function set_cookie(name, value, expirehours) 
{
	var today = new Date();
	today.setTime(today.getTime() + (60*60*1000*expirehours));
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";";
}

// ÄíÅ° ¾òÀ½
function get_cookie(name) 
{
    var find_sw = false;
    var start, end;
    var i = 0;

	for (i=0; i<= document.cookie.length; i++)
	{
		start = i;
		end = start + name.length;

		if(document.cookie.substring(start, end) == name) 
		{
			find_sw = true
			break
		}
	}

    if (find_sw == true) 
	{
        start = end + 1;
        end = document.cookie.indexOf(";", start);

        if(end < start)
            end = document.cookie.length;

        return document.cookie.substring(start, end);
    }
    return "";
}

// ÄíÅ° Áö¿ò
function delete_cookie(name) 
{
	var today = new Date();

	today.setTime(today.getTime() - 1);
	var value = getCookie(name);
	if(value != "")
		document.cookie = name + "=" + value + "; path=/; expires=" + today.toGMTString();
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function jumpselect(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
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_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_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 KeyEventHandle()
{
  if(( event.ctrlKey == true && ( event.keyCode == 78 || event.keyCode == 82 ) ) || ( event.keyCode >= 112 && event.keyCode <= 123 ))
  {
      event.keyCode                = 0;
	  event.cancelBubble        = true;
	  event.returnValue        = false; 
  }
}
document.onkeydown=KeyEventHandle;
document.onkeyup=KeyEventHandle;

window.onload=KeyEventHandle;

function flash_tag(f_name, f_id, f_width, f_height) {  
        document.write("<OBJECT id='"+f_id+"' height='"+f_height+"' width='"+f_width+"' align=middle classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000>");
		document.write("<PARAM NAME='allowScriptAccess' VALUE='always'>");
		document.write("<PARAM NAME='movie' VALUE='"+f_name+"'>");
		document.write("<PARAM NAME='quality' VALUE='high'>");
		document.write("<PARAM NAME='wmode' VALUE='transparent'>");
		document.write("<PARAM NAME='bgcolor' VALUE='#ffffff'>");
		document.write("</OBJECT>");
}

function fm(src, id, w, h, t, m) {	
	var s = '';
	var s_id = '';
	var s_t = '';
	(id == "") ? s_id="swf" : s_id = id;
	(t == "Y") ? s_t = '<param name="wmode" value="transparent">' : s_t='';
	(m == "Y") ? m = 'true' : m = 'false';

	s += '<object type="application/x-shockwave-flash" ';
	s += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
	s += 'codebase="http://fpdownload.macromedia.com/';
	s += 'pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"';
	s += 'id="'+s_id+'" width="'+w+'" height="'+h+'">';

	s += '<param name="movie" value="'+src+'">';
	s += '<param name="quality" value="best">';	
	s += s_t;
	s += '<param name="menu" value="'+m+'">';
	s += '<param name="swliveconnect" value="true">';

	s += '<embed src="'+src+'" quality="best" menu="'+m+'" ';
	s += 'wmode="transparent"';
	s += 'width="'+w+'" height="'+h+'" swliveconnect="true" ';
	s += 'id="'+s_id+'" name="'+s_id+'" type="application/x-shockwave-flash" ';
	s += 'pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed>';

	s += '<\/object>';
	document.write(s);
}

function pop_bill() {
	bill = window.open('http://www.makebill.co.kr/bill.php?id=iseller','bill','width=624,height=420,toolbar=0,status=0,fullscreen=0,menubar=0,scrollbars=0,resizable=0');
}

function go_cafe() {
	bill = window.open('http://cafe.daum.net/auctionmoim','cafe','');
}

function go_allthegate() {
	bill = window.open('http://www.allthegate.com/hyosung/index.jsp','allthegate','');
} 

function go_esellers() {
	bill = window.open('http://www.esellers.co.kr','esellers','');
} 
 
function showHides_menu(showlayer) {
	document.all['mu01'].style.display = "none";
	document.all['mu02'].style.display = "none";
	document.all['mu03'].style.display = "none";
	document.all['mu04'].style.display = "none";
	document.all['mu05'].style.display = "none";
	document.all['mu06'].style.display = "none";
	document.all['mu07'].style.display = "none";
	document.all[showlayer].style.display = "block";
	return;
}
function showHides_main(showlayer) {
	document.all['m1'].style.display = "none";
	document.all['m2'].style.display = "none";
	document.all['m3'].style.display = "none";
	document.all['m4'].style.display = "none";		
	document.all[showlayer].style.display = "block";
	return;
}

function showHides_shop(showlayer) {
	document.all['s1'].style.display = "none";
	document.all['s2'].style.display = "none";
	document.all['s3'].style.display = "none";
	document.all['s4'].style.display = "none";		
	document.all[showlayer].style.display = "block";
	return;
}

function showHides_sv(showlayer) {
	document.all['sv1'].style.display = "none";
	document.all['sv2'].style.display = "none";
	//document.all['sv3'].style.display = "none";
	//document.all['sv4'].style.display = "none";		
	document.all[showlayer].style.display = "block";
	return;
}

function chg_img ( obj, url )  //ÆäÀÌµåÀÎ ½ºÅ©¸³
{
	obj.filters.blendTrans.apply();
	obj.src = url;
	obj.filters.blendTrans.play(); 
}


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; }
}

function tax_check() {
	var top  = 10;
	var left = 100;
	 window.open("http://weblink.makebill.co.kr/?id=iseller", "¼¼±Ý°è»ê¼­", "scrollbars=yes,resizable=no,history=no,left="+left+",top="+top+",width=720,height=500");
}

function getCookie( name ){ 
	var nameOfCookie = name + "="; 
	var x = 0; 
	while( x <= document.cookie.length ){ 
		var y = (x+nameOfCookie.length); 
		if( document.cookie.substring( x, y ) == nameOfCookie ){ 
			if((endOfCookie=document.cookie.indexOf( ";", y )) == -1 ) endOfCookie = document.cookie.length; 
			return unescape( document.cookie.substring( y, endOfCookie ) ); 
		} 
		x = document.cookie.indexOf( " ", x ) + 1; 
		if( x == 0 ) break; 
	}
	return ""; 
} 	

function event_popup() 
{
	var myWidth="500";
	var myHeight="556";
	var theURL="/popup.html";  
	var myLeft = 0;
	var myTop = 0;

	if(getCookie( "event_pop") != "done") {
		objPopup2 = window.open( theURL , "_blank" , "toolbar=0,status=0,scrollbars=0,resizable=0,location=0,left=0,top=0,menubar=0 , width=" + myWidth + ",height=" + myHeight + ",top=" + myTop +",left=" + myLeft + "'"); 
	}
}

