home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2004 December
/
PCWorld_2004-12_cd.bin
/
software
/
komercni
/
netgenium
/
NETGenium.msi
/
_B4A5F9DE730F039E0CBFC30C1A8A8467
/
_B508FAD1DDAA491CB066AECB39FC85F7
(
.txt
)
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
NeXTSTEP
RISC OS/Acorn
UTF-8
Wrap
VBScript Encoded script
|
2004-10-30
|
77.9 KB
|
2,503 lines
// ----------------------------------------------------------------------------------------
// --- Menu
// ----------------------------------------------------------------------------------------
function micl(obj) // MenuItem_OnClick
{
if (selectedTable != null) selectedTable.className = "MenuItem";
selectedTable = obj;
obj.className = "SelectedMenuItem";
}
function miclt(table, image) // MenuItem_OnClick_Tree
{
table.style.display = jsDisplay(table.style.display == "none");
if (table.style.display == "") image.src = imMinus.src; else image.src = imPlus.src;
}
function miov(obj) // MenuItem_OnMouseOver
{
obj.backgroundColor_ = obj.style.backgroundColor;
obj.borderColor_ = obj.style.borderColor;
obj.style.backgroundColor = "#CCCCCC";
obj.style.borderColor = "#999999";
}
function miou(obj) // MenuItem_OnMouseOut
{
obj.style.backgroundColor = obj.backgroundColor_;
obj.style.borderColor = obj.borderColor_;
}
function mido(obj) // MenuItem_OnMouseDown
{
event.cancelBubble = true;
obj.backgroundColor1_ = obj.style.backgroundColor;
obj.style.backgroundColor = "#999999";
}
function miup(obj) // MenuItem_OnMouseUp
{
obj.style.backgroundColor = obj.backgroundColor1_;
}
// ----------------------------------------------------------------------------------------
// --- Scroll
// ----------------------------------------------------------------------------------------
function jsAutoScroll_Vertical()
{
if (event.clientY > document.body.clientHeight - 40)
{
if (document.sciy == null) document.sciy = window.setInterval("window.scrollBy(0, 4);", 5);
}
else if (event.clientY < 40)
{
if (document.sciy == null) document.sciy = window.setInterval("window.scrollBy(0, -4);", 5);
}
else if (document.sciy != null)
{
window.clearInterval(document.sciy);
document.sciy = null;
}
}
function jsAutoScroll_Horizontal()
{
if (event.clientX > window.document.body.clientWidth - 40)
{
if (document.scix == null) document.scix = window.setInterval("window.scrollBy(4, 0);", 5);
}
else if (event.clientX < 40)
{
if (document.scix == null) document.scix = window.setInterval("window.scrollBy(-4, 0);", 5);
}
else if (document.scix != null)
{
window.clearInterval(document.scix);
document.scix = null;
}
}
// ----------------------------------------------------------------------------------------
// --- Display, Visibility
// ----------------------------------------------------------------------------------------
function jsDisplay(value)
{
if (value) return ""; else return "none";
}
function jsVisibility(value)
{
if (value) return "visible"; else return "hidden";
}
// ----------------------------------------------------------------------------------------
// --- Errors
// ----------------------------------------------------------------------------------------
function jsError(text)
{
if (document.readyState != "complete")
{
document.NG_error = text;
setTimeout("jsError(document.NG_error);", 100);
}
else alert(text);
}
// ----------------------------------------------------------------------------------------
// --- TextBox
// ----------------------------------------------------------------------------------------
function tb_Print(bt, tb, hl, office)
{
if (tb.value == "TRUE")
{
tb.value = "";
if (office)
{
for (var i = 0; i < document.forms[0].length; i++)
if (document.forms[0].item(i).tagName == "INPUT" && document.forms[0].item(i).onclick != null && document.forms[0].item(i).onclick.toString().indexOf(bt.id + ".click();") != -1)
{
bt = document.forms[0].item(i);
break;
}
document.NG_printText = bt.value;
bt.value = pleaseWait;
bt.disabled = true;
var width = bt.style.width;
bt.style.width = "140px";
setTimeout("var bt = document.forms[0]." + bt.id + "; bt.value = document.NG_printText; bt.disabled = false; bt.style.width = '" + width + "';", 20000);
hl.click();
}
else
{
window.showModalDialog(hl.href, "", "dialogHeight:" + screen.availHeight + "px; dialogLeft:0px; dialogTop:0; dialogWidth:" + screen.availWidth + "px;");
}
}
}
// ----------------------------------------------------------------------------------------
// --- DropDownList
// ----------------------------------------------------------------------------------------
function ddl_SelectedItem_Text(ddl)
{
var i = ddl.selectedIndex;
if (i == -1) return "";
return ddl.options(i).text;
}
function ddl_SelectedItem_Value(ddl)
{
var i = ddl.selectedIndex;
if (i == -1) return "";
return ddl.options(i).value;
}
function ddl_SelectText(ddl, text)
{
for (i = 0; i < ddl.options.length; i++)
if (ddl.options(i).text == text)
{
ddl.options(i).selected = true;
ddl.fireEvent("onchange");
break;
}
}
function ddl_SelectText_NoChange(ddl, text)
{
for (i = 0; i < ddl.options.length; i++)
if (ddl.options(i).text == text)
{
ddl.options(i).selected = true;
break;
}
}
function ddl_SelectValue(ddl, text)
{
for (i = 0; i < ddl.options.length; i++)
if (ddl.options(i).value == text)
{
ddl.options(i).selected = true;
ddl.fireEvent("onchange");
break;
}
}
function ddl_SelectValue_NoChange(ddl, text)
{
for (i = 0; i < ddl.options.length; i++)
if (ddl.options(i).value == text)
{
ddl.options(i).selected = true;
break;
}
}
function ddl_Init(ddl)
{
ddl.search = "";
ddl.searchIndex = 0;
ddl.selectedIndex_ = ddl.selectedIndex;
}
function ddl_Search(ddl, foo)
{
if (event.keyCode == 13) ddl.fireEvent("onchange");
else if (event.keyCode == 27) ddl.selectedIndex = ddl.selectedIndex_;
else
{
var next = event.keyCode == 32;
var s = ddl.search + (next ? "" : String.fromCharCode(event.keyCode).toLowerCase());
if (s == "") return false;
for (var i = ddl.searchIndex; i < ddl.options.length; i++)
if (ddl.options(i).text.toLowerCase().indexOf(s) == 0)
{
if (i == ddl.searchIndex && next) continue;
ddl.options(ddl.searchIndex = i).selected = true;
ddl.search = s;
next = false;
break;
}
if (next && foo == null)
{
ddl.searchIndex = 0;
ddl_Search(ddl, true);
}
}
return false;
}
function ddl_Copy(source, destination, selectValue)
{
if (destination == null) return; // DropDownList is not visible
selectValue = selectValue && destination.sv != null;
var index = -1;
for (var i = 0; i < source.options.length; i++)
{
var o = document.createElement("OPTION");
destination.options.add(o);
o.text = source.options(i).text;
o.value = source.options(i).value;
if (selectValue && o.value == destination.sv && index == -1)
{
index = i;
o.selected = true;
}
}
}
// ----------------------------------------------------------------------------------------
// --- ListBox
// ----------------------------------------------------------------------------------------
function lb_Items_Load(lb1, lb1_sv, lb2, lb2_sv, tb, lb, ANEI, column2)
{
var s = new Array();
if (tb.value != "") s = tb.value.split(" ");
if (ANEI)
for (var i = 0; i < s.length; i++)
{
var ok = false;
for (var j = 0; j < lb.options.length; j++)
if (lb.options(j).value == s[i])
{
ok = true;
break;
}
if (!ok)
{
var o = document.createElement("OPTION");
lb.options.add(o);
o.innerText = s[i];
o.value = s[i];
}
}
if (lb1 == null) // DenyMove
{
for (var i = 0; i < s.length; i++)
for (var j = 0; j < lb.options.length; j++)
if (lb.options(j).value == s[i])
{
var o = document.createElement("OPTION");
lb2.options.add(o);
o.text = lb.options(j).text;
o.value = lb.options(j).value;
break;
}
}
else
{
ddl_Copy(lb, lb1);
for (var i = 0; i < s.length; i++)
for (var j = 0; j < lb1.options.length; j++)
if (lb1.options(j).value == s[i])
{
var o = document.createElement("OPTION");
lb2.options.add(o);
o.text = lb1.options(j).text;
o.value = lb1.options(j).value;
if (!(column2 && s[i] == "2"))
{
lb1.options.remove(j);
}
break;
}
ddl_SelectValue_NoChange(lb1, lb1_sv);
}
ddl_SelectValue_NoChange(lb2, lb2_sv);
}
function lb_Items_Move(source, destination, column2, back, lb)
{
var result = false;
var select = -1;
for (var i = 0; i < source.options.length; i++)
if (source.options(i).selected)
{
if (destination.max != null && destination.max == destination.options.length)
{
alert(destination.errorMessage);
break;
}
if (!(source.options(i).value == "2" && column2 && back))
{
result = true;
var oOption = document.createElement("OPTION");
var index = destination.options.length;
if (lb != null)
for (var j = 0; j < lb.options.length; j++)
if (source.options(i).value == lb.options(j).value)
{
index = j;
break;
}
destination.options.add(oOption, index);
oOption.text = source.options(i).text;
oOption.value = source.options(i).value;
}
if (!(source.options(i).value == "2" && column2 && !back))
{
result = true;
source.options.remove(i);
select = i;
i--;
}
}
if (select != -1 && source.options.length != 0)
{
if (select == source.options.length) select--;
source.options(select).selected = true;
}
return result;
}
function lb_Items_Delete(lb)
{
var select = -1;
for (var i = 0; i < lb.options.length; i++)
if (lb.options(i).selected)
{
lb.options.remove(i);
select = i;
i--;
}
if (select != -1 && lb.options.length != 0)
{
if (select == lb.options.length) select--;
lb.options(select).selected = true;
}
}
function lb_Items_MoveUp(lb)
{
var i = lb.selectedIndex;
if (i == -1 || i == 0) return;
var t = lb.options[i - 1].text;
var v = lb.options[i - 1].value;
lb.options[i - 1].text = lb.options[i].text;
lb.options[i - 1].value = lb.options[i].value;
lb.options[i].text = t;
lb.options[i].value = v;
lb.selectedIndex = i - 1;
}
function lb_Items_MoveDown(lb)
{
var i = lb.selectedIndex;
if (i == -1 || i == lb.options.length - 1) return;
var t = lb.options[i + 1].text;
var v = lb.options[i + 1].value;
lb.options[i + 1].text = lb.options[i].text;
lb.options[i + 1].value = lb.options[i].value;
lb.options[i].text = t;
lb.options[i].value = v;
lb.selectedIndex = i + 1;
}
function lb_Items_JoinValues(lb)
{
var s = new Array();
for (var i = 0; i < lb.options.length; i++) s[i] = lb.options(i).value;
return s.join(" ");
}
function lb_Items_JoinTexts(lb)
{
var s = new Array();
for (var i = 0; i < lb.options.length; i++) s[i] = lb.options(i).text;
return s.join(" ");
}
// ----------------------------------------------------------------------------------------
// --- Radio
// ----------------------------------------------------------------------------------------
function rbl_SelectedItem_Value(rbl)
{
if (rbl.length > 0)
{
for (var i = 0; i < rbl.length; i++) if (rbl[i].checked) return rbl[i].value;
}
else
{
var o = rbl;
while (o.tagName != "BODY") o = o.parentElement; // opener...
// IE 5.5: rbl.ownerDocument
for (var i = 0; i < rbl.rows.length; i++)
{
if (o.all[rbl.id + "_" + i].checked) return rbl.rows(i).cells(0).all(1).innerText;
}
}
return "";
}
function rbl_SelectValue(rbl, text)
{
var o = rbl;
while (o.tagName != "BODY") o = o.parentElement; // opener...
// IE 5.5: rbl.ownerDocument
for (i = 0; i < rbl.rows.length; i++)
if (rbl.rows(i).cells(0).all(1).innerText == text)
{
o.all[rbl.id + "_" + i].checked = true;
break;
}
}
// ----------------------------------------------------------------------------------------
// --- Button
// ----------------------------------------------------------------------------------------
function bt_FindByText(text, index)
{
var n = 0;
for (var i = 0; i < document.forms[0].length; i++)
if (document.forms[0].item(i).tagName == "INPUT" && document.forms[0].item(i).value == text)
{
if (index != null && n != index) { n++; continue; }
return document.forms[0].item(i);
}
return null;
}
// ----------------------------------------------------------------------------------------
// --- Global
// ----------------------------------------------------------------------------------------
function jsQuot()
{
return "'";
}
function jsDQuot()
{
return '"';
}
function DPH(tbCena, ddlSazbaDPH)
{
var cena = jsNumber(tbCena.value);
var dph = new Number(cena * ddl_SelectedItem_Value(ddlSazbaDPH) / 100);
return jsFormatNumber(Math.ceil(dph));
}
function CenaSDPH(tbCena, ddlSazbaDPH)
{
var cena = jsNumber(tbCena.value);
var dph = new Number(cena * ddl_SelectedItem_Value(ddlSazbaDPH) / 100);
return jsFormatNumber(Math.ceil(cena + dph));
}
function jsFullName(tbTitle, tbName, tbSurname)
{
var s = "";
if (tbTitle.value != "") s += tbTitle.value + " ";
if (tbName.value != "") s += tbName.value + " ";
return s + tbSurname.value;
}
// ----------------------------------------------------------------------------------------
// --- Windows
// ----------------------------------------------------------------------------------------
function jsOpen(url, par, xy)
{
if (par == null) par = "width = 300, height = 100, status = no"; // without window borders... (3px window, 2px body, body, 2px body, 3px window)
if (xy != null && xy)
{
par += ", left = " + (event.screenX + 18) + ", top = " + (event.screenY - 10);
}
if (par.indexOf("left") == -1)
{
par += ", left = " + (window.top.screenLeft + 50) + ", top = ";
if (opener == null) par += "40"; else par += window.top.screenTop + 11;
}
var obj = window.open(url, "", par);
obj.focus();
}
function jsOpenDialog(url, par)
{
return window.showModalDialog(url, par, "help:no; scroll:no; status:no; dialogWidth:306px; dialogHeight:127px;"); // including window borders... (300x95 without borders)
}
function alert(text, type, top)
{
jsOpenDialog(root + "Alert.aspx?type=" + type + "&top=" + top, text);
}
function alertdiv(text)
{
jsOpenDialog(root + "AlertDiv.aspx", text);
}
function confirm(text, type)
{
return jsOpenDialog(root + "Confirm.aspx?type=" + type, text);
}
function jsWait()
{
try { parent.main.document.location = root + "__Wait.htm"; }
catch (e) {}
}
function jsWait2(url)
{
for (var i = 0; i < document.forms[0].length; i++)
if (document.forms[0].item(i).tagName == "SELECT")
{
document.forms[0].item(i).style.visibility = "hidden";
}
document.body.leftMargin = document.body.rightMargin = document.body.topMargin = document.body.bottomMargin = 0;
document.body.scroll = "no";
document.body.insertAdjacentHTML("afterBegin", '<div style="position: absolute; top: ' + document.body.scrollTop + 'px; left:' + document.body.scrollLeft + 'px; width: ' + document.body.clientWidth + '; height: ' + document.body.clientHeight + '; z-index: 10000; background-color: white"><table id=tblwait cellSpacing=0 cellPadding=0 width=300 border=0 style="position: absolute;"><tr><td style="font-size: 5px; filter: progid:dximagetransform.microsoft.gradient(gradienttype=1,startcolorstr=#ffffff,endcolorstr=' + barColor + ');"> </td><td style="font-size: 5px; filter: progid:dximagetransform.microsoft.gradient(gradienttype=1,startcolorstr=' + barColor + ',endcolorstr=#ffffff);"> </td></tr></table><span style="position: absolute; top: 14px; left: 10px; font-size: 10px; font-family: Verdana; color: #333333;">' + pleaseWait + '</span></div>');
setInterval("jsWait2_Move()", 10);
if (url != null) location = url;
}
function jsWait2_Move()
{
var n = tblwait.offsetLeft + 2;
if (n > document.body.clientWidth) n = - tblwait.offsetWidth;
tblwait.style.left = n;
}
function jsRefresh(obj, refresh)
{
var refresh_ = false;
var s = obj.location.toString().split("?");
var P = "";
if (s[1] != null)
{
var p = s[1].split("&");
for (var i = 0; i < p.length; i++)
{
var variable = p[i].split("=")[0];
if (variable == "refresh") refresh_ = true;
if (variable != "scrollX" && variable != "scrollY")
{
if (P != "") P += "&";
P += p[i];
}
}
}
// Scroll
if (P != "") P += "&";
P += "scrollX=" + obj.document.body.scrollLeft + "&scrollY=" + obj.document.body.scrollTop;
// Refresh
if (refresh != null && refresh && !refresh_) P += "&refresh=";
// Redirect
obj.location = s[0] + "?" + P;
}
function jsResizeWindow(w, h, leftMargin, rightMargin, topMargin, bottomMargin, center, dialog)
{
if (!dialog && opener == null) return;
document.body.leftMargin = leftMargin;
document.body.rightMargin = rightMargin;
document.body.topMargin = topMargin;
document.body.bottomMargin = bottomMargin;
var maxW = screen.availWidth - (window.screenLeft - 3);
var maxH = screen.availHeight - (window.screenTop - 22); // title bar: XP 29px, 2000 22px
var newW = 3 + leftMargin + w + rightMargin + 3; // 3px window border, body, 3px window border
var newH = 22 + topMargin + h + bottomMargin + 3; // 22px title bar + body + 3px window border
if (!dialog)
{
newW += 4; // 2x 2px body border
newH += 4; // 2x 2px body border
try { if (opener != null) newH += jsNumber(opener.top.document.xptheme) + jsNumber(opener.top.document.xpsp2); }
catch (e) {} // Opener is closed...
if (newW > maxW) newH += 17; // scrollbar
if (newH > maxH) newW += 17; // scrollbar
if (newW > maxW && newW < screen.availWidth)
{
window.moveBy(maxW - newW, 0);
jsResizeWindow(w, h, leftMargin, rightMargin, topMargin, bottomMargin, center, dialog);
return;
}
if (newH > maxH && newH < screen.availHeight)
{
window.moveBy(0, maxH - newH);
jsResizeWindow(w, h, leftMargin, rightMargin, topMargin, bottomMargin, center, dialog);
return;
}
if (newW > maxW || newH > maxH)
{
document.body.scroll = "yes";
if (newW > maxW) newW = maxW;
if (newH > maxH) newH = maxH;
}
else
{
document.body.scroll = "no";
}
try
{
window.resizeTo(newW, newH);
var dif = document.body.scrollHeight - document.body.clientHeight, h2 = newH;
if (dif == 7 || dif == 30) // XP theme
{
newH += 7;
try { if (opener != null) opener.top.document.xptheme = 7; }
catch (e) {} // Opener is closed...
}
if (dif == 20 || dif == 30) // Status bar (Windows XP Service Pack 2)
{
newH += dif == 20 ? 20 : 23;
try { if (opener != null) opener.top.document.xpsp2 = dif == 20 ? 20 : 23; }
catch (e) {} // Opener is closed...
}
if (h2 != newH) window.resizeTo(newW, newH);
}
catch (e) {} // Security...
if (center) window.moveTo((screen.availWidth - newW) / 2, (screen.availHeight - newH) / 2);
}
else
{
window.dialogWidth = newW + "px"; // including window borders
window.dialogHeight = newH + "px"; // including window borders
var dif = document.body.scrollHeight - document.body.clientHeight, h2 = newH;
if (dif == 7 || dif == 27) // XP theme
{
newH += 7;
}
if (dif == 20 || dif == 27) // Status bar (Windows XP Service Pack 2)
{
newH += 20;
}
if (h2 != newH) window.dialogHeight = newH + "px";
if (center)
{
window.dialogLeft = ((screen.width - newW) / 2) + "px";
window.dialogTop = ((screen.height - newH) / 2) + "px";
}
}
}
// ----------------------------------------------------------------------------------------
// --- Parser: Numbers - dot as DecimalSeparator (.)
// ----------------------------------------------------------------------------------------
function jsNumber(value)
{
if (value == null) return 0;
value = value.toString().replace(",", ".");
if (value == "") return 0;
if (value > -1000000000000 && value < 1000000000000) return new Number(value); else return 0;
}
function jsIsNumber(value)
{
if (value == null) return false;
value = value.toString().replace(",", ".");
return value > -1000000000000 && value < 1000000000000;
}
function jsFormatNumber(n)
{
return n.toString().replace(".", ",");
}
// ----------------------------------------------------------------------------------------
// --- Parser
// ----------------------------------------------------------------------------------------
function ZInt(n)
{
if (n < 10) return "0" + n; else return n;
}
function Hex(n)
{
if (new Number(n) < 16) return "0" + new Number(n).toString(16); else return new Number(n).toString(16);
}
function Time2Int(text)
{
if (text.indexOf(":") == -1) return 0;
var n = Math.abs(jsNumber(text.split(":")[0])) * 60 + jsNumber(text.split(":")[1]);
if (text.indexOf("-") == 0) n = - n;
return n;
}
function Int2Time(n)
{
var s = ZInt(Math.floor(Math.abs(n) / 60)) + ":" + ZInt(Math.abs(n) % 60);
if (n < 0) s = "-" + s;
return s;
}
function Str2Date(text)
{
if (text == "") return new Date();
var s = text.split(" ");
var day = 0;
var month = 0;
var year = 0;
var hour = 0;
var minute = 0;
var d = s[0].split(".");
if (d.length == 3)
{
day = jsNumber(d[0]);
month = jsNumber(d[1]);
year = jsNumber(d[2]);
}
else
{
d = s[0].split("/");
if (d.length == 3)
{
day = jsNumber(d[1]);
month = jsNumber(d[0]);
year = jsNumber(d[2]);
}
}
if (day == 0 || month == 0 || year == 0) return new Date();
if (s.length == 2)
{
s = s[1].split(":");
if (s.length == 2) return new Date(year, month - 1, day, jsNumber(s[0]), jsNumber(s[1]));
}
return new Date(year, month - 1, day);
}
function Date2Str(date)
{
var s = ZInt(date.getDate()) + "." + ZInt(date.getMonth() + 1) + "." + date.getFullYear() + " " + ZInt(date.getHours()) + ":" + ZInt(date.getMinutes());
return s.replace(" 00:00", "");
}
function Now()
{
var date = new Date();
return ZInt(date.getDate()) + "." + ZInt(date.getMonth() + 1) + "." + date.getFullYear() + " " + ZInt(date.getHours()) + ":" + ZInt(date.getMinutes());
}
function InsertTime(tb)
{
var d = new Date();
tb.value = ZInt(d.getHours()) + ":" + ZInt(d.getMinutes());
}
function Color2Hex(text)
{
var s = text.split(",");
if (s.length != 3) return "#ffffff";
return "#" + Hex(jsNumber(s[0])) + Hex(jsNumber(s[1])) + Hex(jsNumber(s[2]));
}
// ----------------------------------------------------------------------------------------
// --- Cookies
// ----------------------------------------------------------------------------------------
function jsGetCookie(name)
{
var c = document.cookie.split("; ");
for (var i = 0; i < c.length; i++)
{
if (c[i].split("=")[0] == name) return c[i].split("=")[1];
}
return "";
}
function jsSetCookie(name, value)
{
var expire = new Date();
expire.setMonth(expire.getMonth() + 6);
document.cookie = name + "=" + value + ";expires=" + expire.toGMTString();
}
function jsNetGeniumStart(text)
{
return jsGetCookie("ng" + text);
}
// ----------------------------------------------------------------------------------------
// --- FormPicker
// ----------------------------------------------------------------------------------------
function jsFilterApps_FormPicker(ddlAppGroups, ddlApps, ddlTables, btGo)
{
var strAppGroup = ddl_SelectedItem_Value(ddlAppGroups);
var strApp = ddl_SelectedItem_Value(ddlApps);
while (ddlApps.options.length != 0) ddlApps.options.remove(0);
for (i = 0; i < jsAppGroup.length; i++)
if (jsAppGroup[i] == strAppGroup)
{
var s1 = null;
var s2 = null;
if (jsAppsID[i] != "")
{
s1 = jsAppsID[i].split(";");
s2 = jsAppsName[i].split(";");
}
if (s1 != null)
for (j = 0; j < s1.length; j++)
{
var oOption = document.createElement("OPTION");
ddlApps.options.add(oOption);
oOption.value = s1[j];
oOption.innerText = s2[j];
}
ddl_SelectValue(ddlApps, strApp);
break;
}
jsFilterTables_FormPicker(ddlApps, ddlTables, btGo);
}
function jsFilterTables_FormPicker(ddlApps, ddlTables, btGo)
{
var strApp = ddl_SelectedItem_Value(ddlApps);
var strTable = ddl_SelectedItem_Value(ddlTables);
while (ddlTables.options.length != 0) ddlTables.options.remove(0);
for (i = 0; i < jsApp.length; i++)
if (jsApp[i] == strApp)
{
var s1 = null;
var s2 = null;
if (jsTablesID[i] != "")
{
s1 = jsTablesID[i].split(";");
s2 = jsTablesName[i].split(";");
}
if (s1 != null)
for (j = 0; j < s1.length; j++)
{
var oOption = document.createElement("OPTION");
ddlTables.options.add(oOption);
oOption.value = s1[j];
oOption.innerText = s2[j];
}
ddl_SelectValue(ddlTables, strTable);
break;
}
if (btGo != null) btGo.disabled = ddlTables.selectedIndex == -1;
}
// ----------------------------------------------------------------------------------------
// --- CategoryPicker, AppPicker
// ----------------------------------------------------------------------------------------
function jsFilterApps_CategoryPicker(ddlAppGroups, ddlApps, ddlCategories)
{
var strAppGroup = ddl_SelectedItem_Value(ddlAppGroups);
var strApp = ddl_SelectedItem_Value(ddlApps);
while (ddlApps.options.length != 0) ddlApps.options.remove(0);
for (i = 0; i < jsAppGroup.length; i++)
if (jsAppGroup[i] == strAppGroup)
{
var s1 = null;
var s2 = null;
if (jsAppsID[i] != "")
{
s1 = jsAppsID[i].split(";");
s2 = jsAppsName[i].split(";");
}
if (s1 != null)
for (j = 0; j < s1.length; j++)
{
var oOption = document.createElement("OPTION");
ddlApps.options.add(oOption);
oOption.value = s1[j];
oOption.innerText = s2[j];
}
ddl_SelectValue(ddlApps, strApp);
break;
}
if (ddlCategories != null) jsFilterCategories_CategoryPicker(ddlApps, ddlCategories);
}
function jsFilterCategories_CategoryPicker(ddlApps, ddlCategories)
{
var strApp = ddl_SelectedItem_Value(ddlApps);
var strCategory = ddl_SelectedItem_Value(ddlCategories);
while (ddlCategories.options.length != 1) ddlCategories.options.remove(1); // First item = (Root)
for (i = 0; i < jsApp.length; i++)
if (jsApp[i] == strApp)
{
var s1 = null;
var s2 = null;
if (jsCategoriesID[i] != "")
{
s1 = jsCategoriesID[i].split(";");
s2 = jsCategoriesName[i].split(";");
}
if (s1 != null)
for (j = 0; j < s1.length; j++)
{
var oOption = document.createElement("OPTION");
ddlCategories.options.add(oOption);
oOption.value = s1[j];
oOption.innerText = s2[j];
}
ddl_SelectValue(ddlCategories, strCategory);
break;
}
}
// ----------------------------------------------------------------------------------------
// --- ViewPagePicker, ViewFieldPicker
// ----------------------------------------------------------------------------------------
function jsFilterApps_ViewPagePicker(lbAppGroups, lbApps, lbViewPages, lbViewFields, lbListBox2)
{
if (lbAppGroups.selectedIndex == -1 && lbAppGroups.options.length != 0) lbAppGroups.options(0).selected = true;
var strAppGroup = ddl_SelectedItem_Value(lbAppGroups);
var strApp = ddl_SelectedItem_Value(lbApps);
while (lbApps.options.length != 0) lbApps.options.remove(0);
for (i = 0; i < jsAppGroup.length; i++)
if (jsAppGroup[i] == strAppGroup)
{
var s1 = null;
var s2 = null;
if (jsAppsID[i] != "")
{
s1 = jsAppsID[i].split(";");
s2 = jsAppsName[i].split(";");
}
if (s1 != null)
for (j = 0; j < s1.length; j++)
{
var oOption = document.createElement("OPTION");
lbApps.options.add(oOption);
oOption.value = s1[j];
oOption.innerText = s2[j];
}
ddl_SelectValue(lbApps, strApp);
break;
}
jsFilterViewPages_ViewPagePicker(lbApps, lbViewPages, lbViewFields, lbListBox2);
}
function jsFilterViewPages_ViewPagePicker(lbApps, lbViewPages, lbViewFields, lbListBox2)
{
if (lbApps.selectedIndex == -1 && lbApps.options.length != 0) strApp = lbApps.options(0).selected = true;
var strApp = ddl_SelectedItem_Value(lbApps);
var strViewPage = ddl_SelectedItem_Value(lbViewPages);
while (lbViewPages.options.length != 0) lbViewPages.options.remove(0);
for (i = 0; i < jsApp.length; i++)
if (jsApp[i] == strApp)
{
var s1 = null;
var s2 = null;
if (jsViewPagesID[i] != "")
{
s1 = jsViewPagesID[i].split(";");
s2 = jsViewPagesName[i].split(";");
}
if (s1 != null)
for (j = 0; j < s1.length; j++)
{
// Check if this item is already selected
var insert = true;
if (lbViewFields == null && lbListBox2 != null)
for (var l = 0; l < lbListBox2.options.length; l++)
if (s1[j] == lbListBox2.options(l).value)
{
insert = false;
break;
}
if (insert)
{
var oOption = document.createElement("OPTION");
lbViewPages.options.add(oOption);
oOption.value = s1[j];
oOption.innerText = s2[j];
}
}
ddl_SelectValue(lbViewPages, strViewPage);
break;
}
if (lbViewFields != null) jsFilterViewFields_ViewFieldPicker(lbViewPages, lbViewFields, lbListBox2);
}
function jsFilterViewFields_ViewFieldPicker(lbViewPages, lbViewFields, lbListBox2)
{
if (lbViewPages.selectedIndex == -1 && lbViewPages.options.length != 0) strViewPage = lbViewPages.options(0).selected = true;
var strViewPage = ddl_SelectedItem_Value(lbViewPages);
var strViewField = ddl_SelectedItem_Value(lbViewFields);
while (lbViewFields.options.length != 0) lbViewFields.options.remove(0);
for (i = 0; i < jsViewPage.length; i++)
if (jsViewPage[i] == strViewPage)
{
var s1 = null;
var s2 = null;
if (jsViewFieldsID[i] != "")
{
s1 = jsViewFieldsID[i].split(";");
s2 = jsViewFieldsName[i].split(";");
}
if (s1 != null)
for (j = 0; j < s1.length; j++)
{
// Check if this item is already selected
var insert = true;
for (var l = 0; l < lbListBox2.options.length; l++)
if (s1[j] == lbListBox2.options(l).value)
{
insert = false;
break;
}
if (insert)
{
var oOption = document.createElement("OPTION");
lbViewFields.options.add(oOption);
oOption.value = s1[j];
oOption.innerText = s2[j];
}
}
ddl_SelectValue(lbViewFields, strViewField);
break;
}
}
// ----------------------------------------------------------------------------------------
// --- DatePicker
// ----------------------------------------------------------------------------------------
function dp_SelectDate(ddlDay, ddlMonth, tbYear, date)
{
var month = date.getMonth() + 1;
var year = date.getFullYear();
ddl_SelectValue_NoChange(ddlMonth, month);
dp_FillDays(ddlDay, month, year);
ddl_SelectValue_NoChange(ddlDay, date.getDate());
tbYear.value = year;
}
function dp_FillDays(ddl, month, year)
{
var days = 30;
if (month == 2 && year % 4 != 0) days = 28; else
if (month == 2 && year % 4 == 0) days = 29; else
if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) days = 31;
var strDay = ddl_SelectedItem_Value(ddl);
while (ddl.options.length != 28) ddl.options.remove(ddl.options.length - 1);
for (i = 29; i <= days; i++)
{
var oOption = document.createElement("OPTION");
ddl.options.add(oOption);
oOption.value = i;
oOption.innerText = i;
}
ddl_SelectValue_NoChange(ddl, strDay);
}
// ----------------------------------------------------------------------------------------
// --- DataGrid
// ----------------------------------------------------------------------------------------
function dg_ShowGrid(obj, color)
{
for (var i = 0; i < obj.rows.length; i++)
for (var l = 1; l < obj.rows(i).cells.length; l++)
{
if (l != obj.rows(i).cells.length - 1) obj.rows(i).cells(l).style.borderRight = color + " 1px solid";
}
}
// ----------------------------------------------------------------------------------------
// --- Comments
// ----------------------------------------------------------------------------------------
function jsInsertComment(tb, comment, user)
{
if (comment != "")
{
var s = tb.value;
if (s != "") s += "\r\n\r\n";
s += user + ", " + Now() + "\r\n" + comment;
tb.value = s;
tb.fireEvent("onchange");
tb.focus();
}
}
function jsInsertRichComment(tb, comment, user)
{
if (comment != "")
{
var s = tb.value;
if (s != "") s += "<P> </P>";
s += "<P><B>" + user + ", " + Now() + "</B></P>" + comment;
tb.value = s;
tb.fireEvent("onchange");
}
}
// ----------------------------------------------------------------------------------------
// --- RichTextBox
// ----------------------------------------------------------------------------------------
function rtb_InsertTable(rtb, rows, columns)
{
rtb.focus();
var newTable = rtb.document.createElement('TABLE');
for (y = 0; y < rows; y++)
{
var newRow = newTable.insertRow();
for (x = 0; x < columns; x++)
{
var newCell = newRow.insertCell();
if (y == 0 && x == 0) newCell.id = 'corner';
}
}
newTable.border = 1;
newTable.width = 25 * columns;
rtb.document.selection.createRange().pasteHTML(newTable.outerHTML);
var range = rtb.document.body.createTextRange();
var item = rtb.document.getElementById('corner');
item.id = '';
range.moveToElementText(item);
range.moveStart('character', range.text.length);
range.select();
}
function rtb_GetRange(rtb)
{
rtb.focus();
var ref = null;
var type = rtb.document.selection.type;
var range = rtb.document.selection.createRange();
switch(type)
{
case 'Control':
if (range.length > 0 ) ref = range.item(0);
break;
case 'None':
ref = range.parentElement();
break;
case 'Text':
ref = range.parentElement();
break;
}
return ref;
}
function rtb_CheckTag(rtb, item, tagName)
{
if (item.tagName.search(tagName) != -1) return item;
if (item.ID == rtb.ID) return false;
item = item.parentElement;
return rtb_CheckTag(rtb, item, tagName);
}
function rtb_InsertRow(rtb)
{
var ref = rtb_GetRange(rtb);
ref = rtb_CheckTag(rtb, ref, '/^(TABLE)|^(TR)|^(TD)|^(TBODY)/');
switch (ref.tagName)
{
case 'TABLE':
var newTable = ref.cloneNode(true);
var newRow = newTable.insertRow();
for (x = 0; x < newTable.rows[0].cells.length; x++)
{
var newCell = newRow.insertCell();
}
ref.outerHTML = newTable.outerHTML;
break;
case 'TBODY':
var newTable = ref.cloneNode(true);
var newRow = newTable.insertRow();
for (x = 0; x < newTable.rows[0].cells.length; x++)
{
var newCell = newRow.insertCell();
}
ref.outerHTML = newTable.outerHTML;
break;
case 'TR':
var rowIndex = ref.rowIndex;
var parentTable = ref.parentElement.parentElement;
var newTable = parentTable.cloneNode(true);
var newRow = newTable.insertRow(rowIndex + 1);
for (x = 0; x < newTable.rows[0].cells.length; x++)
{
var newCell = newRow.insertCell();
}
parentTable.outerHTML = newTable.outerHTML;
break;
case 'TD':
var parentRow = ref.parentElement;
var rowIndex = parentRow.rowIndex;
var cellIndex = ref.cellIndex;
var parentTable = ref.parentElement.parentElement.parentElement;
var newTable = parentTable.cloneNode(true);
var newRow = newTable.insertRow(rowIndex + 1);
for (x = 0; x < newTable.rows[0].cells.length; x++)
{
var newCell = newRow.insertCell();
if (x == cellIndex) newCell.id = 'corner';
}
parentTable.outerHTML = newTable.outerHTML;
var range = rtb.document.body.createTextRange();
var item = rtb.document.getElementById('corner');
item.id = '';
range.moveToElementText(item);
range.moveStart('character', range.text.length);
range.select();
break;
default :
rtb_InsertTable(rtb, 1, 3);
return;
}
}
function rtb_InsertColumn(rtb)
{
var ref = rtb_GetRange(rtb);
ref = rtb_CheckTag(rtb, ref, '/^(TABLE)|^(TR)|^(TD)|^(TBODY)/');
switch (ref.tagName)
{
case 'TABLE':
var newTable = ref.cloneNode(true);
for (x = 0; x < newTable.rows.length; x++)
{
var newCell = newTable.rows[x].insertCell();
}
newCell.focus();
ref.outerHTML = newTable.outerHTML;
break;
case 'TBODY':
var newTable = ref.cloneNode(true);
for (x = 0; x < newTable.rows.length; x++)
{
var newCell = newTable.rows[x].insertCell();
}
ref.outerHTML = newTable.outerHTML;
break;
case 'TR':
ref = ref.parentElement.parentElement;
var newTable = ref.cloneNode(true);
for (x = 0; x < newTable.rows.length; x++)
{
var newCell = newTable.rows[x].insertCell();
}
ref.outerHTML = newTable.outerHTML;
break;
case 'TD':
var cellIndex = ref.cellIndex;
var rowIndex = ref.parentElement.rowIndex;
var parentTable = ref.parentElement.parentElement.parentElement;
var newTable = parentTable.cloneNode(true);
for (x = 0; x < newTable.rows.length; x++)
{
var newCell = newTable.rows[x].insertCell(cellIndex + 1);
if (x == rowIndex) newCell.id = 'corner';
}
parentTable.outerHTML = newTable.outerHTML;
var range = rtb.document.body.createTextRange();
var item = rtb.document.getElementById('corner');
item.id = '';
range.moveToElementText(item);
range.moveStart('character', range.text.length);
range.select();
break;
default :
rtb_InsertTable(rtb, 3, 1);
break;
}
}
function rtb_DeleteRow(rtb)
{
var ref = rtb_GetRange(rtb);
ref = rtb_CheckTag(rtb, ref, '/^(TABLE)|^(TR)|^(TD)|^(TBODY)/');
switch (ref.tagName)
{
case 'TR':
ref.parentElement.parentElement.deleteRow(ref.rowIndex);
break;
case 'TD':
var cellIndex = ref.cellIndex;
var parentRow = ref.parentElement;
var rowIndex = parentRow.rowIndex;
var parentTable = ref.parentElement.parentElement.parentElement;
parentTable.deleteRow(rowIndex);
if (rowIndex >= parentTable.rows.length)
{
rowIndex = parentTable.rows.length - 1;
}
if (rowIndex >= 0)
{
var range = rtb.document.body.createTextRange();
range.moveToElementText(parentTable.rows[rowIndex].cells[cellIndex]);
range.moveStart('character', range.text.length);
range.select();
}
else parentTable.removeNode(true);
break;
default: return;
}
}
function rtb_DeleteColumn(rtb)
{
var ref = rtb_GetRange(rtb);
ref = rtb_CheckTag(rtb, ref, '/^(TABLE)|^(TR)|^(TD)|^(TBODY)/');
switch(ref.tagName)
{
case 'TD':
var rowIndex = ref.parentElement.rowIndex;
var cellIndex = ref.cellIndex;
var parentTable = ref.parentElement.parentElement.parentElement;
var newTable = parentTable.cloneNode(true);
if (newTable.rows[0].cells.length == 1)
{
parentTable.removeNode(true);
return;
}
for (x = 0; x < newTable.rows.length; x++)
{
if (newTable.rows[x].cells[cellIndex] == '[object]')
{
newTable.rows[x].deleteCell(cellIndex);
}
}
if (cellIndex >= newTable.rows[0].cells.length)
{
cellIndex = newTable.rows[0].cells.length - 1;
}
if (cellIndex >= 0) newTable.rows[rowIndex].cells[cellIndex].id = 'corner';
parentTable.outerHTML = newTable.outerHTML;
if (cellIndex >= 0)
{
var range = rtb.document.body.createTextRange();
var item = rtb.document.getElementById('corner');
item.id = '';
range.moveToElementText(item);
range.moveStart('character', range.text.length);
range.select();
}
break;
default: return;
}
}
// ----------------------------------------------------------------------------------------
// --- Tree
// ----------------------------------------------------------------------------------------
var tr_span = null;
function tr_Down(obj)
{
tr_span = obj;
while (tr_span.tagName != "SPAN") tr_span = tr_span.parentElement;
var s = obj.id.split("_");
// Get ItemID
jsDD_MovingItem = jsDD_ActiveItem = s[s.length - 1];
// Create window
if (document.trWindow == null)
{
document.trWindow = document.createElement("SPAN");
document.trWindow.className = "DragWindow";
document.body.insertAdjacentElement("afterBegin", document.trWindow);
}
document.trWindow.style.height = 22;
document.trWindow.style.width = obj.offsetWidth + 20;
document.trWindow.move = false;
obj.cY = event.clientY;
obj.cX = event.clientX;
obj.oY = event.offsetY + 4;
obj.oX = event.offsetX + 18;
// Attach events
document.attachEvent("onmousemove", tr_Move);
document.attachEvent("onscroll", tr_Move);
document.attachEvent("onmouseup", tr_Up);
document.attachEvent("onselectstart", tr_Cancel);
}
function tr_Cancel()
{
return false;
}
function tr_Move()
{
var element = document.all[tr_span.id + "_" + jsDD_MovingItem];
if (!document.trWindow.move && Math.abs(element.cY - event.clientY) < 10 && Math.abs(element.cX - event.clientX) < 10) return;
document.trWindow.move = true;
// Move window
document.trWindow.style.top = event.clientY - element.oY + document.body.scrollTop;
document.trWindow.style.left = event.clientX - element.oX + document.body.scrollLeft;
// Scroll page if needed
if (event.clientY > document.body.clientHeight - 40 && document.body.scrollTop + event.clientY < document.body.scrollHeight - 60)
{
window.scrollBy(0, 20);
}
else if (event.clientY < 40)
{
window.scrollBy(0, -20);
}
// Get cell
document.trWindow.style.display = "none";
var o = document.elementFromPoint(event.clientX, event.clientY);
document.trWindow.style.display = "block";
try
{
if (o.tagName != "TD") throw "";
var span = o;
while (span.tagName != "SPAN") span = span.parentElement;
if (span != tr_span) throw "";
var s = o.id.split("_");
jsDD_ActiveItem = s[s.length - 1];
}
catch (e)
{
jsDD_ActiveItem = 0; // Unknown element...
}
}
function tr_Up()
{
// Hide window
document.trWindow.style.display = "none";
// Detach events
document.detachEvent("onmousemove" , tr_Move);
document.detachEvent("onscroll" , tr_Move);
document.detachEvent("onmouseup" , tr_Up);
document.detachEvent("onselectstart", tr_Cancel);
// Execute
if (jsDD_MovingItem != jsDD_ActiveItem && jsDD_ActiveItem != 0)
{
var mi = document.all[tr_span.id + "_" + jsDD_MovingItem];
var ai = document.all[tr_span.id + "_" + jsDD_ActiveItem];
var table = mi;
while (table.tagName != "TABLE") table = table.parentElement;
table = table.nextSibling;
try
{
if (table != null && table.tagName == "TABLE" && table.style.marginLeft == "13px")
{
tr_Search(table, "contains", jsDD_ActiveItem);
}
if (confirm(tr_span.mq.replace("o1", mi.innerHTML).replace("o2", ai.innerHTML)))
{
tr_span.mi.value = jsDD_MovingItem;
tr_span.ai.value = jsDD_ActiveItem;
tr_span.lbt2.click();
}
}
catch (e)
{
}
}
}
function tr_Search(obj, action, findID)
{
for (var i = 0; i < obj.children.length; i++)
{
tr_Search(obj.children(i), action, findID);
if (obj.children(i).tagName == "TABLE" && obj.children(i).rows(0).cells(0).className == "Tree1")
{
// contains
if (action == "contains")
{
var s = obj.children(i).rows(0).cells(1).id.split("_");
if (findID.toString() == s[s.length - 1]) throw "";
}
var table = obj.children(i).nextSibling;
if (table == null || table.tagName != "TABLE" || table.style.marginLeft != "13px") continue;
// roll
if (table.style.display == "" && action == "roll")
{
table.style.display = "none";
obj.children(i).rows(0).cells(0).firstChild.src = imPlus.src;
}
}
}
}
function tr_Click(obj)
{
var span = obj;
while (span.tagName != "SPAN") span = span.parentElement;
if (jsNumber(span.hf.value) != 0) document.all[span.id + "_" + span.hf.value].className = "Tree2";
obj.rows(0).cells(1).className = "Tree3";
var s = obj.rows(0).cells(1).id.split("_");
span.hf.value = s[s.length - 1];
span.bt.disabled = false;
var table = obj.nextSibling;
if (table == null || table.tagName != "TABLE" || table.style.marginLeft != "13px")
{
span.lbt.click();
return;
}
if (table.style.display == "")
{
table.style.display = "none";
obj.rows(0).cells(0).firstChild.src = imPlus.src;
}
else
{
table.style.display = "";
obj.rows(0).cells(0).firstChild.src = imMinus.src;
}
try { span.details.style.visibility = jsVisibility(false); }
catch (e) {}
}
function tr_Roll(span)
{
if (jsNumber(span.hf.value) != 0)
{
document.all[span.id + "_" + span.hf.value].className = "Tree2";
span.hf.value = "0";
span.bt.disabled = true;
}
tr_Search(span, "roll");
}
function tr_Back(span)
{
if (jsNumber(span.hf.value) != 0)
{
var obj = document.all[span.id + "_" + span.hf.value];
obj.className = "Tree2";
while (obj.tagName != "TABLE") obj = obj.parentElement;
obj = obj.parentElement;
if (obj == span)
{
span.hf.value = "0";
span.bt.disabled = true;
}
else
{
while (obj.tagName != "TABLE") obj = obj.parentElement;
obj = obj.previousSibling.rows(0).cells(1);
obj.className = "Tree3";
var s = obj.id.split("_");
span.hf.value = s[s.length - 1];
}
}
try { span.details.style.visibility = jsVisibility(false); }
catch (e) {}
}
// ----------------------------------------------------------------------------------------
// --- Offset
// ----------------------------------------------------------------------------------------
function jsMarginLeft()
{
return jsNumber(document.body.leftMargin);
}
function jsMarginTop()
{
return jsNumber(document.body.topMargin);
}
function jsOffsetLeft(obj, width)
{
var n = width ? obj.offsetWidth : 0;
while (obj.tagName != "BODY")
{
if (obj.tagName != "FORM" && obj.tagName != "TBODY" && obj.tagName != "TR") n += obj.offsetLeft;
obj = obj.parentElement;
}
return n - jsMarginLeft();
}
function jsOffsetTop(obj, height)
{
var n = height ? obj.offsetHeight : 0;
while (obj.tagName != "BODY")
{
if (obj.tagName != "FORM" && obj.tagName != "TBODY" && obj.tagName != "TR") n += obj.offsetTop;
obj = obj.parentElement;
}
return n - jsMarginTop();
}
// ----------------------------------------------------------------------------------------
// --- Drag&Drop
// ----------------------------------------------------------------------------------------
function jsDD_Clear()
{
document.ddmi = -1; // LastID
if (document.dragLine1 != null)
{
document.dragLine1.obj = null;
document.dragLine1.style.display = jsDisplay(false);
}
}
function jsDD_Click(obj)
{
if (document.dragLine1 == null)
{
document.dragLine1 = document.createElement("HR");
document.dragLine1.style.position = "absolute";
document.dragLine1.style.color = "#e7e7e7";
document.dragLine1.style.height = 1;
document.body.insertAdjacentElement("afterBegin", document.dragLine1);
}
document.dragLine1.style.display = jsDisplay(false);
if (document.dragLine1.obj == obj)
{
document.ddmi = -1; // LastID
document.dragLine1.obj = null;
}
else
{
document.ddmi = obj.ItemID;
document.dragLine1.obj = obj;
var margin = 0;
document.dragLine1.style.width = obj.offsetWidth;
if (obj.tagName == "TR")
{
margin = -1;
obj = obj.cells(0);
}
document.dragLine1.style.top = jsMarginTop() + jsOffsetTop(obj) + margin;
document.dragLine1.style.left = jsMarginLeft() + jsOffsetLeft(obj);
document.dragLine1.style.display = jsDisplay(true);
}
}
// ----------------------------------------------------------------------------------------
// --- Holidays
// ----------------------------------------------------------------------------------------
function jsMeasureWorkDays(h1, h2, startdate, enddate)
{
var date1 = new Date(startdate.getFullYear(), startdate.getMonth(), startdate.getDate());
var date2 = new Date(enddate.getFullYear(), enddate.getMonth(), enddate.getDate());
var days = 0;
if (date1 > date2) return 0;
while (date1 <= date2)
{
if (!(date1.getDay() == 0 || date1.getDay() == 6))
{
var inc = 1;
for (var i = 0; i < h1.length; i++)
{
var s = h1[i].split(".");
if (date1.getDate() == s[0] && date1.getMonth() + 1 == s[1] && date1.getFullYear() == s[2])
{
inc = 0;
break;
}
}
if (inc == 1)
for (var i = 0; i < h2.length; i++)
{
var s = h2[i].split(".");
if (date1.getDate() == s[0] && date1.getMonth() + 1 == s[1] && date1.getFullYear() == s[2])
{
inc = 0.5;
break;
}
}
days += inc;
}
date1.setDate(date1.getDate() + 1);
}
// Minutes
var startdate_min = startdate.getHours() * 60 + startdate.getMinutes();
var enddate_min = enddate.getHours() * 60 + enddate.getMinutes();
if (startdate_min != 0 && enddate_min == 0) days -= startdate_min / 1440;
if (startdate_min != 0 && enddate_min != 0) days -= (startdate_min + 1440 - enddate_min) / 1440;
if (startdate_min == 0 && enddate_min != 0) days -= (1440 - enddate_min) / 1440;
if (days < 0) days = 0;
return days;
}
// ----------------------------------------------------------------------------------------
// --- Calendar, DatePicker
// ----------------------------------------------------------------------------------------
function jsFormatCalendar(obj, month)
{
var lastDay = 0;
for (var i = 0; i < obj.rows.length; i++)
for (var l = 0; l < obj.rows(i).cells.length; l++)
{
var o = obj.rows(i).cells(l).childNodes;
for (var n = 0; n < o.length; n++)
{
if (l == 0 && o.item(n).tagName == "A")
{
var day = o.item(n).innerText.length > 2 ? jsNumber(o.item(n).innerText.split(' ')[1]) : jsNumber(o.item(n).innerText);
if (!(i == 1 && day > 20) && day > lastDay) o.item(n).innerText = month + " " + (lastDay = day);
}
if (o.item(n).tagName == "TABLE")
for (var r = 0; r < o.item(n).rows.length; r++)
for (var c = 0; c < o.item(n).rows(r).cells.length; c++)
if (o.item(n).rows(r).cells(c).style.height == "18px")
{
o.item(n).rows(r).cells(c).style.height = o.item(n).rows(r).cells(c).firstChild.style.height = "37px";
o.item(n).rows(r).cells(c).style.paddingLeft = o.item(n).rows(r).cells(c).style.paddingRight = "2px";
}
}
}
}
function jsFormatDatePicker(obj)
{
for (var i = 2; i < obj.rows.length; i++)
for (var l = 0; l < obj.rows(i).cells.length; l++)
{
var o = obj.rows(i).cells(l).childNodes.item(0);
if (o.style.color == "#ff8080")
for (var j = 0; j < s1.length; j++)
if (s1[j] == ZInt(o.innerText) + s)
{
o.title = s2[j];
break;
}
}
}
// ----------------------------------------------------------------------------------------
// --- HeaderTable
// ----------------------------------------------------------------------------------------
function jsHeaderTable_Click(obj, cell, hf, tables, buttonTable, main)
{
var activeCell = jsNumber(hf.value);
if (activeCell != cell) jsDD_Clear();
var im, im0, im1;
// left
if (activeCell == 0) im = imHeader_Left; else im = imHeader_Middle;
obj.rows(0).cells(activeCell*2).firstChild.src = imHeader_1x1.src;
obj.rows(1).cells(activeCell*2).firstChild.src = im.src;
// middle
obj.rows(0).cells(activeCell*2 + 1).firstChild.src = imHeader_1x1.src;
obj.rows(1).cells(activeCell*2 + 1).className = "HeaderTableTD";
// right
if (activeCell == tables.length - 1) im = imHeader_Right; else im = imHeader_Middle;
obj.rows(0).cells(activeCell*2 + 2).firstChild.src = imHeader_1x1.src;
obj.rows(1).cells(activeCell*2 + 2).firstChild.src = im.src;
// button table
if (buttonTable != null)
{
buttonTable.rows(0).cells(activeCell).style.display = jsDisplay(false);
buttonTable.rows(0).cells(cell).style.display = jsDisplay(true);
}
// header table
tables[activeCell].style.display = jsDisplay(false);
tables[cell].style.display = jsDisplay(true);
obj.style.width = "100%";
if (obj.offsetWidth < 592) obj.style.width = 592;
// left
if (cell == 0)
{
im0 = imHeader_Left_Selected_Bar;
im1 = imHeader_Left_Selected;
}
else
{
im0 = imHeader_Middle_RightSelected_Bar;
im1 = imHeader_Middle_RightSelected;
}
obj.rows(0).cells(cell*2).firstChild.src = im0.src;
obj.rows(1).cells(cell*2).firstChild.src = im1.src;
// middle
obj.rows(0).cells(1 + cell*2).firstChild.src = imHeader_Bar.src;
obj.rows(1).cells(1 + cell*2).className = "HeaderTableTD_Selected";
// right
if (cell == tables.length - 1)
{
im0 = imHeader_Right_Selected_Bar;
im1 = imHeader_Right_Selected;
}
else
{
im0 = imHeader_Middle_LeftSelected_Bar;
im1 = imHeader_Middle_LeftSelected;
}
obj.rows(0).cells(cell*2 + 2).firstChild.src = im0.src;
obj.rows(1).cells(cell*2 + 2).firstChild.src = im1.src;
hf.value = cell;
if (main.rows(2).cells.length == 1)
{
var filter = "progid:DXImageTransform.Microsoft.Shadow(direction=135,color=#d0cebf,strength=2)";
for (var i = 0; i < 3; i++)
{
if (i == 0) main.rows(i).cells(0).children(1).style.filter = filter;
else if (i == 1) continue;
else if (i == 2) main.rows(i).cells(0).style.filter = filter;
var im = new Image();
im.src = root + "Images/1x1.gif";
im.width = 2;
im.height = 1;
var td = document.createElement("TD");
main.rows(i).cells(0).insertAdjacentElement("afterEnd", td);
td.insertAdjacentElement("afterBegin", im);
}
for (var i = 3; i < main.rows.length; i++)
if (main.rows(i).cells.length == 1)
{
main.rows(i).cells(0).colSpan = 2;
}
}
jsResizeWindow(main.offsetWidth, main.offsetHeight, 8, 8, 8, 8, false, false);
}
function jsHeaderTable_Over(obj, cell, hf, len)
{
var activeCell = jsNumber(hf.value);
if (cell == activeCell) return;
var im;
// left
if (cell == 0) im = imHeader_Left_Over;
else
{
if (cell - 1 == activeCell) im = imHeader_Middle_LeftSelected_Over;
else im = imHeader_Middle_RightOver;
}
obj.rows(1).cells(cell*2).firstChild.src = im.src;
// middle
obj.rows(1).cells(cell*2 + 1).className = "HeaderTableTD_Over";
// right
if (cell == len - 1) im = imHeader_Right_Over;
else
{
if (cell + 1 == activeCell) im = imHeader_Middle_RightSelected_Over;
else im = imHeader_Middle_LeftOver;
}
obj.rows(1).cells(cell*2 + 2).firstChild.src = im.src;
}
function jsHeaderTable_Out(obj, cell, hf, len)
{
var activeCell = jsNumber(hf.value);
if (cell == activeCell) return;
var im;
// left
if (cell == 0) im = imHeader_Left;
else
{
if (cell - 1 == activeCell) im = imHeader_Middle_LeftSelected;
else im = imHeader_Middle;
}
obj.rows(1).cells(cell*2).firstChild.src = im.src;
// middle
obj.rows(1).cells(cell*2 + 1).className = "HeaderTableTD";
// right
if (cell == len - 1) im = imHeader_Right;
else
{
if (cell + 1 == activeCell) im = imHeader_Middle_RightSelected;
else im = imHeader_Middle;
}
obj.rows(1).cells(cell*2 + 2).firstChild.src = im.src;
}
// ----------------------------------------------------------------------------------------
// --- Numbers in words
// ----------------------------------------------------------------------------------------
var numerals0_cz = new Array("nula", "jedna", "dva", "t" + String.fromCharCode(345) + "i", String.fromCharCode(269) + "ty" + String.fromCharCode(345) + "i", "p" + String.fromCharCode(283) + "t", String.fromCharCode(353) + "est", "sedm", "osm", "dev" + String.fromCharCode(283) + "t", "deset", "jeden" + String.fromCharCode(225) + "ct", "dvan" + String.fromCharCode(225) + "ct", "t" + String.fromCharCode(345) + "in" + String.fromCharCode(225) + "ct", String.fromCharCode(269) + "trn" + String.fromCharCode(225) + "ct", "patn" + String.fromCharCode(225) + "ct", String.fromCharCode(353) + "estn" + String.fromCharCode(225) + "ct", "sedmn" + String.fromCharCode(225) + "ct", "osmn" + String.fromCharCode(225) + "ct", "devaten" + String.fromCharCode(225) + "ct");
var numerals1_cz = new Array("dvacet", "t" + String.fromCharCode(345) + "icet", String.fromCharCode(269) + "ty" + String.fromCharCode(345) + "icet", "pades" + String.fromCharCode(225) + "t", String.fromCharCode(353) + "edes" + String.fromCharCode(225) + "t", "sedmdes" + String.fromCharCode(225) + "t", "osmdes" + String.fromCharCode(225) + "t", "devades" + String.fromCharCode(225) + "t");
var numerals0_en = new Array("zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen");
var numerals1_en = new Array("twenty", "thirty", "fourty", "fifty", "sixty", "seventy", "eighty", "ninety");
var numerals0_de = new Array("null", "ein", "zwei", "drei", "vier", "f" + String.fromCharCode(252) + "nf", "sechs", "sieben", "acht", "neun", "zehn", "elf", "zw" + String.fromCharCode(246) + "lf", "dreizehn", "vierzehn", "f" + String.fromCharCode(252) + "nfzehn", "sechzehn", "siebzehn", "achtzehn", "neunzehn");
var numerals1_de = new Array("zwanzig", "drei" + String.fromCharCode(223) + "ig", "vierzig", "f" + String.fromCharCode(252) + "nfzig", "sechzig", "siebzig", "achtzig", "neunzig");
var numerals0_fr = new Array("z" + String.fromCharCode(233) + "ro", "un", "deux", "trois", "quatre", "cinq", "six", "sept", "huit", "neuf", "dix", "onze", "douze", "treize", "quatorze", "quinze", "seize", "dix-sept", "dix-huit", "dix-neuf");
var numerals1_fr = new Array("vingt", "trente", "quarante", "cinquante", "soixante", "soixante-dix", "quatre-vingts", "quatre-vingt-dix");
function jsNumberInWords(n, language)
{
n = Math.round(Math.abs(jsNumber(n)));
var s = n.toString();
var r = ""; // result
var ch = ""; // char
switch (language)
{
case "cz":
if (n < 20) return numerals0_cz[n];
if (n < 100 && n % 10 == 0) return numerals1_cz[n / 10 - 2];
if (n < 100 && n % 10 != 0) return numerals1_cz[s.substring(0, 1) - 2] + numerals0_cz[s.substring(1, 2)];
n = 0;
for (var i = s.length - 1; i >= 0; i--)
{
n++;
if (n == 2) ch = s.substring(i, i + 2); else ch = s.substring(i, i + 1);
if (ch == 0) continue;
switch (n)
{
case 1: continue;
case 2: r = jsNumberInWords(ch, language) + r; break;
case 3: if (ch == 1) r = "sto" + r; else if (ch == 2) r = "dv" + String.fromCharCode(283) + "st" + String.fromCharCode(283) + r; else if (ch == 3 || ch == 4) r = numerals0_cz[ch] + "sta" + r; else r = numerals0_cz[ch] + "set" + r; break;
case 4: if (s.length > n) continue; else if (ch == 1) r = "jedentis" + String.fromCharCode(237) + "c" + r; else if (ch >= 2 && ch <= 4) r = numerals0_cz[ch] + "tis" + String.fromCharCode(237) + "ce " + r; else r = numerals0_cz[ch] + "tis" + String.fromCharCode(237) + "c" + r; break;
case 5: if (s.length > n) continue; else r = jsNumberInWords(s.substring(i, i + 2), language) + "tis" + String.fromCharCode(237) + "c" + r; break;
case 6: r = jsNumberInWords(s.substring(i, i + 3), language) + "tis" + String.fromCharCode(237) + "c" + r; break;
case 7: if (s.length > n) continue; else if (ch == 1) r = "jedenmili" + String.fromCharCode(243) + "n" + r; else if (ch >= 2 && ch <= 4) r = numerals0_cz[ch] + "mili" + String.fromCharCode(243) + "ny" + r; else r = numerals0_cz[ch] + "mili" + String.fromCharCode(243) + "n" + String.fromCharCode(367) + r; break;
case 8: if (s.length > n) continue; else r = jsNumberInWords(s.substring(i, i + 2), language) + "mili" + String.fromCharCode(243) + "n" + String.fromCharCode(367) + r; break;
case 9: r = jsNumberInWords(s.substring(i, i + 3), language) + "mili" + String.fromCharCode(243) + "n" + String.fromCharCode(367) + r; break;
case 10: if (s.length > n) continue; else if (ch == 1) r = "jednamiliarda" + r; else if (ch >= 2 && ch <= 4) r = numerals0_cz[ch] + "miliardy" + r; else r = numerals0_cz[ch] + "miliard" + r; break;
case 11: if (s.length > n) continue; else r = jsNumberInWords(s.substring(i, i + 2), language) + "miliard" + r; break;
case 12: r = jsNumberInWords(s.substring(i, i + 3), language) + "miliard" + r; break;
}
}
break;
case "en":
if (n < 20) return numerals0_en[n];
if (n < 100 && n % 10 == 0) return numerals1_en[n / 10 - 2];
if (n < 100 && n % 10 != 0) return numerals1_en[s.substring(0, 1) - 2] + " " + numerals0_en[s.substring(1, 2)];
n = 0;
for (var i = s.length - 1; i >= 0; i--)
{
n++;
if (n == 2) ch = s.substring(i, i + 2); else ch = s.substring(i, i + 1);
if (ch == 0) continue;
switch (n)
{
case 1: continue;
case 2: r = "and " + jsNumberInWords(ch, language) + r; break;
case 3: r = numerals0_en[ch] + " hundred " + r; break;
case 4: if (s.length > n) continue; else r = numerals0_en[ch] + " thousand " + r; break;
case 5: if (s.length > n) continue; else r = jsNumberInWords(s.substring(i, i + 2), language) + " thousand " + r; break;
case 6: r = jsNumberInWords(s.substring(i, i + 3), language) + " thousand " + r; break;
case 7: if (s.length > n) continue; else r = numerals0_en[ch] + " million " + r; break;
case 8: if (s.length > n) continue; else r = jsNumberInWords(s.substring(i, i + 2), language) + " million " + r; break;
case 9: r = jsNumberInWords(s.substring(i, i + 3), language) + " million "; break;
case 10: if (s.length > n) continue; else r = numerals0_en[ch] + " miliard " + r; break;
case 11: if (s.length > n) continue; else r = jsNumberInWords(s.substring(i, i + 2), language) + " miliard " + r; break;
case 12: r = jsNumberInWords(s.substring(i, i + 3), language) + " miliard " + r; break;
}
}
if (r.lastIndexOf(" ") == r.length - 1) r = r.substring(0, r.length - 1);
break;
case "de":
if (n < 20) return numerals0_de[n];
if (n < 100 && n % 10 == 0) return numerals1_de[n / 10 - 2];
if (n < 100 && n % 10 != 0) return numerals0_de[s.substring(1, 2)] + "und" + numerals1_de[s.substring(0, 1) - 2];
n = 0;
for (var i = s.length - 1; i >= 0; i--)
{
n++;
if (n == 2) ch = s.substring(i, i + 2); else ch = s.substring(i, i + 1);
if (ch == 0) continue;
switch (n)
{
case 1: continue;
case 2: r = jsNumberInWords(ch, language) + r; break;
case 3: r = numerals0_de[ch] + "hundert" + r; break;
case 4: if (s.length > n) continue; else r = numerals0_de[ch] + "tausend" + r; break;
case 5: if (s.length > n) continue; else r = jsNumberInWords(s.substring(i, i + 2), language) + "tausend" + r; break;
case 6: r = jsNumberInWords(s.substring(i, i + 3), language) + "tausend" + r; break;
case 7: if (s.length > n) continue; else if (ch == 1) r = "einemillion" + r; else r = numerals0_de[ch] + "millionen" + r; break;
case 8: if (s.length > n) continue; else r = jsNumberInWords(s.substring(i, i + 2), language) + "millionen" + r; break;
case 9: r = jsNumberInWords(s.substring(i, i + 3), language) + "millionen" + r; break;
case 10: if (s.length > n) continue; else if (ch == 1) r = "einemilliarde" + r; else r = numerals0_de[ch] + "milliarden" + r; break;
case 11: if (s.length > n) continue; else r = jsNumberInWords(s.substring(i, i + 2), language) + "milliarden" + r; break;
case 12: r = jsNumberInWords(s.substring(i, i + 3), language) + "milliarden" + r; break;
}
}
break;
case "fr":
if (n < 20) return numerals0_fr[n];
if (n < 100 && n % 10 == 0) return numerals1_fr[n / 10 - 2];
if (n < 100 && n % 10 != 0)
{
if (s.substring(1, 2) == 1) return numerals1_fr[s.substring(0, 1) - 2] + "-et-un";
else return numerals1_fr[s.substring(0, 1) - 2] + "-" + numerals0_fr[s.substring(1, 2)];
}
n = 0;
for (var i = s.length - 1; i >= 0; i--)
{
n++;
if (n == 2) ch = s.substring(i, i + 2); else ch = s.substring(i, i + 1);
if (ch == 0) continue;
switch (n)
{
case 1: continue;
case 2: r = jsNumberInWords(ch, language) + r; break;
case 3: if (ch == 1) r = "cent " + r; else r = numerals0_fr[ch] + " cents " + r; break;
case 4: if (s.length > n) continue; else if (ch == 1) r = "un mille " + r; else r = numerals0_fr[ch] + " milles " + r; break;
case 5: if (s.length > n) continue; else r = jsNumberInWords(s.substring(i, i + 2), language) + " milles " + r; break;
case 6: r = jsNumberInWords(s.substring(i, i + 3), language) + " milles " + r; break;
case 7: if (s.length > n) continue; else if (ch == 1) r = "un million " + r; else r = numerals0_fr[ch] + " millions " + r; break;
case 8: if (s.length > n) continue; else r = jsNumberInWords(s.substring(i, i + 2), language) + " millions " + r; break;
case 9: r = jsNumberInWords(s.substring(i, i + 3), language) + " millions " + r; break;
case 10: if (s.length > n) continue; else if (ch == 1) r = "un milliard " + r; else r = numerals0_fr[ch] + " milliards " + r; break;
case 11: if (s.length > n) continue; else r = jsNumberInWords(s.substring(i, i + 2), language) + " milliards " + r; break;
case 12: r = jsNumberInWords(s.substring(i, i + 3), language) + " milliards " + r; break;
}
}
if (r.lastIndexOf(" ") == r.length - 1) r = r.substring(0, r.length - 1);
r = r.replace("milles ", "mille ");
break;
}
return r;
}
// ----------------------------------------------------------------------------------------
// --- Filter
// ----------------------------------------------------------------------------------------
function jsInitFilter(ddl)
{
for (var i = ddl.options.length - 2; i < ddl.options.length; i++)
if (ddl.options(i).value == "-1" || ddl.options(i).value == "-2")
{
ddl.options(i).style.backgroundColor = "#f7f7f7";
}
}
function jsFilter(ddl, query, cid, gcid)
{
var sv = ddl_SelectedItem_Value(ddl);
if (sv == "-1" || sv == "-2")
{
ddl.selectedIndex = ddl.selectedIndex_;
ddl.blur();
if (sv == "-1") jsOpen(root + "Multiselect.aspx?query=" + query + "&id=" + cid + "&gcid=" + gcid);
else jsOpen(root + "Form2.aspx?id=" + cid + "&hfCCh_ID=" + ddl.hfCCh_ID + "&hfCCh_Value=" + ddl.hfCCh_Value + "&btCCh=" + ddl.btCCh);
return true;
}
else if (ddl.selectedIndex_ == ddl.selectedIndex) return true; // Searching in ddl...
else return false;
}
// ----------------------------------------------------------------------------------------
// --- Tables, Controls
// ----------------------------------------------------------------------------------------
function jsParentRow(obj, index)
{
var n = 0;
while (obj.tagName != "BODY")
{
obj = obj.parentElement;
if (obj.tagName == "TR")
{
if (index != null && n != index) { n++; continue; }
return obj;
}
}
return null;
}
function jsExtendTables(tables)
{
var max = 0;
for (var i = 0; i < tables.length; i++) if (document.all.item(tables[i]).offsetWidth > max) max = document.all.item(tables[i]).offsetWidth;
for (var i = 0; i < tables.length; i++) document.all.item(tables[i]).width = max;
}
function jsEnableControls(controls)
{
for (var i = 0; i < controls.length; i++)
try { document.forms[0].item(controls[i]).disabled = false; }
catch (e) {}
}
// ----------------------------------------------------------------------------------------
// --- ActiveX
// ----------------------------------------------------------------------------------------
function jsReplace(s, s1, s2)
{
var n = 0;
while ((n = s.indexOf(s1, n)) != -1)
{
s = s.substring(0, n) + s2 + s.substring(n + s1.length, s.length);
n += s2.length;
}
return s;
}
function jsEncodeUrl(url)
{
return jsReplace(encodeURI(url), "+", "%2B");
}
function jsFullAppPath(shell, filename)
{
var s = null;
if (filename == "mspaint.exe" || filename == "notepad.exe") s = filename;
else
{
try { s = shell.RegRead("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\" + filename + "\\"); }
catch (e)
{
try { s = shell.RegRead("HKCR\\Applications\\" + filename + "\\shell\\open\\command\\"); }
catch (e)
{
s = shell.RegRead("HKCR\\Applications\\" + filename + "\\shell\\edit\\command\\");
}
}
if (s.substring(0, 1) == '"') s = s.substring(1, s.indexOf('"', 1));
else s = s.split(" ")[0];
}
return s;
}
function jsOpenActiveX(url, size, link, error, error2)
{
url = link.href.substring(0, link.href.indexOf("/Temp/") + 6) + url;
var n = url.lastIndexOf(".");
var extension = n == -1 ? "" : url.substring(n, url.length);
// WScript.Shell
try { var shell = new ActiveXObject("WScript.Shell"); }
catch (e)
{
alert(error, "info");
window.close();
return;
}
// Associate application
var mru, key = null, app = null;
try
{
key = shell.RegRead("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\" + extension + "\\Application").toLowerCase();
app = jsFullAppPath(shell, key);
}
catch (e)
{
try
{
mru = shell.RegRead("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\" + extension + "\\OpenWithList\\MRUList");
for (var i = 0; i < mru.length; i++)
{
key = shell.RegRead("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\" + extension + "\\OpenWithList\\" + mru.substring(i, i + 1)).toLowerCase();
if (key != "iexplore.exe" && key.indexOf(".exe") > 0)
try
{
app = jsFullAppPath(shell, key);
break;
}
catch (e) {}
}
}
catch (e) {}
}
if (app == null)
{
shell = null;
link.click();
return;
}
else
{
try
{
var ta = document.createElement("TEXTAREA");
ta.innerText = url;
ta.createTextRange().execCommand("Copy");
switch (key)
{
case "winword.exe": app = new ActiveXObject("Word.Application"); app.Visible = true; shell.AppActivate(app.Caption); if (size != 0) app.Documents.Open(url); else { app.Documents.Add(); app.ActiveDocument.SaveAs(url); } break;
case "excel.exe": app = new ActiveXObject("Excel.Application"); app.Visible = true; shell.AppActivate(app.Caption); if (size != 0) app.Workbooks.Open(url); else { app.Workbooks.Add(); app.ActiveWorkbook.SaveAs(url); } break;
case "acad.exe": app = new ActiveXObject("AutoCAD.Application"); app.Visible = true; shell.AppActivate(app.Caption); if (size != 0) app.Documents.Open(url); else { app.Documents.Add(); app.ActiveDocument.SaveAs(url); } break;
case "photoshp.exe": app = new ActiveXObject("Photoshop.Application"); app.Visible = true; shell.AppActivate(app.Caption); if (size != 0) app.Open(url); else { app.Documents.Add(4, 4); app.ActiveDocument.SaveAs(url); } break;
default:
{
var exec = shell.Exec(app);
alert(error2, "info", true);
url = jsReplace(url, "}", "NGBRACKET");
url = jsReplace(url, "{", "{{}");
url = jsReplace(url, "NGBRACKET", "{}}");
url = jsReplace(url, "(", "{(}");
url = jsReplace(url, ")", "{)}");
url = jsReplace(url, "+", "{+}");
url = jsReplace(url, "^", "{^}");
url = jsReplace(url, "%", "{%}");
url = jsReplace(url, "~", "{~}");
if (shell.AppActivate(exec.ProcessID))
{
shell.SendKeys("^o" + url);
if (key != "psp.exe") shell.SendKeys("{ENTER}");
}
exec = shell = app = null;
window.close();
break;
}
}
}
catch (e) { alert(e); }
if (app != null)
{
app = shell = null;
window.close();
}
}
}
// ----------------------------------------------------------------------------------------
// --- Picker
// ----------------------------------------------------------------------------------------
function jsPicker_ClientID(dbname, ids)
{
for (var i = 0; i < ids.length; i++)
{
var s = ids[i].split(":");
if (s[0] == dbname) return s[1];
}
}
function jsPicker_Filter(hfIDs, dbnames, types, ddls)
{
var ids = hfIDs.value.split(";");
for (var i = 0; i < dbnames.length; i++)
{
var clientID = jsPicker_ClientID(dbnames[i], ids);
var s = "";
switch (types[i])
{
case "TextBox":
try { s = opener.document.forms[0][clientID].value; }
catch (e) {}
break;
case "ComboBox":
try { s = ddl_SelectedItem_Value(opener.document.forms[0][clientID]); }
catch (e)
{
try { s = opener.document.forms[0][clientID].value; }
catch (e) {}
}
break;
case "ListBox":
try { s = ddl_SelectedItem_Value(opener.document.forms[0][clientID]); }
catch (e) {}
break;
case "Radio":
try { s = rbl_SelectedItem_Value(opener.document.forms[0][clientID]); }
catch (e) {}
break;
}
if (s != "") ddl_SelectText_NoChange(document.forms[0][ddls[i]], s);
}
}