/*-- ------------------------------------------------------
oxsolution JAVASCRIPT functions http://www.oxsolution.com
------------------------------------------------------ --*/
function showCalendar(elmName,e) {
if (typeof oxc_calendar == "undefined") return;
if (typeof ox_formmail_js_calendar == "undefined") ox_formmail_js_calendar = new oxc_calendar("ox_formmail_js_calendar");
ox_formmail_js_calendar.showCalendar("","",e);
ox_formmail_js_calendar.userFunc = function(y,m,d) {
getByName(elmName,0).value = y+"-"+zerofill(m,2)+"-"+zerofill(d,2);
};
}
function getDayStr(y,m,d) {
var k = (new Date(y,m-1,d,0,0,0)).getDay(),
v = (msg["dayStr"].split(","))[k];
if (k == 0) return ''+v+'';
if (k == 6) return ''+v+'';
return v;
}
function setDayStr(row,opt) {
var prefix = opt ? "sDate" : "eDate",
year = getById(prefix+"_"+row+"_y"),
month = getById(prefix+"_"+row+"_m"),
date = getById(prefix+"_"+row+"_d");
getById(prefix+"_"+row+"_day").innerHTML = getDayStr(optionSelectedValue(year)*1,optionSelectedValue(month)*1,optionSelectedValue(date)*1);
}
function onChangeDate(row,opt) {
var prefix = opt ? "sDate" : "eDate",
year = getById(prefix+"_"+row+"_y"),
month = getById(prefix+"_"+row+"_m"),
date = getById(prefix+"_"+row+"_d"),
days = getLastDay(optionSelectedValue(year)*1,optionSelectedValue(month)*1);
clearChild(date);
for (var d=1; d<=days; d++) createOption(date,d,d);
}
function isAvailable(row) {
if (getByName("input[TEXT_NOTE]["+row+"][AVAILABLE]",0).value != "Y") return;
var sy = getById("sDate_"+row+"_y"),
sm = getById("sDate_"+row+"_m"),
sd = getById("sDate_"+row+"_d"),
sh = getById("sDate_"+row+"_h"),
si = getById("sDate_"+row+"_i"),
ey = getById("eDate_"+row+"_y"),
em = getById("eDate_"+row+"_m"),
ed = getById("eDate_"+row+"_d"),
eh = getById("eDate_"+row+"_h"),
ei = getById("eDate_"+row+"_i");
var st = (""+optionSelectedValue(sy)
+zerofill(optionSelectedValue(sm),2)
+zerofill(optionSelectedValue(sd),2)
+zerofill(optionSelectedValue(sh),2)
+zerofill(optionSelectedValue(si),2))*1,
et = (""+optionSelectedValue(ey)
+zerofill(optionSelectedValue(em),2)
+zerofill(optionSelectedValue(ed),2)
+zerofill(optionSelectedValue(eh),2)
+zerofill(optionSelectedValue(ei),2))*1;
if (st > et) {
alert(msg["isNotDate"]);
ey.selectedIndex = sy.selectedIndex;
em.selectedIndex = sm.selectedIndex;
onChangeDate(row,0);
ed.selectedIndex = sd.selectedIndex;
setDayStr(row,0);
eh.selectedIndex = sh.selectedIndex;
ei.selectedIndex = si.selectedIndex;
}
}
function actionDelete(id) {
if (!confirm(msg["isRemove"])) return;
var fm = document.createElement("form");
fm.action = urlList.actionUrl+"&mancmd=delete";
fm.method = "post";
fm.style.display = "none";
document.body.appendChild(fm);
var elm = document.createElement("input");
elm.type = "hidden";
elm.name = "input[ID_NUM]";
elm.value = id;
fm.appendChild(elm);
hiddenFramePostLink(fm);
}
function actionListDelete(listName) {
var ids = checkboxCheckedValue(getByName(listName));
if (!ids.length) {
alert(msg["isNotSelect"]);
return;
}
actionDelete(ids.join("|"));
}
function actionPrint(id,pid) {
popup("FORMMAIL_VIEW",900,600,urlList.contentUrl+"&cmd=mail_view&type=popup_view&id="+id+"&pid="+pid,"yes").focus();
}