function callpage(form, con, act, prm) {
var f = document.forms[form];
f.action = '';
f.target = '_self';
f.commoncon.value = con;
f.commonact.value = act;
if (prm != undefined) {
f.commonprm.value = prm;
}
f.submit();
}
function callnewpage(form, con, act, prm, wnm, opt) {
var f = document.forms[form];
var t = form.target;
if (opt == undefined) {
if (wnm == undefined) {
var nw='NewWindow'+uniqid();
window.open('', nw);
f.target = nw;
} else {
window.open('', wnm);
f.target = wnm;
}
} else {
window.open('', wnm, opt);
f.target = wnm;
}
f.action = '';
f.commoncon.value = con;
f.commonact.value = act;
f.commonprm.value = prm;
f.submit();
f.target = t;
}
function goUrl(url) {
location.href = url;
}
function doAction(form, action) {
var f = document.forms[form];
f.action = action;
f.target = '_self';
f.submit();
}
function doRedirect(form, con, act, prm) {
var f = document.forms[form];
f.commoncon.value = con;
f.commonact.value = act;
if (prm != undefined) {
f.commonprm.value = prm;
}
var baseurl = f.commonbaseurl.value;
doAction(form, baseurl+con+'/'+act);
}
function doRedirectNewWindow(form, con, act, prm, wnm, opt) {
var f = document.forms[form];
var t = form.target;
if (opt == undefined) {
if (wnm == undefined) {
var nw='NewWindow'+uniqid();
window.open('', nw);
f.target = nw;
} else {
window.open('', wnm);
f.target = wnm;
}
} else {
window.open('', wnm, opt);
f.target = wnm;
}
f.commoncon.value = con;
f.commonact.value = act;
if (prm != undefined) {
f.commonprm.value = prm;
}
var baseurl = f.commonbaseurl.value;
f.action = baseurl+con+'/'+act;
f.submit();
f.target = t;
}
function doForward(form, con, act, prm) {
callpage(form, con, act, prm);
}
function showPopup(url, windowName, width, height, left, top, showStatusBar, showScrollBar, showMenuBar, showToolBar, doResize) {
var opt='';
if (width!=undefined) {
if (width!=null) opt+=',width='+cStr(width);
}
if (height!=undefined) {
if (height!=null) opt+=',height='+cStr(height);
}
if (left!=undefined) {
if (left!=null) opt+=',left='+cStr(left)+'px,screenX='+cStr(left)+'px';
}
if (top!=undefined) {
if (top!=null) opt+=',top='+cStr(top)+'px,screenY='+cStr(top)+'px';
}
if (showStatusBar!=undefined) {
if (showStatusBar==true) {
opt+=',status=yes';
} else {
opt+=',status=no';
}
}
if (showScrollBar!=undefined) {
if (showScrollBar==true) {
opt+=',scrollbars=yes';
} else {
opt+=',scrollbars=no';
}
}
if (showMenuBar!=undefined) {
if (showMenuBar==true) {
opt+=',menubar=yes';
} else {
opt+=',menubar=no';
}
}
if (showToolBar!=undefined) {
if (showToolBar==true) {
opt+=',toolbar=yes';
} else {
opt+=',toolbar=no';
}
}
if (doResize!=undefined) {
if (doResize==true) {
opt+=',resizable=yes';
} else {
opt+=',resizable=no';
}
}
if (opt!='') opt=mid(opt,1);
return window.open(url,windowName,opt);
}
function showModal(url, width, height, left, top, doCentering, showStatusBar, showScrollBar, doResize) {
var opt='';
if (width!=undefined) {
if (width!=null) opt+=',dialogwidth='+cStr(width)+'px';
}
if (height!=undefined) {
if (height!=null) opt+=',dialogheight='+cStr(height)+'px';
}
if (left!=undefined) {
if (left!=null) opt+=',dialogleft='+cStr(left)+'px';
}
if (top!=undefined) {
if (top!=null) opt+=',dialogtop='+cStr(top)+'px';
}
if (doCentering!=undefined) {
if (doCentering==true) {
opt+=',center=yes';
} else {
opt+=',center=no';
}
}
if (showStatusBar!=undefined) {
if (showStatusBar==true) {
opt+=',status=yes';
} else {
opt+=',status=no';
}
}
if (showScrollBar!=undefined) {
if (showScrollBar==true) {
opt+=',scroll=yes';
} else {
opt+=',scroll=no';
}
}
if (doResize!=undefined) {
if (doResize==true) {
opt+=',resizable=yes';
} else {
opt+=',resizable=no';
}
}
if (opt!='') opt=mid(opt,1);
return showModalDialog(url,this,opt);
}
function closeModal(rtn) {
returnValue=rtn;
closeWindow();
}
function closeWindow() {
self.window.close();
}
function doPost(form) {
var f = document.forms[form];
f.submit();
}
function getValue(id) {
return document.getElementById(id).value;
}
function getText(id) {
return document.getElementById(id).innerHTML;
}
function getListItem(id, idx) {
var obj = document.getElementById(id);
return obj.options[idx].text;
}
function getListIndex(id) {
var obj = document.getElementById(id);
return obj.selectedIndex;
}
function getSelectItem(id) {
var obj = document.getElementById(id);
var idx = obj.selectedIndex;
return obj.options[idx].text;
}
function getSelectValue(id) {
var obj = document.getElementById(id);
var idx = obj.selectedIndex;
return obj.options[idx].value;
}
function getRadioValue(name) {
var obj = document.getElementsByTagName('input');
var cnt = obj.length;
var val = '';
for (i=0; i < cnt; i++) {
if (obj[i].name == name) {
val = obj[i].checked?obj[i].value:val;
}
}
return val;
}
function setRadioChecked(name, val) {
var obj = document.getElementsByTagName('input');
var cnt = obj.length;
for (i=0; i < cnt; i++) {
if (obj[i].name == name) {
obj[i].checked = obj[i].value==val?true:false;
}
}
}
function setChecked(id, flg) {
return document.getElementById(id).checked = flg==1?true:false;
}
function isChecked(id) {
return document.getElementById(id).checked;
}
function setValue(id, val) {
document.getElementById(id).value = val;
}
function setText(id, val) {
document.getElementById(id).innerHTML = val;
}
function setAction(form, action) {
var f = document.forms[form];
f.action = action;
}
function setEnable(id, flg) {
var obj = document.getElementById(id);
if (flg == 0) {
obj.disabled = 'true';
} else {
obj.disabled = '';
}
}
function setReadOnly(id, flg) {
var obj = document.getElementById(id);
if (flg == 0) {
obj.readOnly = 'readonly';
} else {
obj.readOnly = '';
}
}
function setBgColor(id, color) {
var obj = document.getElementById(id);
obj.style.background = color;
}
function setVisible(id, flg) {
var obj = document.getElementById(id);
if (flg == 1) {
obj.style.visibility = 'visible';
obj.style.display = 'block';
} else {
obj.style.visibility = 'hidden';
obj.style.display = 'none';
}
}
function setVisibleGroup(tag, id, flg) {
var obj = document.getElementsByTagName(tag);
var cnt = obj.length;
var len = id.length;
for (var i=0; i < cnt; i++) {
var nam = obj[i].id;
if (nam.substr(0, len) == id) {
if (flg == 1) {
setVisible(nam, 1);
} else {
setVisible(nam, 0);
}
}
}
}
function setListItem(id, csv) {
var obj = document.getElementById(id);
while ((obj.options.length > 0) || (obj.options[0] != null)) {
obj.options[0] = null;
}
var dat = new Array();
dat = csv.split(',');
if (dat.length == 1) {
return;
}
for (var i=0; i<dat.length/2; i++) {
obj.options[i] = new Option(dat[i*2+1], dat[i*2]);
}
}
function iif(exp, rtnTrue, rtnFalse) {
return exp ? rtnTrue : rtnFalse;
}
function selectListItem(id, val) {
var obj = document.getElementById(id);
for (var i=0; i<obj.options.length; i++) {
if(obj.options[i].value == val) {
obj.selectedIndex = i;
return;
}
}
}
function len(psStr) {
return psStr.length;
}
function trim(psStr) {
return String(psStr).replace(/^[ 　]*/gim, "").replace(/[ 　]*$/gim, '');
}
function mid(psStr, pnPos, pnLen) {
var max;
if (pnLen==undefined) {
max = psStr.length;
} else {
max = pnPos + pnLen;
}
return psStr.substring(pnPos, max);
}
function left(psStr, pnLen) {
return psStr.substr(0, pnLen);
}
function right(psStr, pnLen) {
var get = pnLen;
var max = psStr.length;
if (get>max) {
return psStr;
} else {
return psStr.substring(max-get, max);
}
}
function instr(pnPos, psStr, psTgt) {
if (psTgt==undefined) {
var str=pnPos;
var tgt=psStr;
var pos=0;
} else {
var str=psStr;
var tgt=psTgt;
var pos=pnPos;
}
return str.indexOf(tgt, pos);
}
function val(dat) {
var rtn = dat;
rtn-=0;
return rtn;
}
function cNum(dat) {
return val(dat);
}
function cStr(dat) {
var rtn = dat;
rtn+='';
return rtn;
}
function doZeroPad(num, max) {
var tmp=''+num;
while(tmp.length<max){
tmp='0'+tmp;
}
return tmp;
}
function doZeroSup(num) {
var flg = 0;
var tmp = cStr(num);
for (var i=0; i<tmp.length; i++) {
if (tmp.substr(i, 1)!='0') {
tmp = tmp.substr(i, tmp.length-i);
flg = 1;
break;
}
}
if (flg==0 && tmp.length>0) {
tmp = '0';
}
return tmp;
}
function now() {
dt = new Date();
yy = dt.getYear();
if (yy < 2000) yy+=1900;
return yy+'/'+(right('0'+(dt.getMonth()+1),2))
+'/'+(right('0'+(dt.getDate()),2))
+' '+(right('0'+(dt.getHours()),2))
+':'+(right('0'+(dt.getMinutes()),2))
+':'+(right('0'+(dt.getSeconds()),2));
}
function rnd(p1, p2) {
if (p1==undefined && p2===undefined) {
return Math.random();
}
if (p2===undefined) {
return Math.floor(Math.random()*p1);
}
return p1+Math.floor(Math.random()*(p2-p1));
}
function uniqid () {
var id = new Date().getTime()
id += cStr(rnd(10000,100000));
id += cStr(rnd(10000,100000));
id += cStr(rnd(10000,100000));
return id;
}
