function _comm_resize_img(imgObj, max_width, max_height) { var dst_width; var dst_height; var img_width; var img_height; img_width = parseInt(imgObj.width); img_height = parseInt(imgObj.height); if(img_width == 0 || img_height == 0){ imgObj.style.display = ''; return false; } // 가로비율 우선으로 시작 if(img_width > max_width || img_height > max_height) { // 가로기준으로 리사이즈 dst_width = max_width; dst_height = Math.ceil((max_width / img_width) * img_height); // 세로가 max_height 를 벗어났을 때 if(dst_height > max_height) { dst_height = max_height; dst_width = Math.ceil((max_height / img_height) * img_width); } imgObj.width = dst_width; imgObj.height = dst_height; } // 가로비율 우선으로 끝 imgObj.style.display = ''; return true; } function openWin(url,winName,width,height,scroll) { window.open( url , winName,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=" + scroll + ",resizable=no,width=" + width + ",height=" + height); return ; } function openWinCenter(url,winName,width,height,scroll) { var sw=screen.availWidth; var sh=screen.availHeight; //열 창의 포지션 var px=(sw-width)/2; var py=(sh-height)/2; window.open( url , winName,"toolbar=no,location=no,directories=no,status=no,menubar=no,left="+px+",top=" +py+ ",scrollbars=" + scroll + ",resizable=no,width=" + width + ",height=" + height); return ; } function isEmpty( data ) { for( var i = 0 ; i < data.length ; i++ ) { if( data.substring( i , i + 1 ) != " " ) { return false; } } return true; } function getTxtRealLength( data ) { var nLength = 0; for( var i = 0 ; i < data.length ; i++ ) { if( data.substring( i , i + 1 ) != " " ) { nLength = nLength + 1; } } return nLength; } // 메세지를 출력하고, Object로 focus를 돌려준다. function ErrMsg( obj, msg ) { try { alert( msg ); if( obj.type == "select-one" ) { obj.focus(); } else { obj.focus(); obj.select(); } return false; } catch(errorObject) { var msg = errorObject.description + "\n\n" + "Error Number : " + (errorObject.number>>16 & 0x1FFF) + "\n\n"; alert(msg); return false; } } //숫자만 입력가능하게함 사용예< OnKeyPress="numChk()" > function numChk() { if ((event.keyCode<48) || (event.keyCode>57)) event.returnValue=false; } function numDotChk() { if ((event.keyCode != 46) && (event.keyCode<48) || (event.keyCode>57)) { event.returnValue=false; } } function numSemiChk() { if ((event.keyCode != 46) && (event.keyCode<48) || (event.keyCode>58)) { event.returnValue=false; } } function chkCommID( str ) { var check = false; for(var i=0; i=65 && str.charCodeAt(i) <= 90) || (str.charCodeAt(i) >= 97 && str.charCodeAt(i) <= 122) || (oneChar >= 0 && oneChar <= 9) )) { check = true; } else { check = false; break; } } return check; } // 메일 체크 function _checkEmail(strEmail) { var arrMatch = strEmail.match(/^(\".*\"|[A-Za-z0-9_-]([A-Za-z0-9_-]|[\+\.])*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z0-9][A-Za-z0-9_-]*(\.[A-Za-z0-9][A-Za-z0-9_-]*)+)$/); if( arrMatch == null ) { return false; } var arrIP = arrMatch[2].match(/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/); if( arrIP != null ) { for( var i = 1 ; i <= 4 ; i++ ) { if( arrIP[i] > 255 ) { return false; } } } return true; } function chkEnglish( str ) { var check = false; for(var i=0; i=65 && str.charCodeAt(i) <= 90) || (str.charCodeAt(i) >= 97 && str.charCodeAt(i) <= 122))) { check = true; } else { check = false; break; } } return check; } // value가 숫자로만 되어있는지 체크한다. function isDigitValue(value) { try { inputStr = value; for( var i = 0 ; i < inputStr.length ; i++ ) { var oneChar = inputStr.charAt(i) if (oneChar < "0" || oneChar > "9") { return false; } } return true; } catch(errorObject) { var msg = errorObject.description + "\n\n" + "Error Number : " + (errorObject.number>>16 & 0x1FFF) + "\n\n"; alert(msg); return false; } } function toDotData( obj ) { var val = obj.value; val = reduce_comma(val); if( isDigitValue(val) ) { val = display_comma(val); } else { val = ""; } obj.value = val; } /** * 입력 값이 Object 인지를 반환. * returns true if a is an object, and array, or a function. * It returns false if a is a string, a number, a boolean, or null, or undefined. */ function isObject(input) { return (input && typeof input == 'object') || isFunction(input); } /** * 입력 값이 Function 인지를 반환. */ function isFunction(input) { return typeof input == 'function'; } function resizeImageWidth(area, width) { var imgs; if(!isObject(area)) return; if(area.length == undefined) { imgs = area.getElementsByTagName("IMG"); for(j=0; j< imgs.length; j++) { if(imgs[j].width>width){ imgs[j].height = imgs[j].height * width / imgs[j].width; imgs[j].width = width; } } } else { for(i=0; iwidth){ imgs[j].height = imgs[j].height * width / imgs[j].width; imgs[j].width = width; } } } } } function display_comma(value) { var src; var i; var factor; var su; var Spacesize = 0; var String_val = value.toString(); factor = String_val.length % 3; su = (String_val.length - factor) /3; src = String_val.substring(0,factor); for(i=0; i limit){ alert("Please limit to "+limit+" characters."); $jQ('#'+textid).val(text.substr(0,limit)); $jQ("#"+viewid).html(limit); } } function fnUpper(obj){ // obj.value = obj.value.toUpperCase(); var str = obj.value; var retStr = ""; for(var i=0; i= 97 && str.charCodeAt(i) <= 122 ) { retStr += oneChar.toUpperCase(); } else { retStr += oneChar; } } //alert( retStr ); obj.value = retStr; //obj.value.replace( /^[a-z]/g, function(value){ // obj.value = obj.value.toUpperCase(); //}); }