///////////////////////////////////////////////////////////
// »çÀÌÆ® ±â´É°ü·Ã
function goSrch(frm)
{
    var menuIndex = 0;
    with(frm){
        if(qt.value == ""){
            alert("°Ë»öÇÒ Å°¿öµå¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
			qt.focus();
            return false;
        }else{
			if(frm.qt.value!=''){
				frm.pre_qt.value=document.searchForm.qt.value;
			}
            return true;
        }
    }
}

function fSearch(ff)
{
	if (ff.KeyWd.value == '')
	{
		alert('°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä');
		return false;
	}
	return true;
}

function logout() {
	document.location = "/member/login_post.html?MD=LOGOUT";
}
function LoginNow()
{
	alert('·Î±×ÀÎ ÈÄ »ç¿ëÀÌ °¡´ÉÇÕ´Ï´Ù.');
	location.href='/member/register1.html?RETURL='+escape(location.href);
}
function popup(url,w,h){
	window.open(url,'','width='+w+',height='+h+',resizable=0,scrollbars=1');
}

function popup2(url,w,h){
	window.open(url,'','width='+w+',height='+h+',resizable=0,scrollbars=0');
}
function chargeCash()
{
	var pop = window.open("/pay/","pay","width=600,height=690,toolbar=no");
	pop.focus();
}
function goCart(){
	document.location.href = "/mypage/cartview.html";
}

function goUrl(url){
	document.location.href = url;
}

function chk_text(sel, msg) {
	if(!sel.value){
		window.alert(msg);
		sel.focus();
		return false;
	}else{
		return true;
	}
}
function chk_text_length(sel, len, msg) {
	if(sel.value.length > len){
		window.alert(msg);
		sel.focus();
		return false;
	}else{
		return true;
	}
}
function chk_select(sel, msg) {
	if(sel.selectedIndex==0){
		window.alert(msg);
		sel.focus();
		return false;
	}else{
		return true;
	}
}
function chk_radio(sel, cnt, msg) {
	if(cnt > 1){
		var n=0;
		for(i=0; i<cnt; i++){
			if(sel[i].checked){
				n++;
			}
		}
		if(n==0){
			window.alert(msg);
			sel[0].focus();
			return false;
		}else{
			return true;
		}
	} else {
		if(sel.checked) return true;
		else alert(msg);
	}
}

// ¼ýÀÚ¸¸ ¹ÞÀ½
function num_only(){
	if((event.keyCode<48) || (event.keyCode>57)){
		event.returnValue=false;
	}
}

function Ltrim(strValue){
    while (strValue.length>0){
       if(strValue.charAt(0)==' '){
           strValue=strValue.substring(1,strValue.length);
   }
       else
          return strValue;
    }
return strValue;
}
function Rtrim(strValue){
    while (strValue.length>0){
       if(strValue.charAt(strValue.length-1)==' '){
           strValue=strValue.substring(0,strValue.length-1);
   }
       else
           return strValue;
   }
   return strValue;
}
function Trim(strValue){
   strValue = Ltrim(strValue);
   strValue = Rtrim(strValue);
   return strValue;
}

function str_replace(szFind, szReplace, szAll) {
	var i;
	var length;

	length = szReplace.length - szFind.length;

	for (i=0; i < szAll.length; i++) {
		if (szAll.substr(i,szFind.length) == szFind) {
			if ( i > 0 ) {
				if (szFind == "\n") {
					szAll = szAll.substr(0, i-1) + szReplace + szAll.substr(i+szFind.length,szAll.length - (i+szFind.length));
				} else {
					szAll = szAll.substr(0, i) + szReplace + szAll.substr(i+szFind.length,szAll.length - (i+szFind.length));
				}
			} else {
				szAll = szReplace + szAll.substr(i+szFind.length,szAll.length - (i+szFind.length));
			}
			i = i + length;
		}
	}
	return szAll;
}

function number_format(num)
{
	var str=''+num;
	var len=str.length;
	var no =len/3;
	var remain=len%3;
	var rv='';
	var str1='';
	var blank=0;
	var Bstr='                                   ';

	for (var i=1;i<=no;i++)
	{
		rv=str.substring(len-i*3,len-(i*3)+3)+rv;
		if (i!=no ) rv=','+rv;
	}
	if (remain) rv=str.substring(0,remain)+rv;


	if (navigator.appName=="Microsoft Internet Explorer")
	{
		rv=Bstr.substring(0,14-rv.length)+rv;
	}
	else
	{
		rv=Bstr.substring(0,14-rv.length)+rv;
	}
	return rv;
}
// ÄíÅ°
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 setCookie(name, value){
	var argv = setCookie.arguments;
	var argc = setCookie.arguments.length;
	var expires = (2 < argc) ? argv[2] : null;
	var path = (3 < argc) ? argv[3] : null;
	var domain = (4 < argc) ? argv[4] : null;
	var secure = (5 < argc) ? argv[5] : false;

	document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : "");
}
function setCookieToday(name,value,expiredays) 
{
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

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

function roundTable(objID) {
       var obj = document.getElementById(objID);
       var Parent, objTmp, Table, TBody, TR, TD;
       var bdcolor, bgcolor, Space;
       var trIDX, tdIDX, MAX;
       var styleWidth, styleHeight;

       // get parent node
       Parent = obj.parentNode;
       objTmp = document.createElement('SPAN');
       Parent.insertBefore(objTmp, obj);
       Parent.removeChild(obj);

       // get attribute
       bdcolor = obj.getAttribute('rborder');
       bgcolor = obj.getAttribute('rbgcolor');
       radius = parseInt(obj.getAttribute('radius'));
       if (radius == null || radius < 1) radius = 1;
       else if (radius > 6) radius = 6;

       MAX = radius * 2 + 1;
       
       /*
              create table {{
       */
       Table = document.createElement('TABLE');
       TBody = document.createElement('TBODY');

       Table.cellSpacing = 0;
       Table.cellPadding = 0;

       for (trIDX=0; trIDX < MAX; trIDX++) {
              TR = document.createElement('TR');
              Space = Math.abs(trIDX - parseInt(radius));
              for (tdIDX=0; tdIDX < MAX; tdIDX++) {
                     TD = document.createElement('TD');
                     
                     styleWidth = '1px'; styleHeight = '1px';
                     if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null;
                     else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null;
                     else if (radius > 2) {
                            if (Math.abs(tdIDX - radius) == 1) styleWidth = '2px';
                            if (Math.abs(trIDX - radius) == 1) styleHeight = '2px';
                     }

                     if (styleWidth != null) TD.style.width = styleWidth;
                     if (styleHeight != null) TD.style.height = styleHeight;

                     if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = bdcolor;
                     else if (tdIDX > Space && Space < MAX - tdIDX - 1) TD.style.backgroundColor = bgcolor;
                     
                     if (Space == 0 && tdIDX == radius) TD.appendChild(obj);
                     TR.appendChild(TD);
              }
              TBody.appendChild(TR);
       }

       /*
              }}
       */

       Table.appendChild(TBody);
       
       // insert table and remove original table
       Parent.insertBefore(Table, objTmp);
}
//ÇÃ·¡½Ã °ü·Ã ½ºÅ©¸³Æ® ÇÔ¼ö 2009-10-27 Ãß°¡
function printObject(data)
{
	document.write (data);
}

function printFlash(src, width, height)
{
	if(!src || !width || !height)
	{
		return null;
	}

	var classid  = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000";
	var codebase = "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0";
	var wmode    = "transparent";
	var quality  = "high";
	var plugin   = "http://www.macromedia.com/go/getflashplayer";
	var type     = "application/x-shockwave-flash";

	var html = "<object id='asadalflash' classid='" + classid + "' "
			 + "codebase='" + codebase + "' "
			 + "width='" + width + "' height='" + height + "'> "
			 + "<param name='wmode' value='" + wmode + "'>"
			 + "<param name='movie' value='" + src + "'>"
			 + "<param name='quality' value='" + quality + "'>"
			 + "<embed src='" + src + "' "
			 + "quality='" + quality + "' pluginspage='" + plugin + "' type='" + type + "' "
			 + "width='" + width + "' height='" + height + "'></embed></object>";

	printObject(html);
}
