function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=0,width=500,height=500,left = 365,top = 262');");
}


function hasOptions(obj) {
if (obj!=null && obj.options!=null) { return true; }
return false;
}

function sortSelect(obj) {
var o = new Array();
if (!hasOptions(obj)) { return; }
for (var i=0; i<obj.options.length; i++) {
o[o.length] = new Option( obj.options[i].text, obj.options[i].value, obj.options[i].defaultSelected, obj.options[i].selected) ;
}
if (o.length==0) { return; }
o = o.sort( 
function(a,b) { 
if ((a.text+"") < (b.text+"")) { return -1; }
if ((a.text+"") > (b.text+"")) { return 1; }
return 0;
} 
);

for (var i=0; i<o.length; i++) {
obj.options[i] = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
}
}

function copySelectedOptions(from,to) {
var options = new Object();
if (hasOptions(to)) {
for (var i=0; i<to.options.length; i++) {
options[to.options[i].value] = to.options[i].text;
}
}
if (!hasOptions(from)) { return; }
for (var i=0; i<from.options.length; i++) {
var o = from.options[i];
if (o.selected) {
if (options[o.value] == null || options[o.value] == "undefined" || options[o.value]!=o.text) {
if (!hasOptions(to)) { var index = 0; } else { var index=to.options.length; }
to.options[index] = new Option( o.text, o.value, false, false);
}
}
}
if ((arguments.length<3) || (arguments[2]==true)) {
sortSelect(to);
}
from.selectedIndex = -1;
to.selectedIndex = -1;
}


function OpenNewWindow(picture, width, height) {
xsize = width + 35; 
ysize = height + 50;
ScreenWidth = screen.width;
ScreenHeight = screen.height;

xpos = (ScreenWidth / 2) - (xsize / 2);
ypos = (ScreenHeight / 2) - (ysize / 2);

Bildpopup = window.open("","picture","height=" + ysize + ",width=" + xsize + ",scrollbars=no,resizeable=no,toolbar=no,menubar=no ,location=no,top=" + ypos + ",left=" + xpos);
Bildpopup.document.write("<html><head><title>Bildansicht</title></head>");
Bildpopup.document.write("<body bgcolor='#ffffff' onload='focus();'>");
Bildpopup.document.write("<table align='center' border='0'><tr>");
Bildpopup.document.write("<td align='center' valign='top'>");
Bildpopup.document.write("<img src='" + picture + "' border='1' onClick='self.close()'>");
Bildpopup.document.write("</td></tr><tr>");
Bildpopup.document.write("<td align='center' valign='bottom'>");
Bildpopup.document.write("<input type='button' value='schliessen' style='font-family: Verdana; font-size: 10px' onClick='self.close()'>");
Bildpopup.document.write("</td></tr></table>");
Bildpopup.document.write("</body></html>");
Bildpopup.document.close();
}

