function isInteger(obj){
	var newValue = obj.value
	var newLength = newValue.length
	for ( var i = 0; i != newLength ; i ++) {
		aChar = newValue.substring(i,i+1)
		if (aChar < "0" || aChar > "9") {
			return false
		}
	}
	return true
}

function isNumeric(obj){
	var newValue = obj.value
	var newLength = newValue.length
	var extraChars="."
	for ( var i = 0; i != newLength ; i ++) {
		aChar = newValue.substring(i,i+1)
		searched = extraChars.indexOf(aChar)
		if (searched == -1 && (aChar < "0" || aChar > "9" ) ) {
			return false
		}
	}
	return true
}

function isEmpty(obj){
	if (obj.value == ''){
		return true
	}
	return false
}

function isEmail(obj) {
	var newValue = obj.value
	var len = newValue.length;
	if (len == 0) {
		return false;
	}
	
	for(var i = 0; i < len; i++) {
		var c = newValue.charAt(i);
		if(!((c >= "A" && c <= "Z")||(c >= "a" && c <= "z")||(c >= "0" && c <= "9")||(c == "-")||(c == "_")||(c == ".")||(c == "@"))) {
		  return false;
		}
	}
	if((newValue.indexOf("@")==-1)||(newValue.indexOf("@")==0)||(newValue.indexOf("@")==(len-1))) {
		return false;
	}
	if((newValue.indexOf("@")!=-1)&&(newValue.substring(newValue.indexOf("@")+1,len).indexOf("@")!=-1)) {
		return false;
	}
	if((newValue.indexOf(".")==-1)||(newValue.indexOf(".")==0)||(newValue.lastIndexOf(".")==(len-1))) {
		return false;
	}
	return true;
}

function isFileFormat(obj,Format){
var FilePath = obj.value.toUpperCase()
var format = Format.toUpperCase()
var Ext = ''
if (FilePath.length > 0){
	var startpoint = FilePath.lastIndexOf('.') + 1
	var endpoint = FilePath.length
	Ext = FilePath.substring(startpoint,endpoint)
}
if (Ext != format && Ext !='') {
			return false
}

return true
}

function isDate(objyear,objmonth,objday){
	var year = parseInt(objyear.value)
	var month = parseInt(objmonth.value)
	var day = parseInt(objday.value)
	var smonth = false
	var leapyear = false
	
	if (month == "4" || month == "6"||month == "9"||month == "11") {
		smonth = true
	}

	if (smonth == true && day > 30){
		return false
	} else if (day > 31) {
		return false
	} 
		
	if (year % 4 == 0 && year % 400 == 0 && year % 100 == 0) {
		leapyear = true
	} else if (year % 4 == 0 && year % 100 != 0) {
		leapyear = true
	} 

	if ( month == 2 ) {
		if ( leapyear == true && day > 29) {
			return false 
		} else if (leapyear == false && day > 28){
			return false 
		}
	}					

	return true
}

function selectall(obj){
	if (obj != null){
		if (obj.length > 0 ) {
			for (i = 0 ; i < obj.length ; i++){
				if (obj(i).disabled == 0){
					obj(i).checked = 1
				}					
			}
		} else {
			if (obj.disabled == 0){
				obj.checked = 1
			}
		}
	}
}

function unselectall(obj){
	if (obj != null){
		if (obj.length == 0 ) {
			if (obj.disabled == 0){
				obj.checked = 0
			}
		} else {
			for (i = 0 ; i < obj.length ; i++){
				if (obj(i).disabled == 0){
					obj(i).checked = 0
				}					
			}
		}
	}
}

function validint(obj){
	if (!isInteger(obj)){
		obj.focus
		while ( ! isInteger(obj) ){
			obj.value = obj.value.substring(0,obj.value.length - 1)
		}
		alert('½Ð¿é¤J¼Æ¦r')
	}

}

function validNumeric(obj){
	if (!isNumeric(obj)){
		obj.focus
		while ( ! isNumeric(obj) ){
			obj.value = obj.value.substring(0,obj.value.length - 1)
		}
	}

}

function validComma(obj){
	if (obj.value.indexOf(',') > 0){
		obj.focus
		while ( obj.value.indexOf(',') > 0 ){
			obj.value = obj.value.substring(0,obj.value.length - 1)
		}
	}

}

function creditcard(formobj,obj,arg){
	if(eval('document.' +  formobj + '.' + obj + '(' + arg +').value.length == 4')){
		eval('document.' + formobj + '.' + obj + '(' + (arg + 1) + ').focus()');
	}
}


function openeditwin(path,width,heigth){
	
	path = escape(path)
	
	//if (navigator.appName == 'Microsoft Internet Explorer'){
		//showModalDialog('/showmodal.asp?path=' + path ,window,'dialogWidth:' +  (width) + 'px;dialogHeight:' + (heigth) + 'px; resizable: no; help: no; status: yes; scroll: no;');
	//} else {
		window.open('/showmodal.asp?path=' + path,'room','top=0,left=0,width=' +  (width) + ',height=' +  (heigth))
	//}
}

