//drag drop Fuktion für Netscape 4////
/////////////////////////////////
var dragswitch=0
var nsx
var nsy
var nstemp

function drag_dropns (name){
        temp=eval(name)
        temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
        temp.onmousedown=gons
        temp.onmousemove=dragns
        temp.onmouseup=stopns
}

function gons(e){
        temp.captureEvents(Event.MOUSEMOVE)
        nsx=e.x
        nsy=e.y
}

function dragns(e){
        if (dragswitch==1) {
                temp.moveBy(e.x-nsx,e.y-nsy)
                return false
        }
}

function stopns(){
        temp.releaseEvents(Event.MOUSEMOVE)
}

//drag drop Funktion für Internet Explorer 4+////
/////////////////////////////////
// nicht mehr verwendet
var dragapproved=false

function drag_dropie() {
        if (dragapproved==true) {
                theBox.style.pixelLeft=tempx+window.event.clientX-iex
                theBox.style.pixelTop=tempy+window.event.clientY-iey
                return false
        }
}

function initializedrag(box) {
        iex=window.event.clientX
        iey=window.event.clientY
        tempx=box.style.pixelLeft
        tempy=box.style.pixelTop
        dragapproved=true
        theBox = box
        document.onmousemove=drag_dropie
}


if (document.all){
        document.onmouseup=new Function("dragapproved=false")
}

//drag drop function for IE 4+ and NS6////
/////////////////////////////////
function drag_drop(e){
if (MS&&dragapproved){
crossobj.style.left=tempx+window.event.clientX-offsetx
crossobj.style.top=tempy+window.event.clientY-offsety
}
else if (MS!=true&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx
crossobj.style.top=tempy+e.clientY-offsety
}
return false
}

function initializedragtmp(e){
offsetx=MS? event.clientX : e.clientX
offsety=MS? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}

document.onmouseup=new Function("dragapproved=false")

//aktionen////
/////////////////////////////////
function toggleBoxTopMenu (box, aid, sid, docid, folderName, pathprefix, dirItemType) {
        if (DOM || MS) {
				var objBox = getElem("Id", box, null)

                if (objBox.style.display != "block") {
					if (MS || OP) {
						objBox.style.left=window.event.clientX - 160;
						objBox.style.top=window.event.clientY - 40;
					}
					else {
						//objBox.style.left=event.screenX - 160;
						//objBox.style.top=event.screenY - 40;
						objBox.style.left=40;
						objBox.style.top=40;
					}
                }

				setCont("Id", "topm_title", null, folderName);

				var aid_sid = "&appl_AID=" + aid + "&subsys_SID=" + sid;

				if (getElem("Id", "topm_paste", null)) {
						href = pathprefix + "/boxalino/client/appl_docustore/default.htm?docustore_cmd_paste=1&docustore_dir_oid=" + docid + "&client_request_sendMsg=pasteFolderOrFile" + aid_sid;
						getElem("Id", "topm_paste", null).href = href;
						getElem("Id", "topm_paste_img", null).href = href;
				}

				href = pathprefix + "/boxalino/client/appl_docustore/upload.htm?docustore_dir_oid=" + docid + aid_sid;
				getElem("Id", "topm_fileUpload", null).href = href;
				getElem("Id", "topm_fileUpload_img", null).href = href;

				href = pathprefix + "/boxalino/client/appl_docustore/dirnew.htm?docustore_dir_oid=" + docid + aid_sid;
				getElem("Id", "topm_newDir", null).href = href;
				getElem("Id", "topm_newDir_img", null).href = href;

				hidebox (box, ""); // um z-index zu erzwingen - nur in nn
				getElem("Id", "file_menu", null).style.zindex = 1000
				getElem("Id", "folder_menu", null).style.zindex = 1000
				objBox.style.zindex = 1001
				showbox (box);
        }
		else window.alert("Verwendeter Browser kann gewünschte Aktion nicht durchführen.\nBitte verwenden Sie einen aktuellen Browser!\n\nYour browser can not handle the desired action.\nPlease upgrade to a current browser!")
}

function toggleBoxFolderMenu (box, aid, sid, docid, folderName, pathprefix, dirItemType) {
        if (DOM || MS) {
				var objBox = getElem("Id", box, null)

                if (objBox.style.display != "block") {
					if (MS || OP) {
						objBox.style.left=window.event.clientX - 160;
						objBox.style.top=window.event.clientY - 40;
					}
					else {
						//objBox.style.left=event.screenX - 160;
						//objBox.style.top=event.screenY - 40;
						objBox.style.left=40;
						objBox.style.top=40;
					}
                }

				setCont("Id", "folderm_title", null, folderName);

				var aid_sid = "&appl_AID=" + aid + "&subsys_SID=" + sid;

				var href = pathprefix + "/boxalino/client/appl_docustore/default.htm?docustore_cmd_copy=1&docustore_dir_oid=" + docid + "&client_session_docustoreCopyType=F" + "&client_session_docustoreCopyName=" + encodeURIComponent(folderName) + "&client_request_sendMsg=copyF" + aid_sid;
				getElem("Id", "folderm_copy", null).href = href;
				getElem("Id", "folderm_copy_img", null).href = href;

				href = pathprefix + "/boxalino/client/appl_docustore/rename.htm?docustore_dir_oid=" + docid + aid_sid + "&client_request_entrytype=" + dirItemType;
				getElem("Id", "folderm_rename", null).href = href;
				getElem("Id", "folderm_rename_img", null).href = href;

				href = pathprefix + "/boxalino/client/appl_docustore/default.htm?docustore_cmd_delete=1&docustore_dir_oid=" + docid + "&client_request_folderName=" + encodeURIComponent(folderName) + "&client_request_sendMsg=deleteFolder" + aid_sid;
				getElem("Id", "folderm_delete", null).href = href;
				getElem("Id", "folderm_delete_img", null).href = href;

				if (getElem("Id", "folderm_paste", null)) {
						href = pathprefix + "/boxalino/client/appl_docustore/default.htm?docustore_cmd_paste=1&docustore_dir_oid=" + docid + "&client_request_sendMsg=pasteFolderOrFile" + aid_sid;
						getElem("Id", "folderm_paste", null).href = href;
						getElem("Id", "folderm_paste_img", null).href = href;
				}

				href = pathprefix + "/boxalino/client/appl_docustore/upload.htm?docustore_dir_oid=" + docid + aid_sid;
				getElem("Id", "folderm_fileUpload", null).href = href;
				getElem("Id", "folderm_fileUpload_img", null).href = href;

				href = pathprefix + "/boxalino/client/appl_docustore/dirnew.htm?docustore_dir_oid=" + docid + aid_sid;
				getElem("Id", "folderm_newDir", null).href = href;
				getElem("Id", "folderm_newDir_img", null).href = href;

				hidebox (box, ""); // um z-index zu erzwingen - nur in nn
				getElem("Id", "top_menu", null).style.zindex = 1000
				getElem("Id", "file_menu", null).style.zindex = 1000
				objBox.style.zindex = 1001
				showbox (box);
        }
		else window.alert("Verwendeter Browser kann gewünschte Aktion nicht durchführen.\nBitte verwenden Sie einen aktuellen Browser!\n\nYour browser can not handle the desired action.\nPlease upgrade to a current browser!")
}

function toggleBoxFileMenu (box, aid, sid, docid, fileName, user, lockedBy, pathprefix, dirItemType) {
        if (DOM || MS) {
				var objBox = getElem("Id", box, null)

                if (objBox.style.display != "block") {
					if (MS || OP) {
						objBox.style.left=window.event.clientX - 160;
						objBox.style.top=window.event.clientY - 40;
					}
					else {
						//objBox.style.left=event.screenX - 160;
						//objBox.style.top=event.screenY - 40;
						objBox.style.left=60;
						objBox.style.top=60;
					}
                }

				setCont("Id", "filem_title", null, fileName);

				var aid_sid = "&appl_AID=" + aid + "&subsys_SID=" + sid;

				var href = pathprefix + "/boxalino/client/appl_docustore/default.htm?docustore_cmd_fileDownload=1&docustore_dir_oid=" + docid + aid_sid;
				getElem("Id", "filem_fileDownload", null).href = href;
				getElem("Id", "filem_fileDownload_img", null).href = href;

				href = pathprefix + "/boxalino/client/appl_docustore/default.htm?docustore_cmd_checkOut=1&docustore_dir_oid=" + docid + aid_sid;
				getElem("Id", "filem_checkOut", null).href = href;
				getElem("Id", "filem_checkOut_img", null).href = href;

				href = pathprefix + "/boxalino/client/appl_docustore/checkin.htm?docustore_dir_oid=" + docid + aid_sid;
				getElem("Id", "filem_checkIn", null).href = href;
				getElem("Id", "filem_checkIn_img", null).href = href;

				href = pathprefix + "/boxalino/client/appl_docustore/default.htm?docustore_cmd_copy=1&docustore_dir_oid=" + docid + "&client_session_docustoreCopyType=D" + "&client_session_docustoreCopyName=" + encodeURIComponent(fileName) + "&client_request_sendMsg=copyD" + aid_sid;
				getElem("Id", "filem_copy", null).href = href;
				getElem("Id", "filem_copy_img", null).href = href;

				href = pathprefix + "/boxalino/client/appl_docustore/rename.htm?docustore_dir_oid=" + docid + aid_sid + "&client_request_entrytype=" + dirItemType;
				getElem("Id", "filem_rename", null).href = href;
				getElem("Id", "filem_rename_img", null).href = href;

				href = pathprefix + "/boxalino/client/appl_docustore/default.htm?docustore_cmd_delete=1&docustore_dir_oid=" + docid + "&client_request_fileName=" + encodeURIComponent(fileName) + "&client_request_sendMsg=deleteFile" + aid_sid;
				getElem("Id", "filem_delete", null).href = href;
				getElem("Id", "filem_delete_img", null).href = href;

				getElem("Id", "filem_fileDownload_row_active", null).style.display="block";
				getElem("Id", "filem_copy_row_active", null).style.display="block";
				getElem("Id", "filem_delete_row_active", null).style.display="block";
				
				if (lockedBy == "") {
						getElem("Id", "filem_checkOut_row_active", null).style.display="block";
						getElem("Id", "filem_checkOut_row_inactive", null).style.display="none";

						getElem("Id", "filem_checkIn_row_active", null).style.display="none";
						getElem("Id", "filem_checkIn_row_inactive", null).style.display="block";
						
						getElem("Id", "filem_rename_row_active", null).style.display="block";
						getElem("Id", "filem_rename_row_inactive", null).style.display="none";
				}
				else if (lockedBy == user) {
						getElem("Id", "filem_checkOut_row_active", null).style.display="none";
						getElem("Id", "filem_checkOut_row_inactive", null).style.display="block";

						getElem("Id", "filem_checkIn_row_active", null).style.display="block";
						getElem("Id", "filem_checkIn_row_inactive", null).style.display="none";
						
						getElem("Id", "filem_rename_row_active", null).style.display="block";
						getElem("Id", "filem_rename_row_inactive", null).style.display="none";
				}
				else {
						getElem("Id", "filem_checkOut_row_active", null).style.display="none";
						getElem("Id", "filem_checkOut_row_inactive", null).style.display="block";

						getElem("Id", "filem_checkIn_row_active", null).style.display="none";
						getElem("Id", "filem_checkIn_row_inactive", null).style.display="block";
						
						getElem("Id", "filem_rename_row_active", null).style.display="none";
						getElem("Id", "filem_rename_row_inactive", null).style.display="block";
				}

				hidebox (box, ""); // um z-index zu erzwingen - nur in nn
				if (getElem("Id", "folder_menu", null) != null) {
					getElem("Id", "top_menu", null).style.zindex = 1000
					getElem("Id", "folder_menu", null).style.zindex = 1000;
					objBox.style.zindex = 1001;
				}
				showbox (box);
        }
		else window.alert("Verwendeter Browser kann gewünschte Aktion nicht durchführen.\nBitte verwenden Sie einen aktuellen Browser!\n\nYour browser can not handle the desired action.\nPlease upgrade to a current browser!");
}


//boxen öffnen und schliessen////
/////////////////////////////////
function showbox (box) {
        if (DOM || MS)
            getElem("Id", box, null).style.display="block";
}


function showbox2 (box, x, y) {
        if (DOM || MS)
            getElem("Id", box, null).style.display="block"
            getElem("Id", box, null).style.left=x;
            getElem("Id", box, null).style.top=y;
}

function hidebox (box, href) {
        if (DOM || MS)
            getElem("Id", box, null).style.display="none";
        if (href != "")
           window.location.href = href;
}



var dragapproved2=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all
var box

function iecompattest(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function drag_drop2(e){
if (ie5&&dragapproved2&&event.button==1){
document.getElementById(box).style.left=tempx+event.clientX-offsetx+"px"
document.getElementById(box).style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved2){
document.getElementById(box).style.left=tempx+e.clientX-offsetx+"px"
document.getElementById(box).style.top=tempy+e.clientY-offsety+"px"
}
}

function initializedrag2(e, _box){

offsetx=ie5? event.clientX : e.clientX
offsety=ie5? event.clientY : e.clientY
document.getElementById("dwindowcontent_"+_box).style.display="none" //extra
tempx=parseInt(document.getElementById(_box).style.left)
tempy=parseInt(document.getElementById(_box).style.top)

dragapproved2=true
box = _box
document.getElementById(box).onmousemove=drag_drop2
}

function stopdrag(box){
dragapproved2=false;
document.getElementById(box).onmousemove=null;
document.getElementById("dwindowcontent_"+box).style.display="" //extra
}

/*function loadwindow(url,box,width,height){
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById(box).style.display=''
document.getElementById(box).style.width=initialwidth=width+"px"
document.getElementById(box).style.height=initialheight=height+"px"
document.getElementById(box).style.left="30px"
document.getElementById(box).style.top=ns6? window.pageYOffset*1+30+"px" : iecompattest().scrollTop*1+30+"px"
//document.getElementById("cframe_"+box).src=url
}
}

function maximize(box){
if (minrestore==0){
minrestore=1 //maximize window
document.getElementById("maxname_"+box).setAttribute("src","/boxalino/client/images/restore.gif")
document.getElementById(box).style.width=ns6? window.innerWidth-20+"px" : iecompattest().clientWidth+"px"
document.getElementById(box).style.height=ns6? window.innerHeight-20+"px" : iecompattest().clientHeight+"px"
}
else{
minrestore=0 //restore window
document.getElementById("maxname_"+box).setAttribute("src","/boxalino/client/images/max.gif")
document.getElementById(box).style.width=initialwidth
document.getElementById(box).style.height=initialheight
}
document.getElementById(box).style.left=ns6? window.pageXOffset+"px" : iecompattest().scrollLeft+"px"
document.getElementById(box).style.top=ns6? window.pageYOffset+"px" : iecompattest().scrollTop+"px"
}

function closeit(box){
document.getElementById(box).style.display="none"
}*/



