/*
	2008-01-25 9:55¿ÀÀü
	jjuya
	ÀÌº¥Æ® form Ã¼Å© (°øÅë)
*/

// private constant

var LOGIN_URL	=	"/dydbdydn_kj/customer/customer_user_01.asp?go_url=";
var RE_GO_URL	=	"http://www.onmoviestyle.com/event/event_now_view.asp?oe_seq=";
var T_RE_GO_URL	=	LOGIN_URL + RE_GO_URL;

/*	multi radio check	*/

// fNm	 	: 	Æû ÀÌ¸§
// timeth	:	È¸Â÷
// rdoLen	:	¶óµð¿ÀÆû ¼ö
// uid		:	¾ÆÀÌµð
// evnetCode:	ÀÌº¥Æ®¹øÈ£

function MultiChkRdoForm(fNm,timeth,rdoNm,rdoLen,uid,evnetCode){
	if (uid==""){
	  	alert("·Î±×ÀÎ ÈÄ ÀÀ¸ðÇØÁÖ¼¼¿ä.");
		parent.location.href = T_RE_GO_URL + evnetCode;
		return false;
	}
			
	var rdo_name = rdoNm + "_" + timeth + "_";		
	
	for (var i = 1 ; i <= rdoLen; i++ ) {
		var CheckValue = eval(fNm + "." + rdo_name + i);		
		var check=0;
				
		for(var j = 0 ; j < CheckValue.length; j++ ) {
			if (CheckValue[j].checked == true) {
				var rec = CheckValue[j].value;
				check=check+1;
			}
		}
				
		if (check==0) {
			alert("¸ðµç Ç×¸ñ¿¡ ´äº¯ÇØÁÖ¼¼¿ä.");
			CheckValue[0].focus();
			return false;
		}
	}
		
	return true;
}


/*	login check	*/

function ChkLogin(uid,evnetCode){
	if (uid==""){
	  	alert("·Î±×ÀÎ ÈÄ ÀÀ¸ðÇØÁÖ¼¼¿ä.");
		parent.location.href = T_RE_GO_URL + evnetCode;
		return false;
	}					
}

function ChkLogin1(uid,evnetCode){
	if (uid==""){
	  	alert("·Î±×ÀÎ ÈÄ ÀÀ¸ðÇØÁÖ¼¼¿ä.");
		opener.location.href = T_RE_GO_URL + evnetCode;
		self.close();
		return false;
	}					
}

/* WeddingStory login check */
function ChkLogin2(uid,evnetCode){
	if (uid==""){
	  	alert("·Î±×ÀÎ ÈÄ ÀÀ¸ðÇØÁÖ¼¼¿ä.");
		parent.location.href = LOGIN_URL + "http://www.onmoviestyle.com/weddingstory/sub_03_event.asp";
		return false;
	}					
}

/*	date check	*/
function ChkDate(nDate,chkDate,strMsg){
	if (nDate < chkDate){
		alert(chkDate+strMsg);
		return false;	
	}
}

function ChkEndDate(nDate,chkDate,strMsg){
	if (nDate > chkDate){
		alert(chkDate+strMsg);
		return false;	
	}
}
/*	selectbox check	*/

// fNm	 	: 	Æû ÀÌ¸§
// objSelNm	:	¼¿·ºÆ®¹Ú½º ÀÌ¸§
// selLen	:	¼¿·ºÆ®¹Ú½º ¼ö
// strMsg	:	¾Ë¸²¸Þ½ÃÁö

function ChkSelect(fNm,objSelNm,selLen,strMsg){		
	for (var i = 1 ; i <= selLen; i++ ) {
		var CheckValue = eval(fNm + "." + objSelNm + i);		
		var check=0;
			
		if (CheckValue.selectedIndex == 0) {
			check=check+1;
		}		
		
		if (check > 0) {
			alert(strMsg);
			return false;
		}					
	}	
	return true;
}

/*	radio NULL check	*/

function ChkRdo(fNm,objRdoNm,rdoLen,strMsg){
	for (var i = 1 ; i <= rdoLen; i++ ) {
		var CheckValue = eval(fNm + "." + objRdoNm + i);		
		var check=0;
				
		for(var j = 0 ; j < CheckValue.length; j++ ) {
			if (CheckValue[j].checked == true) {
				var rec = CheckValue[j].value;
				check=check+1;
			}
		}
				
		if (check==0) {
			alert(strMsg);
			CheckValue[0].focus();
			return false;
		}
	}		
	return true;
}



/*	text NULL check	*/

// objName	:	°´Ã¼ ÀÌ¸§
// strMsg	:	¾Ë¸²¸Þ½ÃÁö

function ChkisNull(objName,strMsg) {
    if (objName.value == null || objName.value == "") {
    	alert(strMsg);
        return false;
    }    
    return true;
}


/*	Multi text NULL check	*/

function ChkText(fNm,objRdoNm,txtLen,strMsg){
	for (var i = 1 ; i <= txtLen; i++ ) {
		var CheckValue = eval(fNm + "." + objRdoNm + i);		
		var check=0;
				
	    if (CheckValue.value == null || CheckValue.value == "") {
	    	check=check+1;	        
	    }   
				
		if (check > 0) {
			alert(strMsg);
			CheckValue.focus();
			return false;
		}
	}		
	return true;
}

/*	popup	*/

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

/**
 * ÀÔ·Â°ªÀÇ ¹ÙÀÌÆ® ±æÀÌ¸¦ ¸®ÅÏ
 * ex) if (getByteLength(form.title) > 100) {
 *         alert("Á¦¸ñÀº ÇÑ±Û 50ÀÚ(¿µ¹® 100ÀÚ) ÀÌ»ó ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù.");
 *     }
 */
function getByteLength(input) {
    var byteLength = 0;
    for (var inx = 0; inx < input.value.length; inx++) {
        var oneChar = escape(input.value.charAt(inx));
        if ( oneChar.length == 1 ) {
            byteLength ++;
        } else if (oneChar.indexOf("%u") != -1) {
            byteLength += 2;
        } else if (oneChar.indexOf("%") != -1) {
            byteLength += oneChar.length/3;
        }
    }
    return byteLength;
}

