// Switches to between http and https. function gojump(xurl,flg) { if (flg==1) { protchar = "https://"; location.href = protchar + location.host + xurl; } else { location.href = xurl; } } /*------------------------------------------------*/ /* Constants */ /*------------------------------------------------*/ var ie4over = 1; var ns4over = 2; var otherBrowser = 0; function getURL(thisurl,fileURL) { var loc = new String(thisurl); var start_ind = loc.indexOf('//',0); var protchar = loc.substring(0,start_ind); var rethost = loc.slice(start_ind + 2); var find_idx1 = rethost.indexOf('/',0); var retdir = rethost.slice(find_idx1 + 1); var find_idx2 = retdir.indexOf('/',0); retdir = retdir.substring(0,find_idx2); returl = protchar + '//' + rethost.substring(0,find_idx1) + '/'+ retdir + '/' + fileURL; return returl; } /*------------------------------------------------*/ /* Check at date */ /*------------------------------------------------*/ function isDate(strDate) { // Final day of month var wrtMonth= new Array(31,28,31,30,31,30,31,31,30,31,30,31); // Check on number of digits if (strDate.length != 8) { alert("Please input the correct date by yyyymmdd."); return false; } // Year value check intYear = parseInt(strDate.substring(0, 4), 10); if (intYear<0) { alert("Please input the correct year."); return false; } // Leap year check if (((intYear % 4 == 0) && (intYear % 100 != 0)) || (intYear % 400 == 0)) { wrtMonth[1] = 29; } // Month value check intMonth = parseInt(strDate.substring(4,6), 10); if ((intMonth < 1) || (intMonth > 12)) { alert("Please input the correct month."); return false; } // Day value check intDay = parseInt(strDate.substring(6,8), 10); if ((intDay < 1) || (intDay > wrtMonth[intMonth - 1])) { alert("Please input the correct day."); return false; } return true; } /*-------------------------------------------------------*/ /* Check of the normal-width Japanese syllabary code. */ /*-------------------------------------------------------*/ function isNotHanKana(val) { var i; var chr; var fromChr; var toChr; var btype = getBrowser(); if(btype == ie4over){ fromChr = "%uFF66"; toChr = "%uFF9F"; } else if(btype == ns4over){ fromChr = "%A6"; toChr = "%DF"; } for (i = 0; i < val.length; i++) { chr = escape(val.charAt(i)); if (chr >= fromChr && chr <= toChr){ return false; } } return true; } /*-------------------------------------------------------*/ /* Check of an integer value. */ /*-------------------------------------------------------*/ function isNumber(val) { var i; var chr; for (i = 0; i < val.length; i++) { chr = val.charAt(i); if (chr >= "0" && chr <= "9"){ } else { return false; } } return true; } function getLength(moji) { var i,cnt = 0; for(i=0; i= 4 ) cnt+=2; else cnt++; return cnt; } /*------------------------------------------------*/ /* Get information of browser with version. */ /* Return value: */ /* 1 Internet Explorer version 4 or upper. */ /* 2 Netscape Navigator version 4 or upper. */ /* 0 Another version without above. */ /*------------------------------------------------*/ function getBrowser() { var ret; var ie4 = (document.all) ? 1 : 0; var ns4 = (document.layers) ? 1 : 0; if(ie4){ ret = ie4over; } else { if(ns4){ ret = ns4over; } else { ret = otherBrowser; } } return ret; } /*------------------------------------------------*/ /* */ /*------------------------------------------------*/ function getInfo() { var theAgent = navigator.userAgent; theAgent = theAgent.toUpperCase(); var ver = ""+navigator.appVersion; this.name = "Unknown"; this.typeNo = -1; this.version= -1; //-------------- Macine Check -------------- if ( theAgent.indexOf("WIN") >= 0) { this.name = "Windows"; if (theAgent.indexOf("3.1") >= 0) { this.name = "Windows 3.1"; this.typeNo = 0;} if (theAgent.indexOf("95") >= 0) { this.name = "Windows 95"; this.typeNo = 1;} if (theAgent.indexOf("98") >= 0) { this.name = "Windows 98"; this.typeNo = 2;} if (theAgent.indexOf("NT") >= 0) { this.name = "Windows NT"; this.typeNo = 3;} if (theAgent.indexOf("2000") >= 0) { this.name = "Windows 2000"; this.typeNo = 4;} } if ( theAgent.indexOf("MAC") >= 0) { this.name = "MacOS"; if (theAgent.indexOf("68K") >= 0) { this.name = "MacOS"; this.typeNo = 10;} if (theAgent.indexOf("PPC") >= 0) { this.name = "MacOS"; this.typeNo = 11;} if (theAgent.indexOf("POWER") >= 0) { this.name = "MacOS"; this.typeNo = 11;} } if ( theAgent.indexOf("FREEBSD") >= 0) { this.name = "FreeBSD"; this.typeNo = 20;} if ( theAgent.indexOf("NETBSD") >= 0) { this.name = "NetBSD"; this.typeNo = 21;} if ( theAgent.indexOf("OPENBSD") >= 0) { this.name = "OpenBSD"; this.typeNo = 22;} if ( theAgent.indexOf("BSDI") >= 0) { this.name = "BSDi"; this.typeNo = 23;} if ( theAgent.indexOf("FRINBSD") >= 0) { this.name = "FrinBSD"; this.typeNo = 24;} if ( theAgent.indexOf("LINUX") >= 0) { this.name = "Linux"; this.typeNo = 30;} if ( theAgent.indexOf("SUN") >= 0) { var v = theAgent.indexOf("SUNOS"); v = eval(theAgent.substring(v+6,v+8)); if (v <= 4.1) {this.name = "SunOS"; this.typeNo = 40;}else{ this.name = "Solaris"; this.typeNo = 41;} } //-------------- Browser Check -------------- this.browser= navigator.appName; //-------------- Version Check -------------- if (theAgent.indexOf("MSIE") >=0 ) { var fno = ver.indexOf("MSIE") + 5; ver = ver.substring(fno,99); var fno = ver.indexOf(";"); var bno = ver.indexOf("b"); if ((bno != -1) && (bno < fno)) fno = bno; this.version = eval(ver.substring(0,fno)); }else{ var fno = ver.indexOf(" "); ver = ver.substring(0,fno); this.version = eval(ver); } } /*------------------------------------------------*/ /* */ /*------------------------------------------------*/ function trim(p){ var f=p; var d,c,len,i,ic; len=f.length; if(len==0){return "";} for (i=0;i=0;i--) { f2=f.substring(i-1,i); if(f2!=" "&f2!=" ") { break; } } f=f.substring(0,i); return f; } function Rtrim(p){ var f=p; var d,c,len,i,ic; len=f.length; if(len==0){return "";} for (i=0;i=0;i--) { f2=f.substring(i-1,i); if(f2!=" "&f2!=" ") { break; } } f=f.substring(0,i); return f; }