function userLogin() {
	$fn('unc-cash','userId').value = $('unc-login-user').value;
	$fn('unc-cash','userPw').value = $('unc-login-pw').value;
	Web.submit('unc-cash', {method:'post',action:'login-process.do'});
}

function login_focus() {
	Web.Form.setStyle('unc-unit');
	Web.Element.setClass('span','unc-fnt-out', 'unc-fnt-over');
	$('unc-login-user').focus();
}

function member_list_init() {
	Web.Form.setStyle('unc-unit');
	if ($('unc-member-category-list')) {
		Unc.tag.select.apply('unc-member-category-list',80,22);
	}	
}

function member_init() {
	Web.Form.setStyle('unc-unit');
	Web.Form.loadForm('unc-cash');
	
	if (Web.Form.hash['userReg_no'] == 'Y') {
		$('unc-member-regno').style.display = 'inline';	
	}
	if (Web.Form.hash['userName'] == 'Y') {
		$('unc-member-name').style.display = 'inline';	
	}
	if (Web.Form.hash['userIcon'] == 'Y') {
		$('unc-member-icon').style.display = 'inline';	
	}
	if (Web.Form.hash['userPhoto'] == 'Y') {
		$('unc-member-photo').style.display = 'inline';	
	}
	if (Web.Form.hash['userZip_cd'] == 'Y') {
		$('unc-member-zipcd').style.display = 'inline';	
	}
	if (Web.Form.hash['userAddress'] == 'Y') {
		$('unc-member-address').style.display = 'inline';	
	}
	if (Web.Form.hash['userBirth_dt'] == 'Y') {
		$('unc-member-birth').style.display = 'inline';	
	}
	if (Web.Form.hash['userWedding_dt'] == 'Y') {
		$('unc-member-wedding').style.display = 'inline';	
	}
	if (Web.Form.hash['userTel'] == 'Y') {
		$('unc-member-tel').style.display = 'inline';	
	}
	if (Web.Form.hash['userHp'] == 'Y') {
		$('unc-member-hp').style.display = 'inline';	
	}
	if (Web.Form.hash['userComment'] == 'Y') {
		$('unc-member-comment').style.display = 'inline';	
	}
	if (Web.Form.hash['userHomepage'] == 'Y') {
		$('unc-member-home').style.display = 'inline';	
	}
	if (Web.Form.hash['userHobby'] == 'Y') {
		$('unc-member-hobby').style.display = 'inline';	
	}
	if (Web.Form.hash['userEmail_yn'] == 'N') {
		$n('userEmail_yn')[1].checked = true;
	}
	else {
		$n('userEmail_yn')[0].checked = true;
	}
	if (Web.Form.hash['userPublic_cd'] == 'A') {
		$n('userPublic_cd')[0].checked = true;
	}
	else if (Web.Form.hash['userPublic_cd'] == 'B') {
		$n('userPublic_cd')[1].checked = true;
	}
	else if (Web.Form.hash['userPublic_cd'] == 'C') {
		$n('userPublic_cd')[2].checked = true;
	}
	else if (Web.Form.hash['userPublic_cd'] == 'D') {
		$n('userPublic_cd')[3].checked = true;
	}
	if (Web.Form.hash['userHobby'] != 'N') {
		var val = $fn('unc-cash','serialUserHobby').value.split(",");
		var obj = $n('hobby');
		for (var i = 0; i < obj.length; i++) {
			for (var k = 0; k < val.length; k++) {
				if (obj[i].value == val[k])
					obj[i].checked = true;
			}
		}
	}
	if ($('unc-alice')) {
		Unc.alice.hash['alice'] = Web.EditorManager.instance("unc-alice",{width:565,height:350,type:'normal'});
	}
}

function ableToId() {
	if (!Web.Form.validateValue($fn('unc-unit','userId'))) return;
	if (!Web.Form.validateAlphaNum($fn('unc-unit','userId'))) return;
	if (!Web.Form.validateMaxByte($fn('unc-unit','userId'))) return;
	if (!Web.Form.validateMinByte($fn('unc-unit','userId'))) return;
	Web.Ajax.invoke({action:'ajax-member-id.do',params:'userId='+$fn('unc-unit','userId').value+'&command=ABLETOID',handler:'messageParsing'});

}

function ableToNick() {
	if (Web.Form.validateValue($fn('unc-unit','userNick'))) {
		Web.Ajax.invoke({action:'ajax-member-nick.do',params:'userNick='+$fn('unc-unit','userNick').value+'&command=ABLETONICK',handler:'messageParsing'});
	}
}

function ableToEmail() {
	if (Web.Form.validateEmail($fn('unc-unit','userEmail'))) {
		Web.Ajax.invoke({action:'ajax-member-email.do',params:'userEmail='+$fn('unc-unit','userEmail').value+'&command=ABLETOEMAIL',handler:'messageParsing'});
	}
}

function setPostcd(zip,addr) {
	$fn('unc-unit','userZip1_cd').value = zip.substring(0,3);
	$fn('unc-unit','userZip2_cd').value = zip.substring(4,7);
	$fn('unc-unit','userAddress').value = addr;	
}

function fileSend(id, mode, subid){
	if (Web.Form.validateValue(id) &&
		Web.Form.validateFile(id, "gif","jpg","jpeg","pnp")) {
		$fn('unc-unit','mode').value = mode;
		$fn('unc-unit','subId').value = subid;
		Web.submit('unc-unit',{method:'post',target:'_hidden',action:'uploadManager',encoding:'multipart/form-data',resubmit:'Y'});
	}
}

function pasteImage(icon) {	
	$fn('unc-unit','userIcon').value = icon;
	$('unc-member-icon-view').style.display = 'inline';
	$('unc-user-icon').src = './'+Web.Form.hash['htmlImage']+'/icon/'+icon.substring(0,8)+'/'+icon;
}

function pastePhoto(photo) {
	$fn('unc-unit','userPhoto').value = photo;
	$('unc-member-photo-view').style.display = 'block';
	$('unc-user-photo').src = './'+Web.Form.hash['htmlImage']+'/photo/'+photo.substring(0,8)+'/'+photo;
}

function showMemberType(id) {
	$('unc-information').style.display = 'none';
	$('unc-password').style.display = 'none';
	$('unc-drop').style.display = 'none';
	$(id).style.display = 'inline';
	if (id == 'unc-information') {
		$fn('unc-unit','userPw').focus();
	}
	else if (id == 'unc-password') {
		$fn('unc-unit','currentPw').focus();
	}
	else if (id == 'unc-drop') {
		$fn('unc-unit','yourPw').focus();
	}
}

function memberPassword() {
	if (!Web.Form.validateValue($fn('unc-unit','currentPw'))) return;
	if (!Web.Form.validateValue($fn('unc-unit','newPw'))) return;
	if (!Web.Form.validateAlphaNum($fn('unc-unit','newPw'))) return;
	if (!Web.Form.validateMaxByte($fn('unc-unit','newPw'))) return;
	if (!Web.Form.validateMinByte($fn('unc-unit','newPw'))) return;
	
	if ($fn('unc-unit','newPw').value != $fn('unc-unit','newPw_confirm').value) {
		Web.alert({title:'°æ°í',msg:'ÀÔ·ÂÇÑ »õºñ¹Ð¹øÈ£¿Í ºñ¹Ð¹øÈ£ È®ÀÎ°ªÀÌ Æ²¸³³ª´Ù',focus:$fn('unc-unit','newPw')});
		return;
	}
	$fn('unc-unit','command').value = "PASSWORD";
	Web.confirm({title:'È®ÀÎ',msg:'Á¤¸» ºñ¹Ð¹øÈ£¸¦ º¯°æ ÇÏ½Ã°Ú½À´Ï±î?',fnok:function() {
		Web.submit('unc-unit',{method:'post',action:'member-join-process.do',target:'_self'});
	}});
}

function memberDrop() {
	if (!Web.Form.validateValue($fn('unc-unit','yourPw'))) return;
	$fn('unc-unit','command').value = "DELETE";
	Web.confirm({title:'È®ÀÎ',msg:'Á¤¸» Å»È¸ ÇÏ½Ã°Ú½À´Ï±î?',fnok:function() {
		Web.submit('unc-unit',{method:'post',action:'member-join-process.do',target:'_self'});
	}});
}

function memberSave() {		
	if (!eval(Web.Form.hash['login'])) {
		if (!Web.Form.validateValue($fn('unc-unit','userId'))) return;
		if (!Web.Form.validateAlphaNum($fn('unc-unit','userId'))) return;
		if (!Web.Form.validateMaxByte($fn('unc-unit','userId'))) return;
		if (!Web.Form.validateMinByte($fn('unc-unit','userId'))) return;
		if ($fn('unc-unit','userPw').value != $fn('unc-unit','userPw_confirm').value) {
			Web.alert({title:'°æ°í',msg:'ºñ¹Ð¹øÈ£¿Í ºñ¹Ð¹øÈ£È®ÀÎ °ªÀÌ Æ²¸³´Ï´Ù'});
			return;	
		}
		$fn('unc-unit','command').value = "NEW";
	} 
	else {
		$fn('unc-unit','command').value = "UPDATE";
	}
	
	$fn('unc-unit','userReg_no').value = '';
	$fn('unc-unit','userZip_cd').value = '';
	$fn('unc-unit','userBirth_dt').value = '';
	$fn('unc-unit','userWedding_dt').value = '';
	$fn('unc-unit','userHobby').value = '';
	
	if (!Web.Form.validateValue($fn('unc-unit','userPw'))) return;
	if (!Web.Form.validateAlphaNum($fn('unc-unit','userPw'))) return;
	if (!Web.Form.validateMaxByte($fn('unc-unit','userPw'))) return;
	if (!Web.Form.validateMinByte($fn('unc-unit','userPw'))) return;

	if (!Web.Form.validateValue($fn('unc-unit','userNick'))) return;
	if (!Web.Form.validateValue($fn('unc-unit','userPw_question'))) return;
	if (!Web.Form.validateValue($fn('unc-unit','userPw_answer'))) return;
	if (!Web.Form.validateValue($fn('unc-unit','userEmail'))) return;

	if (Web.Form.hash['userReg_no'] == 'Y') {
		if (!Web.Form.validateValue($fn('unc-unit','userReg1_no'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userReg2_no'))) return;
	}
	if (Web.Form.hash['userName'] == 'Y') {
		if (!Web.Form.validateValue($fn('unc-unit','userName'))) return;
	}
	if (Web.Form.hash['userIcon'] == 'Y') {
		if (!Web.Form.validateValue($fn('unc-unit','userIcon'),'¾ÆÀÌÄÜ¿¡')) return;
	}
	if (Web.Form.hash['userPhoto'] == 'Y') {
		if (!Web.Form.validateValue($fn('unc-unit','userPhoto'),'»çÁø¿¡')) return;
	}
	if (Web.Form.hash['userZip_cd'] == 'Y') {
		if (!Web.Form.validateValue($fn('unc-unit','userZip1_cd'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userZip2_cd'))) return;
	}
	if (Web.Form.hash['userAddress'] == 'Y') {
		if (!Web.Form.validateValue($fn('unc-unit','userAddress'))) return;
	}
	if (Web.Form.hash['userBirth_dt'] == 'Y') {
		if (!Web.Form.validateValue($fn('unc-unit','userBirth1_dt'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userBirth2_dt'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userBirth3_dt'))) return;
	}
	if (Web.Form.hash['userWedding_dt'] == 'Y') {
		if (!Web.Form.validateValue($fn('unc-unit','userWedding1_dt'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userWedding2_dt'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userWedding3_dt'))) return;
	}
	if (Web.Form.hash['userTel'] == 'Y') {
		if (!Web.Form.validateValue($fn('unc-unit','userTel1'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userTel2'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userTel3'))) return;
	}
	if (Web.Form.hash['userHp'] == 'Y') {
		if (!Web.Form.validateValue($fn('unc-unit','userHp1'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userHp2'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userHp3'))) return;
	}
	if (Web.Form.hash['userHomepage'] == 'Y') {
		if (!Web.Form.validateValue($fn('unc-unit','userHomepage'))) return;
	}	
	
	if (Web.Form.hash['userComment'] != 'N') {
		var ct = Unc.alice.hash['alice'].getContent(true);
		if (Unc.alice.hash['alice'].isLimit()) {
			Web.alert({title:'°æ°í', msg:'Àâ´ãÀ» ³Ê¹« ¸¹ÀÌ ÀÛ¼ºÇÏ¼Ì½À´Ï´Ù<br>ÃÖ´ë Àâ´ã ÀÛ¼º°¡´É ±ÛÀÚ¼ö´Â <b>'+Unc.alice.hash['alice'].limit+'</b>¹ÙÀÌÆ® ÀÔ´Ï´Ù<br>ÇöÀç ÀÛ¼º ±ÛÀÚ¼ö´Â <b>'+ct.getByte()+'</b>¹ÙÀÌÆ® ÀÔ´Ï´Ù',width:400});
			return;
		}
		
		if (Web.Form.hash['userComment'] == 'Y' && (ct.empty() || ct == '<br>')) {
			Web.alert({title:'ÁÖÀÇ',msg:'Àâ´ãÀ» ÀÔ·ÂÇÏ¼¼¿ä'});			
			return;
		}
		$fn('unc-unit','userComment').value = ct;
	}
	
	if (!$n('userPublic_cd')[0].checked && !$n('userPublic_cd')[1].checked && !$n('userPublic_cd')[2].checked && !$n('userPublic_cd')[3].checked) {
		Web.alert({title:'°æ°í',msg:'Á¤º¸°ø°³Áß ÃÖ¼ÒÇÑ ÇÏ³ª¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä'});
		return;
	}

	if (Web.Form.hash['userReg_no'] != 'N' && (!$fn('unc-unit','userReg1_no').value.empty() || !$fn('unc-unit','userReg2_no').value.empty())) {
		if (!Web.Form.validateRegno($fn('unc-unit','userReg1_no'), $fn('unc-unit','userReg2_no'))) return;
	}
	if (Web.Form.hash['userZip_cd'] != 'N' && (!$fn('unc-unit','userZip1_cd').value.empty() || !$fn('unc-unit','userZip2_cd').value.empty())) {
		if (!Web.Form.validateValue($fn('unc-unit','userZip1_cd'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userZip2_cd'))) return;
		if (!Web.Form.validateNum($fn('unc-unit','userZip1_cd'))) return;
		if (!Web.Form.validateNum($fn('unc-unit','userZip2_cd'))) return;
	}
	if (Web.Form.hash['userBirth_dt'] != 'N' && 
		(!$fn('unc-unit','userBirth1_dt').value.empty() || !$fn('unc-unit','userBirth2_dt').value.empty() || !$fn('unc-unit','userBirth3_dt').value.empty())) {
		if (!Web.Form.validateValue($fn('unc-unit','userBirth1_dt'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userBirth2_dt'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userBirth3_dt'))) return;
		if (!Web.Form.validateNum($fn('unc-unit','userBirth1_dt'))) return;
		if (!Web.Form.validateNum($fn('unc-unit','userBirth2_dt'))) return;
		if (!Web.Form.validateNum($fn('unc-unit','userBirth3_dt'))) return;
	}
	if (Web.Form.hash['userWedding_dt'] != 'N' && 
		(!$fn('unc-unit','userWedding1_dt').value.empty() || !$fn('unc-unit','userWedding2_dt').value.empty() || !$fn('unc-unit','userWedding3_dt').value.empty())) {
		if (!Web.Form.validateValue($fn('unc-unit','userWedding1_dt'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userWedding2_dt'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userWedding3_dt'))) return;
		if (!Web.Form.validateNum($fn('unc-unit','userWedding1_dt'))) return;
		if (!Web.Form.validateNum($fn('unc-unit','userWedding2_dt'))) return;
		if (!Web.Form.validateNum($fn('unc-unit','userWedding3_dt'))) return;
	}
	if (Web.Form.hash['userTel'] != 'N' &&
		(!$fn('unc-unit','userTel1').value.empty() || !$fn('unc-unit','userTel2').value.empty() || !$fn('unc-unit','userTel3').value.empty())) {
		if (!Web.Form.validateValue($fn('unc-unit','userTel1'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userTel2'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userTel3'))) return;
		if (!Web.Form.validateNum($fn('unc-unit','userTel1'))) return;
		if (!Web.Form.validateNum($fn('unc-unit','userTel2'))) return;
		if (!Web.Form.validateNum($fn('unc-unit','userTel3'))) return;
	}
	if (Web.Form.hash['userHp'] != 'N' &&
		(!$fn('unc-unit','userHp1').value.empty() || !$fn('unc-unit','userHp2').value.empty() || !$fn('unc-unit','userHp3').value.empty())) {
		if (!Web.Form.validateValue($fn('unc-unit','userHp1'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userHp2'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userHp3'))) return;
		if (!Web.Form.validateNum($fn('unc-unit','userHp1'))) return;
		if (!Web.Form.validateNum($fn('unc-unit','userHp2'))) return;
		if (!Web.Form.validateNum($fn('unc-unit','userHp3'))) return;
	}
	
	if (Web.Form.hash['userEmail'] != 'N' && $fn('unc-unit','userEmail').value.empty()) {
		if (!Web.Form.validateEmail($fn('unc-unit','userEmail'))) return;	
	}
	if (Web.Form.hash['userReg_no'] != 'N' && !$fn('unc-unit','userReg1_no').value.empty() && !$fn('unc-unit','userReg1_no').value.empty()) {
		$fn('unc-unit','userReg_no').value = $fn('unc-unit','userReg1_no').value.toString()+$fn('unc-unit','userReg2_no').value.toString();
	}
	if (Web.Form.hash['userZip_cd'] != 'N' && !$fn('unc-unit','userZip1_cd').value.empty() && !$fn('unc-unit','userZip2_cd').value.empty()) {
		$fn('unc-unit','userZip_cd').value = $fn('unc-unit','userZip1_cd').value.toString()+$fn('unc-unit','userZip2_cd').value.toString();
	}
	if (Web.Form.hash['userBirth_dt'] != 'N' && !$fn('unc-unit','userBirth1_dt').value.empty() && !$fn('unc-unit','userBirth2_dt').value.empty() && !$fn('unc-unit','userBirth3_dt').value.empty()) {
		$fn('unc-unit','userBirth_dt').value = $fn('unc-unit','userBirth1_dt').value.toString()+$fn('unc-unit','userBirth2_dt').value.toString()+$fn('unc-unit','userBirth3_dt').value.toString();
	}
	if (Web.Form.hash['userWedding_dt'] != 'N' && !$fn('unc-unit','userWedding1_dt').value.empty() && !$fn('unc-unit','userWedding2_dt').value.empty() && !$fn('unc-unit','userWedding3_dt').value.empty()) {
		$fn('unc-unit','userWedding_dt').value = $fn('unc-unit','userWedding1_dt').value.toString()+$fn('unc-unit','userWedding2_dt').value.toString()+$fn('unc-unit','userWedding3_dt').value.toString();
	}
	
	if (Web.Form.hash['userHobby'] != 'N') {
		var hobbySelected = '';
		var objs = $('unc-unit');
		for (var i = 0; i < objs.elements.length; i++) {
			if (objs.elements[i].name == 'hobby' &&
				objs.elements[i].checked) {
				hobbySelected += objs.elements[i].value+',';
			}
		}
		if (Web.Form.hash['userHobby'] == 'Y' && hobbySelected == '') {
			Web.alert({title:'°æ°í',msg:'Ãë¹Ì¸¦ ÃÖ¼Ò ÇÏ³ªÀÌ»ó ¼±ÅÃÇØ ÁÖ¼¼¿ä'});
			return;
		}
		$fn('unc-unit','userHobby').value = hobbySelected;
	}

	Web.submit('unc-unit',{method:'post',action:'member-join-process.do',target:'_self',encoding:'application/x-www-form-urlencoded'});
}

function userFound_init() {
	Web.Form.setStyle('unc-unit');
	Web.Element.setClass('span','unc-fnt-out', 'unc-fnt-over');
	$fn('unc-unit','userNick').focus();	
}

function userPasswordFound_init() {
	Web.Form.setStyle('unc-unit');
	Web.Element.setClass('span','unc-fnt-out', 'unc-fnt-over');
	if ($('unc-login-id')) {
		$('unc-login-id').focus();
	}
	if ($('unc-login-answer')) {
		$('unc-login-answer').focus();
	}
}

function userFound() {
	userStep('step3');
}

function userPasswordFound() {
	userStep('step1');
}

function userPasswordHintFound() {
	userStep('step2');
}

function userStep(fg) {
	if (fg == 'step1') {
		if (!Web.Form.validateValue($fn('unc-unit','userId'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userEmail'))) return;
	} 
	else if (fg == 'step2') {
		if (!Web.Form.validateValue($fn('unc-unit','userPw_answer'))) return;
	} 
	else if (fg == 'step3') {
		if (!Web.Form.validateValue($fn('unc-unit','userNick'))) return;
		if (!Web.Form.validateValue($fn('unc-unit','userEmail'))) return;
	} 
	else if (fg == 'back') {
		back();
		return;
	}
	Web.submit('unc-unit',{method:'post'});
}

function memberSearch() {
	if (Web.Form.validateValue($fn('unc-unit','searchKey'))) {
		Web.submit('unc-unit',{method:'post'});	
	}
}

function viewMyMessage(addr) {
	Web.Window.popup(addr,{width:450,height:500});
}

function viewCharacter(uid, e) {
	Unc.user.loading(uid, e);
}

function writeMessage(uid) {
	Web.Window.popup('message-edit.do?receiveUserId='+uid, {width:450,height:500});
}

function viewUserArticle(uid) {
	var div = null;
	if ($("unc-user-search")) {
		div = $("unc-user-search");
	}
	else {
		div = document.createElement("div");
		div.setAttribute("id", "unc-user-search");
		document.body.appendChild(div);	
	}
		
	div.innerHTML = ""+
			"<form name=unc-temp-form>"+
				"<input type=hidden name=command value='SUMMARY'>"+
				"<input type=hidden name=searchType value='I MI'>"+
				"<input type=hidden name=thumbnailSize value=50>"+
				"<input type=hidden name=pageScale value=50>"+
				"<input type=hidden name=page value=1>"+
				"<input type=hidden name=searchOrKey value='"+uid+"'>"+
			"</form>";
		
	Web.submit('unc-temp-form',{method:'post',action:'search.do'});
}

