Blame | Last modification | View Log | RSS feed
var AktDocument = 0;
function DetectBrowser ()
{
var browsername = navigator.appName;
if (browsername.indexOf("Microsoft") != -1)
{
browser = "MSIE";
}
else
{
browser = "Other";
}
return browser;
}
function MoveTo (url, pars)
{
if (pars.length > 0)
{
window.location = url + "?" + pars;
}
else
{
window.location = url;
}
}
function SetValue(target, val)
{
ziel = eval(target);
ziel.value = val;
}
function KeyEvent(formular)
{
if (DetectBrowser() == "MSIE")
{
if (window.Event.keyCode == 13)
formular.submit();
}
else
{
if (window.Event.which == 13)
formular.submit();
}
}
function Tastendruck(Ereignis)
{
if (!Ereignis)
Ereignis = window.event;
if (Ereignis.keyCode == 13 && AktDocument != 0)
AktDocument.submit();
}
function SetDate(duration, datum, target)
{
sarr = datum.value.split(".");
day = sarr[0];
mon = sarr[1];
year = sarr[2];
d = new Date(year, mon-1, day);
dsec = d.getTime() + (duration * 86400000);
dt = new Date(dsec);
day = dt.getDate();
mon = dt.getMonth() + 1;
year = dt.getFullYear();
target.value = day + "." + mon + "." + year;
}
function SetDuration(dtstart, dtend, target)
{
dsarr = dtstart.value.split(".");
sday = dsarr[0];
smon = dsarr[1];
syear = dsarr[2];
ds = new Date(syear, smon-1, sday);
dearr = dtend.split(".");
eday = dearr[0];
emon = dearr[1];
eyear = dearr[2];
de = new Date(eyear, emon-1, eday);
ssec = ds.getTime() / 1000;
esec = de.getTime() / 1000;
diff = (esec - ssec) / 86400;
target.value = diff;
}
function CheckDateOrder(dtstart, dtend)
{
dsarr = dtstart.value.split(".");
sday = dsarr[0];
smon = dsarr[1];
syear = dsarr[2];
ds = new Date(syear, smon-1, sday);
dearr = dtend.value.split(".");
eday = dearr[0];
emon = dearr[1];
eyear = dearr[2];
de = new Date(eyear, emon-1, eday);
ssec = ds.getTime();
esec = de.getTime();
if (ssec > esec)
{
alert("Das Startdatum muss kleiner als das Endedatum sein!");
dtstart.focus();
return false;
}
return true;
}
function CheckDate(datum, light)
{
dsarr = datum.value.split(".");
if (light)
{
day = 1;
mon = dsarr[0];
year = dsarr[1];
}
else
{
day = dsarr[0];
mon = dsarr[1];
year = dsarr[2];
}
dat = new Date(year, mon-1, day);
cday = dat.getDate();
cmon = dat.getMonth() + 1;
cyear = dat.getFullYear();
if (cday != day || cmon != mon || cyear != year)
{
alert("Ungültiges Datum!");
datum.focus();
return false;
}
return true;
}
function CheckTime(zeit)
{
var hour = 0;
var min = 0;
zarr = zeit.value.split(":");
hour = zarr[0];
min = zarr[1];
if (hour < 0 || hour > 23 || min < 0 || min > 59)
{
alert("Ungültige Uhrzeit!");
zeit.focus();
return false;
}
return true;
}
function CheckOverload(val, ist_hours, max_hours)
{
var wert = val.value;
wert = wert.replace(/,/, ".");
if (ist_hours >= max_hours)
{
alert("Diese Ressource ist bereits mit "+ist_hours+" PT's von maximal "+max_hours+" überbucht!");
val.focus();
return false;
}
rest = max_hours - ist_hours;
if (wert > rest)
{
zuviel = wert - rest;
alert("Diese Ressource ist mit "+zuviel+" PT's von maximal "+max_hours+" überbucht!");
val.focus();
return false;
}
return true;
}
function dx(d)
{
var z = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");
var x = "";
var i = 1, v = d, r = 0;
max = Math.pow(16,8);
hex = "";
if(d > max)
{
hex = "NIL";
return hex;
}
if(d < 0)
{
hex = "NIL";
return hex;
}
while(v > 15)
{
v = Math.floor(v / 16);
i++;
}
v = d;
for(j = i; j >= 1; j--)
{
x = x + z[Math.floor(v / Math.pow(16,j-1))];
v = v - (Math.floor(v / Math.pow(16,j-1)) * Math.pow(16,j-1));
}
hex = x;
if (hex.length < 2)
{
hex = "0"+hex;
}
return hex;
}
function Farbe(R,G,B,target)
{
var Rx = dx(R);
var Gx = dx(G);
var Bx = dx(B);
var color = Rx+Gx+Bx;
SetValue(target, color);
}
function NumRange(num, low, high)
{
var zahl = num.value;
if (zahl < low || zahl > high)
{
alert("Eingegebener Wert ist außerhalb des gültigen Bereichs!");
num.focus();
return false;
}
return true;
}
function FormatNum(num, komma)
{
var vork = parseInt(num);
var nachk = 0;
var str = "";
if ((num > 0.0 || num < 0.0) && vork != num)
nachk = parseInt((num - vork) * Math.pow(10, komma));
else if (vork == num)
{
str = String(vork) + ",";
i = 0;
while (i < komma)
{
str = str + "0";
i++;
}
return str;
}
else if (num == 0.0)
{
str = "0,";
i = 0;
while (i < komma)
{
str = str + "0";
i++;
}
return str;
}
str = String(vork) + "," + String(nachk);
return str;
}
function CheckTrue(b)
{
if (b == "true" || b == "t" || b == true || b == 1)
return true;
return false;
}
function open_window(mypage, myname, w, h)
{
var winl = screen.width;
var wint = screen.height;
var menubar = 'yes';
var browser = DetectBrowser();
if (winl < w)
winl = 0;
else
winl = (winl - w) / 2;
if (wint < h)
wint = 0;
else
wint = (wint - h) / 2;
if (browser == 'MSIE')
menubar = 'no';
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizeable=yes,menubar='+menubar+',dependent=yes';
win = window.open(mypage,myname,winprops);
if (parseInt(navigator.appVersion) >= 4)
{
win.window.focus();
}
}
function open_mwindow(mypage, myname, w, h)
{
var winl = screen.width;
var wint = screen.height;
var menubar = 'yes';
var browser = DetectBrowser();
if (winl < w)
winl = 0;
else
winl = (winl - w) / 2;
if (wint < h)
wint = 0;
else
wint = (wint - h) / 2;
if (browser == 'MSIE')
menubar = 'no';
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizeable=yes,menubar='+menubar+',dependent=yes';
win = window.open(mypage,myname,winprops);
if (parseInt(navigator.appVersion) >= 4)
{
win.window.focus();
}
win.window.print();
}