var dedit=false;
function dAdd(){
	bgd.style.display="";
	bgd.style.background="#B3B3B3";
	dreesAdd.style.display="";
	document.dress_add.dressName.focus();
}

function dHidden(){
	bgd.style.display="none";
	dreesAdd.style.display="none";
	document.dress_add.dressName.value="";
}

function DressMoveShow(){
	bgd.style.display="";
	codimove.style.display="";

}

function DressMoveShowAll(){
	make_id();
	if(list_form.did.value == ""){
		alert("ÄÚµð¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä");
		return;
	}
	bgd.style.display="";
	codimove.style.display="";

}

function DressMoveHidden(){
	bgd.style.display="none";
	codimove.style.display="none";

}


function addSc(){
	bgd.style.display="";
	codisc.style.display="";
}

function make_id(){
	var result="";
	var f = document.list_form;
	var formControl;
	for(i = 0;i<f.elements.length;i++){
		formControl = f.elements[i];
		if(formControl.name == "didx" && formControl.checked == true){
			if(result == ""){
				result = formControl.value;
			}else{
				result = result + ";" + formControl.value;
			}
		}
	}
	f.did.value = result;
	
}



function codiDel(){
	var del_confirm = confirm("Á¤¸» »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?")
		if(del_confirm == true) {

			list_form.submit();
		}
}


function codiDelAll(){
	make_id();
	if(list_form.did.value == ""){
		alert("ÄÚµð¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä");
		return;
	}

	var del_confirm = confirm("Á¤¸» »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?")
		if(del_confirm == true) {
			list_form.action = "del_codi.php";
			list_form.submit();
		}
}



function checkCodiMove(){
var f = document.list_form;
var f1 = document.move_codi;

	ds1=f1.drs.options[f1.drs.selectedIndex].value;
	
	ds2=f.ds.value;
	if(ds1 == ds2){
		alert("°°Àº ¿ÊÀåÀ¸·Î´Â ÀÌµ¿ ÇÒ¼ö ¾ø½À´Ï´Ù.");
		return false;
	}

	f1.did.value=f.did.value;

	if(f1.did.value == ""){
		alert("ÀÌµ¿ÇÒ ÄÚµð¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
		return false;
	}

	
}



function hiddenSc(){
	bgd.style.display="none";
	codisc.style.display="none";
}

function addMail(){
	bgd.style.display="";
	codimail.style.display="";
}


function hiddenMail(){
	bgd.style.display="none";
	codimail.style.display="none";
}

function addFav(){
	bgd.style.display="";
	codifav.style.display="";
}


function hiddenFav(){
	bgd.style.display="none";
	codifav.style.display="none";
}


function dressCheck(){
	var f = document.dress_add;
	if((f.dressName.value).trim()==""){
		alert("¿ÊÀå ÀÌ¸§À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		return false;
	}
}

function dressCheck1(){
	var f = document.dress_name_edit;
	if((f.dressName.value).trim()==""){
		alert("¿ÊÀå ÀÌ¸§À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		return false;
	}
}

function dressUp(){
	if(itup == false){
		var f = document.dress_name_edit;
		if((f.idx.value).trim()==""){
			alert("¿ÊÀåÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
			return false;
		}
		f.action="dr_upCate.php"
		f.submit();
		f.action = "dress_name_edit.php";
	}
}

function dressDown(){
	if(itdn == false){
		var f = document.dress_name_edit;
		if((f.idx.value).trim()==""){
			alert("¿ÊÀåÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
			
		}else{
		f.action="dr_downCate.php"
		f.submit();
		f.action = "dress_name_edit.php";
		}
	}
}


function dressDell(){
	var f = document.dress_name_edit;
	if((f.idx.value).trim()==""){
		alert("¿ÊÀåÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
		
	}
	var del_confirm = confirm("¼±ÅÃµÈ ¿ÊÀåÀ» ¿ÏÀü»èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?")
		if(del_confirm == true) {
	f.action="dr_del.php"
	f.submit();
	
	}else{
		
	}


}



function convert_bg(trid){

dress_room_count_tr = dress_room_count.split(",");

for(i = 0 ; i < dress_room_count_tr.length; i++) {

			
			try {
			eval(dress_room_count_tr[i]+".style.background=''")
			}catch(execption){}

		
	}
		eval(trid+".style.background='#E9DBDD'")	
}

 function checkForm() {

        if (checker.validate()) {
		}else{
			return false;
		}
	 }

xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); 
xmlDoc.async=false; 

function updateDress(){
	oid = document.temp_form.dOid.value
	xmlDoc.load("/xmlproc/dress_room.php?oid="+oid);
	DoUpdateDress();
}

function DoUpdateDress(){
	cnt=xmlDoc.getElementsByTagName("item").length; 

	if(cnt !=0){
		var divhtml = '<table width="84" border="0" cellspacing="1" cellpadding="4" bgcolor="CCCCCC">';
		divhtml +='<tr bgcolor="ffffff">';
		divhtml +='<td>';
		divhtml +='<table width="100%" border="0" cellspacing="0" cellpadding="1">';

		var divhtml2 = '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
	    var divhtml3 = '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
		for(i=0;i<cnt;i++){

			idx=xmlDoc.getElementsByTagName("item/@code").item(i).text; 
			dName=xmlDoc.getElementsByTagName("item/@text").item(i).text;
			ct=xmlDoc.getElementsByTagName("item/@ct").item(i).text;
			try{
				if(viewDressContent){
					if(i==0){
						DRN.innerHTML = dName;
						write_form.user_dress.value = idx;
					}
				}
			}catch(e){}


			divhtml += '<tr><td class="d11 t75 pt3" onmouseover="this.style.backgroundColor=\'#eeeeee\'" onmouseout="this.style.backgroundColor=\'\'" style="cursor:hand" onclick="changeDress(this)" idx="'+idx+'" dName="'+dName+'">';
			divhtml += dName+'</td></tr>';

			divhtml2 += '<tr><td class="444444"><a href="/minihome/main.php?oid='+oid+'&ds='+idx+'"><img src="http://www.happycodi.com/img/minihome/icon_img03.gif" width="15" height="13" align="absmiddle" hspace="4" border="0">'+dName+'</a><b class="444444 tahoma s10">&nbsp;('+ct+')</b></td></tr><tr>	<td height="6"></td></tr>';
			endi=i.toString();
			if(ct !="0"){
			divhtml3 += '<tr style="cursor:hand" height=20 id="tr'+idx+'"><td class="444444" onclick="convert_bg(\'tr'+idx+'\');dress_name_edit.dressName.value=this.dname;dress_name_edit.idx.value=this.didx;checkUD(this)"  dum="'+i+'" dname="'+dName+'" didx="'+idx+'"><img src="http://www.happycodi.com/img/minihome/icon_img03.gif" width="15" height="13" align="absmiddle" hspace="4" border="0">'+dName+'</a> <b class="444444 tahoma s10">&nbsp;('+ct+')</b></td></tr><tr>	<td height="1" bgcolor=#EBEBEB></td>	</tr>';
			}else{
			divhtml3 += '<tr style="cursor:hand" height=20 id="tr'+idx+'"><td class="444444" onclick="convert_bg(\'tr'+idx+'\');dress_name_edit.dressName.value=this.dname;dress_name_edit.idx.value=this.didx;checkUD(this)"  dum="'+i+'" dname="'+dName+'" didx="'+idx+'"><img src="http://www.happycodi.com/img/minihome/icon_img03.gif" width="15" height="13" align="absmiddle" hspace="4" border="0">'+dName+'</a></td></tr><tr>	<td height="1" bgcolor=#EBEBEB></td>	</tr>';
			}


		}
		divhtml += '</table></td></tr></table>';
		divhtml2 += '</table>';
		divhtml3 += '</table>';
	
		myDress.innerHTML = divhtml2;
		
		if(dedit==false){
			dHidden();
		}
		try{
			myDressPoP.innerHTML = divhtml3;
			if(viewDressContent){
				viewDressContent.innerHTML = divhtml;
				
				
			}
		}catch(e){}

		
		

	}

}

function changeDress(obj){
	if(write_form.user_dress.value != obj.idx){
		DRN.innerHTML = obj.dName;
		write_form.user_dress.value = obj.idx;

	}
	MM_showHideLayers('viewDress','','hide');

}

function LoginShow(){
	bgd.style.display="";
	bgd.style.background="#B3B3B3";
	login.style.display="";

}

function LoginHide(){
	bgd.style.display="none";
	login.style.display="none";

}

function DressEditShow(){
	bgd.style.display="";
	bgd.style.background="#B3B3B3";
	dressEdit.style.display="";
	dedit=true;


}

function DressEditHide(){
	bgd.style.display="none";
	dressEdit.style.display="none";
	dedit=false;

}

function checkUD(obj){
	var str = obj.dum;
	if(str=="0"){
				itup=true;
		dress_name_edit.dup.src="http://www.happycodi.com/img/minihome/bt_up_blank.gif";

	}else{
				itup=false;
		dress_name_edit.dup.src="http://www.happycodi.com/img/minihome/bt_up.gif";

	}

	if(str==endi){
				itdn=true;
		dress_name_edit.ddn.src="http://www.happycodi.com/img/minihome/bt_down_blank.gif";

	}else{
		itdn=false;
		dress_name_edit.ddn.src="http://www.happycodi.com/img/minihome/bt_down.gif";
		
	}

}