//JavaScriptÀÇ Trim ÇÔ¼ö

/*
* ÀÔ·Â°ªÀÌ NULLÀÎÁö Ã¼Å©
*/
function isNull(input) {		
    if (input.value == null || trim(input.value) == "") {
        return true;
    }
    return false;
}

//ÁÖ¹Î¹øÈ£ Ã¼Å©
function JuminCheck(jumin1,jumin2)			
{
   var ju = jumin1 + jumin2;
   if (ju.search(/^[1234567890]\d{0,12}/) == - 1 )
   {  
     return false;
   }

   if( ju.charAt(6) == 1 || ju.charAt(6) == 2 ){
      if( ju.charAt(12) == 
         (( 11 - ((ju.charAt(0)*2+ju.charAt(1)*3+ju.charAt(2)*4
                   +ju.charAt(3)*5+ju.charAt(4)*6+ju.charAt(5)*7
                   +ju.charAt(6)*8+ju.charAt(7)*9+ju.charAt(8)*2
                   +ju.charAt(9)*3+ju.charAt(10)*4+ju.charAt(11)*5)
                  % 11)))%10){
      return true; 
      }else{
      return false; 
      } 
   }
}

function trim(strValue)
{
	var ReturnValue = "";

	if( strValue == "" )
		return "";

	for(i=0;i<strValue.length;i++)
	{
       if(strValue.charAt(i) != " ")
		ReturnValue = ReturnValue + strValue.charAt(i);
	}
	return ReturnValue;
}

function commaSplit(srcNumber) 
{ 
	var txtNumber = '' + srcNumber; 

	var rxSplit = new RegExp('([0-9])([0-9][0-9][0-9][,.])'); 
	var arrNumber = txtNumber.split('.'); 
	arrNumber[0] += '.'; 
	do { 
		arrNumber[0] = arrNumber[0].replace(rxSplit, '$1,$2'); 
	} 
	while (rxSplit.test(arrNumber[0])); 
	if (arrNumber.length > 1) { 
		return arrNumber.join(''); 
	} 
	else { 
		return arrNumber[0].split('.')[0]; 
	} 
}

function on_good_view(g_id,c_id,skin){
	document.location.href = "shop.asp?mode=view&skin=" + skin + "&c_id=" + c_id + "&g_id=" + g_id;
}

function on_order_amount_increase(order_amount)
{
   var OrderAmount;
   if( order_amount.value=="" )
	  OrderAmount=0;
   else
	  OrderAmount=parseInt(order_amount.value);
   OrderAmount++;
   order_amount.value=""+OrderAmount;
}

function on_order_amount_decrease(order_amount)
{
   var OrderAmount;
   if( order_amount.value=="" )
	  OrderAmount=0;
   else
	  OrderAmount=parseInt(order_amount.value);
   OrderAmount--;
   if( OrderAmount<1 ) OrderAmount=1;
   order_amount.value=""+OrderAmount;
}

function filterNum(str) 
{ 
	re = /^\$|,/g; 
	return str.replace(re, ""); 
}


function auth_login_check(m_id,login_icon,logout_icon){
	if(m_id == ""){
		document.write("<a href=\"/member.asp?mode=login&skin=login\">" + login_icon + "</a>");
	}else{
		document.write("<a href=\"/module/login_act.asp?mode=logout\">" + logout_icon + "</a>");
	}
}

function auth_order_check(m_id,order_icon){
	if(m_id == ""){
		document.write("<a href=\"/mypage.asp?mode=order_nomember\" onfocus=\"blur();\">" + order_icon + "</a>");
	}else{
		document.write("<a href=\"/mypage.asp?mode=order_list\" onfocus=\"blur();\">" + order_icon + "</a>");
	}
}
                
function auth_member_check(m_id,join_icon,edit_icon){
	if(m_id == ""){
		document.write("<a href=\"/member.asp?mode=join\">" + join_icon + "</a>");
	}else{
		document.write("<a href=\"/member.asp?mode=edit\">" + edit_icon + "</a>");
	}
}


function error_location(url){
	if(url == "close"){
		window.close();
	}else if(url == "back"){
		history.back();
	}else if(url != ""){
		location.href = url;
	}else{
		history.back();
	}
}

function no_count_print(msg,count){
   if( count == 0 )
   {
	  document.write("      <tr height=120 valign=middle>\n");
	  document.write("         <td align=center >" + msg + "</td>\n");
	  document.write("      </tr>\n");
   }
}

function no_count_print1(msg,count,colspan){
   if( count == 0 )
   {
	 
	  document.write("      <tr height=120 valign=middle>\n");
	  document.write("         <td align=center colspan='" + colspan + "' bgcolor='white'>" + msg + "</td>\n");
	  document.write("      </tr>\n");
	  
   }
}
function window_open(url,width,height){
  var win_top = window.open(url,"win_top","width=" + width + ",height=" + height + ",top=50,left=50");
}

function href_convert(loca_href){
	var re = /&/g;
	var re_to = /\w+:\/\/[a-z0-9\_\-\.~@?=%&:\-]+/;
	loca_href = loca_href.replace(re,"%26");
	loca_href = loca_href.replace(re_to,"");

	return loca_href;
}
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_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_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_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];}
}

