function image_auto_resize(this_s,width,height)
{ 

	var ta_image = new Image();	
	ta_image.src = this_s.src; 

	if(!width)
	{
		this_s.removeAttribute('width'); 
		this_s.style.width='auto';
	} 
	else if(width < ta_image.width)
	{ 
		this_s.width = width; 
	}
	else
	{ 
		this_s.width = ta_image.width; 
	} 

	if(!height)
	{
		this_s.removeAttribute('height'); 
		this_s.style.height='auto';
	} 
	else if(height < ta_image.height)
	{ 
		this_s.height = height; 
	}
	else
	{ 
		this_s.height = ta_image.height; 
	} 
} 

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

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_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=='Netscape')&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

MM_reloadPage(true);

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

function MM_showHideLayers() { //v3.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 cookieVal(cookieName)
{
	thisCookie = document.cookie.split("; ");
	for(i=0; i<thisCookie.length; i++)
	{
		if(cookieName == thisCookie[i].split("=")[0])
		{
			return thisCookie[i].split("=")[1];
		}
	}

	return "x";
}


////////Á¦Ç°°ü·Ã////////
function menu(formname)
{
	var target=self // Å¸°Ù
	if (formname.value=='')
	{	// ¸Þ´º¸¦ ¼±ÅÃÇÏÁö¾Ê°í ¹öÆ° Å¬¸¯½Ã ÀÌº¥Æ®
	}
	else 
	{
		target.location=formname.options[formname.selectedIndex].value;
		document.formname.selectedIndex=0; // ÀÌµ¿ÇÑ ´ÙÀ½ Ç®´Ù¿î¸Þ´º ¼±ÅÃÇØÁ¦
	}
}

function MM_openBrWindow(theURL,winName,features)
{ //v2.0
	window.open(theURL,winName,features);
}

function l_img_popup(parent,cat_id,item_id,l_img,width,height)
{//Á¦Ç°ÆË¾÷Ã¢ 01
	window.open('http://www.digitalindus.com/l_img_popup.html?parent='+parent+'&cat_id='+cat_id+'&item_id='+item_id+'&l_img='+l_img+'&width='+width+'&height='+height,'','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=no,width='+width+',height='+height);
}

function l_img_popup2(parent,cat_id,item_id,l_img,width,height)
{//Á¦Ç°ÆË¾÷Ã¢ 02
	window.open('http://www.digitalindus.com/l_img_popup.html?parent='+parent+'&cat_id='+cat_id+'&item_id='+item_id+'&l_img='+l_img+'&width='+width+'&height='+height,'','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=no,width='+width+',height='+height);
}

function l_img_popup3(l_img,title)
{//Á¦Ç°ÆË¾÷Ã¢ 03
	window.open('http://www.digitalindus.com/l_img_popup02.html?l_img='+l_img+'&title='+title,'p2','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=no');
}

function img_list_popup(img,number,title)
{//ÀÌ¹ÌÁö ¸®½ºÆ® ÆË¾÷Ã¢
	window.open('http://www.digitalindus.com/l_img_popup.php?img='+img+'&number='+number+'&title='+title,'p2','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=no');
}

function Check_Nums()
{//¼ýÀÚ¸¸ ÀÔ·ÂµÇ°Ô²û.
	if ((event.keyCode < 48) || (event.keyCode > 57))
	{
		var form = document.form; return false;
	}
}


////////ÁÖ¹®°ü·Ã////////
function not_order()
{
	window.alert('·Î±×ÀÎ ÇÏ½Ã¸é ÁÖ¹®ÇÏ½Å ¹°Ç°ÀÇ ¹è¼Û»óÅÂ¸¦ È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.')
	location.href = "$root_url/member/login.php?move_url=/mypage/order_list.php";
	return;
}

function p_openWindow()
{//°áÁ¦¿ë ¿ìÆí¹øÈ£ Ã£±â 01
	window.open ('addr_search.php?mode=zip','Á¦Ç°±¸¸ÅÀÚ','toolbar=no,location=no,menubar=no,scrollbars=no,resizable=yes,width=476,height=265');
}

function p_openWindow02()
{//°áÁ¦¿ë ¿ìÆí¹øÈ£ Ã£±â 02
	window.open ('addr_search.php?mode=re_zip','¹è¼ÛÁö','toolbar=no,location=no,menubar=no,scrollbars=no,resizable=yes,width=476,height=265');
}

function p_openWindow03()
{//°áÁ¦¿ë ¿ìÆí¹øÈ£ Ã£±â 01
	window.open ('addr_search.php?mode=card','Ä«µå','toolbar=no,location=no,menubar=no,scrollbars=no,resizable=yes,width=476,height=265');
}

function form_bgChange(obj, act)
{//Æ÷Ä¿½º»ç¿ë½Ã input¹ÙÅÁ»öÀ» ¹Ù²Û´Ù
	if(act == 'R1')
	{
		obj.style.backgroundColor='#FFDDC1';
	}
	else if(act == 'R2')
	{
		obj.style.backgroundColor='#FFF0E3';
	}
	else if(act == 'B1')
	{
		obj.style.backgroundColor='#BDD6F8';
	}
	else if(act == 'B2')
	{
		obj.style.backgroundColor='#DBE8FB';
	}
	else if(act == 'O1')
	{
		obj.style.backgroundColor='#FEEE96';
	}
	else if(act == 'O2')
	{
		obj.style.backgroundColor='#FCF4C6';
	}
	else if(act == 'G1')
	{
		obj.style.backgroundColor='#D3F8BD';
	}
	else if(act == 'G2')
	{
		obj.style.backgroundColor='#EBFCE1';
	}
	else if(act == 'GR1')
	{
		obj.style.backgroundColor='#EFEFEF';
	}
	else if(act == 'GR2')
	{
		obj.style.backgroundColor='#FFFFFF';
	}
}

function comma_dis(num)
{//ÄÄ¸¶Á¦°Å
	Num_str = num.value;
	r_num = Num_str.replace(/\,/g,"");
	num.value = r_num;
	//num.value = '';
}

function Check_Nums_coma(num)
{//ÄÄ¸¶»ý¼º
	var Numcomma = num.value; /* ÀÔ·ÂµÈ °ª ºÒ·¯¿À±â */
	var Numcommalen = Numcomma.length-1; /* ÀÔ·ÂµÈ °ªÀÇ ±æÀÌ °è»ê */
	var money = "";
	var y = 0;

	for (var x=Numcommalen; x>=0; x--)  /* ÄÄ¸¶ Á¦°Å¸¦ À§ÇØ ±æÀÌ ¸¸Å­ ·çÇÁ¸¦ °Å²Ù·Î µ¹¸°´Ù. */
	{
		var moyo = Numcomma.charAt(x);

		if (moyo != ",")  /* ÄÄ¸¶°¡ ¾ø´Â °æ¿ì¿¡¸¸ ¼ýÀÚ¸¦ ºÙÀÎ´Ù */
		{
			if (y%3 == 0 && y != 0) /* ¼¼ÀÚ¸® ¸¶´Ù ÄÄ¸¶¸¦ ºÙÀÎ´Ù. */
			{
				money = moyo + "," + money
				y++;
			}
			else
			{
				money = moyo + money;
				y++;
			}
		}
	}

	num.value = money;
}



////////È¸¿ø°ü·Ã////////
function sameid()
{ //¾ÆÀÌµð Ã¼Å© ¹× °Ë»ö
	var str = document.member_write.i_user_id;

	if(str.value == '')
	{
		alert('ÀÌ¿ëÇÏ½Ç È¸¿øID¸¦ ÀÔ·ÂÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù..');
		str.focus();
		return;
	}

	if(str.value.length < 5 || str.value.length > 12)
	{
		alert('ÀÌ¿ëÇÏ½Ç È¸¿øID´Â ¿µ¹® ¶Ç´Â ¼ýÀÚ·Î 5~12ÀÚ »çÀÌÀÔ´Ï´Ù.');
		str.focus();
		return;
	}
	else
	{
		if (str.value=='digitalindus' || str.value=='DIGITALINDUS')
		{
			alert('digitalindus´Â ¾ÆÀÌµð·Î »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.');
			return;
		}

		if (str.value=='admin' || str.value=='ADMIN')
		{
			alert('adminÀº ¾ÆÀÌµð·Î »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.');
			return;
		}

		for (i = 0; i < str.value.length; i++)
		{		
			if (str.value.charAt(i) >= '0' && str.value.charAt(i) <= '9')
			{
				continue;
			}
			else if (str.value.charAt(i) >= 'a' && str.value.charAt(i) <= 'z')
			{
				continue;
			}
			else if (str.value.charAt(i) >= 'A' && str.value.charAt(i) <= 'Z')
			{
				continue;
			}
			else
			{
				alert("È¸¿øID´Â ¿µ¹®ÀÚ(´ë¹®ÀÚ,¼Ò¹®ÀÚ), ¼ýÀÚ¸¸ »ç¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.");
				str.focus();
				str.select();
				return;
			}
		}
	}

	window.open ('id_search.php?mode=p&i_user_id='+document.member_write.i_user_id.value,'id_check','toolbar=no,location=no,menubar=no,scrollbars=no,resizable=yes,width=386,height=210')
}

function member()
{//ÃßÃµÀÎ Ã¼Å© ¹× °Ë»ö
	var str = document.member_write.recom_member;

	if(str.value == '')
	{
		alert('ÃßÃµÇÒ È¸¿øID¸¦ ÀÔ·ÂÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù..');
		str.focus();
		return;
	}

	if(str.value.length < 5 || str.value.length > 12)
	{
		alert('ÃßÃµÀÎ ¾Æ¾Æµð´Â ¿µ¹® ¶Ç´Â ¼ýÀÚ·Î 5~12ÀÚ »çÀÌÀÔ´Ï´Ù.');
		str.focus();
		return;
	}
	else
	{
		if (str.value=='digitalindus' || str.value=='DIGITALINDUS')
		{
			alert('digitalindus´Â ÃßÃµÀÎÀÌ µÉ ¼ö ¾ø½À´Ï´Ù.');
			return;
		}

		if (str.value=='admin' || str.value=='ADMIN')
		{
			alert('adminÀº ÃßÃµÀÎÀÌ µÉ ¼ö ¾ø½À´Ï´Ù.');
			return;
		}

		for (i = 0; i < str.value.length; i++)
		{		
			if (str.value.charAt(i) >= '0' && str.value.charAt(i) <= '9')
			{
				continue;
			}
			else if (str.value.charAt(i) >= 'a' && str.value.charAt(i) <= 'z')
			{
				continue;
			}
			else if (str.value.charAt(i) >= 'A' && str.value.charAt(i) <= 'Z')
			{
				continue;
			}
			else
			{
				alert("ÃßÃµÀÎÀ» ¿µ¹®ÀÚ(´ë¹®ÀÚ,¼Ò¹®ÀÚ), ¼ýÀÚ·Î ÀÔ·ÂÇØÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
				str.focus();
				str.select();
				return;
			}
		}
	}
	window.open ('recom_member.php?i_user_id='+document.member_write.recom_member.value,'recom_check','toolbar=no,location=no,menubar=no,scrollbars=no,resizable=yes,width=386,height=210')
}

function m_addr(option)
{//È¸¿ø°¡ÀÔ ¹× ¼öÁ¤
	window.open ('address_search.php?mode=' + option,'¿ìÆí¹øÈ£','toolbar=no,location=no,menubar=no,scrollbars=no,resizable=no,width=476,height=265')
}

function openWindow()
{//È¸¿ø°¡ÀÔ ¿ìÆí¹øÈ£ Ã£±â
	window.open ('addr_search.php?cf=c&mode=write','¿ìÆí¹øÈ£','toolbar=no,location=no,menubar=no,scrollbars=no,resizable=no,width=476,height=265')
}

function openWindow_up()
{//È¸¿ø¼öÁ¤ ¿ìÆí¹øÈ£ Ã£±â
	window.open ('addr_search.php?cf=c&mode=update','¿ìÆí¹øÈ£','toolbar=no,location=no,menubar=no,scrollbars=no,resizable=no,width=476,height=265')
}




////////¼±ÅÃ½Ã tr»ö±òº¯ÇÏ°Ô////////
var nSelectFlag = 0;
var bname = navigator.appName; 
var IE = 'Microsoft Internet Explorer';
if (bname==IE)
{
	ie = 1;
} 
else
{
	ie = 0;
} 

function ChangeColor(td)
{ 
    if(td.checked) hL(td); 
    else dL(td); 
} 

function hL(E)
{ 
    if (ie)
	{ 
        while (E.tagName!="TR")
		{
			E = E.parentElement;
		} 
    }
	else
	{ 
        while (E.tagName!="TR")
		{
			E = E.parentNode;
		} 
    } 

    E.className = "H";
} 

function dL(E)
{ 
    if (ie)
	{ 
        while (E.tagName!="TR")
		{
			E = E.parentElement; 
		} 
    }
	else
	{ 
        while (E.tagName!="TR")
		{
			E = E.parentNode;
		} 
    }

    E.className = ""; 
}

//¼¼±Ý°è»ê¼­ Ãâ·Â
function open_tax()
{
//	window.open ('/mypage/tax_print.php','¼¼±Ý°è»ê¼­','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=no,width=380,height=275')
	window.open ('/mypage/main_print.php','¼¼±Ý°è»ê¼­','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=no,width=380,height=400')
}

//½Å¿ëÄ«µå°áÁ¦
function open_card()
{
	window.open ('/mypage/card_pay.php','Ä«µå°áÁ¦','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=no,width=500,height=375')
}

//ÀüÈ­ÁÖ¹®
function open_Torder()
{
	window.open ('/popup/t_order.html','ÀüÈ­ÁÖ¹®','toolbar=no,location=no,menubar=no,scrollbars=no,resizable=no,width=386,height=372')
}

//ÀÔ±ÝÀÚ¸¦ Ã£½À´Ï´Ù
function open_Payment()
{
	window.open ('/payment_search.php','ÀÔ±ÝÀÚ','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=no,width=400,height=500')
}


//¸ÅÀåÀüÃ¼º¸±â
function open_Tshop()
{
	window.open ('/popup/t_shop.html','¸ÅÀåÀüÃ¼º¸±â','toolbar=no,location=no,menubar=no,scrollbars=no,resizable=no,width=726,height=655')
}

//¿Â¶óÀÎ Ä«´Ù·Î±×º¸±â
function open_catalog()
{
	window.open ('/popup/online_catalog.php','¸ÅÀåÀüÃ¼º¸±â','toolbar=no,location=no,menubar=no,scrollbars=no,resizable=no,width=1024,height=718')
}

//¿Â¶óÀÎ Ä«´Ù·Î±×º¸±â
function open_catalog2()
{
	window.open ('/popup/online_catalog3.php','¸ÅÀåÀüÃ¼º¸±â','toolbar=no,location=no,menubar=no,scrollbars=no,resizable=no,width=1150,height=788')
}

//¿Â¶óÀÎ Ä«´Ù·Î±×º¸±â
function open_catalog3()
{
	window.open ('/popup/online_catalog2.php','¸ÅÀåÀüÃ¼º¸±â','toolbar=no,location=no,menubar=no,scrollbars=no,resizable=no,width=1024,height=718')
}

function over_r(obj,num,url)
{
	obj.src = 'http://www.digitalindus.com/' + url + '/img/menu' + num + '-r.gif';
}

function out_r(obj,num,url)
{
	obj.src = 'http://www.digitalindus.com/' + url + '/img/menu' + num + '.gif';
}

function over_r2(obj,num,url)
{
	obj.src = 'http://www.digitalindus.com/' + url + '/img/menu' + num + '-r.gif';
}

function out_r2(obj,num,url)
{
	obj.src = 'http://www.digitalindus.com/' + url + '/img/menu' + num + '.gif';
}

//·¹ÀÌ¾îÃ¢
function layer_view_html(text, w, h, bgcolor, alpha)
{
	var layer	= document.all("layer_view_html");

	w	= parseInt(w);

	if( page_width() < document.body.scrollLeft + event.clientX + 4 + w )
	{
		layer.style.top = document.body.scrollTop + event.clientY + 13;
		layer.style.left = document.body.scrollLeft + event.clientX + 4 - w;
	}
	else
	{
		layer.style.top = document.body.scrollTop + event.clientY + 13;
		layer.style.left = document.body.scrollLeft + event.clientX + 4;
	}

	if(w)				layer.style.width = w;
	if(h)				layer.style.height = h;

	if(bgcolor)		layer.style.background = bgcolor;
	else				layer.style.background = 'ffffff';

	if(alpha)			layer.style.filter = "alpha(opacity="+alpha+")";
	else				layer.style.filter = "alpha(opacity=100)";

	layer.innerHTML = "<p style='font-size:9pt'>"+text+"</p>";
	layer.style.display = "";
}

function layer_none_html()
{
	var layer = document.all("layer_view_html");
	layer.style.display = "none";
}

function page_width()//È­¸é °¡·Î Å©±â
{
  return (navigator.appName.indexOf('Netscape', 0) != -1) ? innerWidth  : document.body.clientWidth;
}

function page_height()//È­¸é ¼¼·Î Å©±â
{
  return (navigator.appName.indexOf('Netscape', 0) != -1) ? innerHeight : document.body.clientHeight;
}