function RT(strobj){
	var val = strobj;
	return val.replace( /\s*$/g, "" );
}

function LT(strobj){
	var val = strobj;
	return val.replace( /^\s*/g, "" );
}

function AT(strobj){
	var val = strobj;
	return RT(LT(val));
}

function VI(strobj){
	var val = strobj;
	var objRegExp = /(^-?\d\d*$)/;
	if(!objRegExp.test(val)){
		return false;
	} else {
		return true;
	}
}

function VD(strobj){
	var val = strobj;
	var anum=/(^\d+$)|(^\d+\.\d+$)/;
	if (!anum.test(val)){
		return false;
	} else {
		return true;
	}
}

function VET(strobj){
	var val = strobj;
	if(AT(val).length==0){
		return true;
	} else {
		return false;
	}
}

function VE(strobj){
	var val = strobj;
	var objRegExp  = /^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-\.]*)(\.[a-z]{2,3}(\.[a-z]{2}){0,2})$/i;
	if(!objRegExp.test(val)){
		return false;
	} else {
		return true;
	}
}

function falert(obj1,obj2)
{
	alert(obj1);
	setFocus(obj2);
	return false;
}

function setFocus(obj){
	if(canFocus(obj)){
		obj.focus();
		if(isText(obj)){
			obj.select();
		}
	}
}

function isText( obj ){
	if( !obj || !obj.type ) return false;
	if( obj.type.match( /^(text|file|password|textarea)$/i ) ) return true;
	return false;
}

function canFocus(obj){
	if( ! obj || obj.readOnly || obj.disabled || obj.style.visibility == "hidden" ) return false;
	if( obj.type && obj.type.match(/hidden/i) ) return false;
	return true;
}

function fCheckInputHankaku(strChar){
	var intLen,intIndex;
	var strInput = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.";

	intLen = strChar.length;
	for (intIndex = 0; intIndex < intLen; intIndex++) {
		if (strInput.indexOf(strChar.charAt(intIndex)) < 0) {
			return false;
		}
	}
	return true;
}

function fGetByte(strTempName) {
	var intLen;
	var intCnt;

	intLen = 0;
	for(intCnt = 0; intCnt < strTempName.length; intCnt++) {
		if (escape(strTempName.charAt(intCnt)).length >= 4  && ((escape(strTempName.charAt(intCnt)) < '%uFF66') || (escape(strTempName.charAt(intCnt)) > '%uFF9D'))) {
			intLen+=2;
		} else {
			intLen++;
		}
	}
	return intLen;
}

function fGetTime() {
	var objSysDate = new Date();
	return (objSysDate.getTime());
}

function openWindow(theURL,w,h) {
	var winName = "pop";
	var LeftPosition=(screen.width)?(screen.width-w)/2:100;
	var TopPosition=(screen.height)?(screen.height-h)/2:100;
	features += ',width=' + w + ',height=' + h + ',top='+TopPosition+',left='+LeftPosition;
	top.popWinHandle = window.open(theURL,winName,features);
	if (top.popWinHandle!=null && top.popWinHandle.closed == false){
		top.popWinHandle.focus();
	}
}

var imgObj,LeftPosition,TopPosition;
function checkImage(theURL, picZoomIn){
	if (typeof(imgObj) == "object"){
	try {
		if ((imgObj.width != 0) && (imgObj.height != 0)){
			LeftPosition=(screen.width)?(screen.width-imgObj.width*picZoomIn)/2:10;
			TopPosition=(screen.height)?(screen.height-imgObj.height*picZoomIn)/2:10;
			OpenFullSizeWindow(theURL,picZoomIn, ",width=" + (imgObj.width*picZoomIn+20) + ",height=" + (imgObj.height*picZoomIn+30)+",top="+TopPosition+",left="+LeftPosition);
		}else{
			setTimeout(checkImg(theURL + picZoomIn), 100);
		}
		}
	catch(e){
	}
	}
}

function OpenFullSizeWindow(theURL,picZoomIn,features) {
	var aNewWin, sBaseCmd,winName;
	sBaseCmd = "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes";
	if (features == null || features == ""){
		winName = 'tempPic';
		imgObj = new Image();
		imgObj.src = theURL;
		checkImage(theURL, picZoomIn);
	}
	else{
		aNewWin = window.open("showPic.asp?pic="+theURL+"&W="+imgObj.width*picZoomIn+"&H="+imgObj.height*picZoomIn,winName, sBaseCmd + features);		
		aNewWin.focus();
	}
}