	/*------------------------------------*/
	//------ © 2001 release it GmbH ------//
	/*------------------------------------*/

	tDoc=document;

	/*function DoRightMButton() {
		if (event.button==2)
			alert("dies is rechte mousebutton")
	}
	document.onmousedown=DoRightMButton*/

	function DoFileSrch(){
		alert("coming soon")
	}

	function DoResetF(){
		fFile.reset();
	}

	function FileHelp(url){
		NewWindow2("help/"+url+".php?SID="+SID,685,500,"file_hilfe","yes","yes");
	}

	function ShowFile(aFID){
		if(sBrowserWarning!="no warning"){
			if(confirm(sBrowserWarning))
				NewWindow3("http://www.microsoft.com/windows/ie/default.asp",800,600,"MSIEUpdate","yes","yes","yes","yes","yes")

			return;
		}

		NewWindow3("",640,480,"winShowFile","yes","yes","yes","no","yes");

		tDoc.fFile.action="getfile.php?idF="+aFID;
		tDoc.fFile.target="winShowFile";
		tDoc.fFile.submit();
	}

	function RefreshView(){
		tDoc.fFile.doRefresh.value=0;
		tDoc.fFile.taPath.value="";
		tDoc.fFile.act.value="";
		tDoc.fFile.target="_self";
		tDoc.fFile.action=SelfURL;
		tDoc.fFile.submit();
	}

	function CRoot(iLimit) {
		tDoc.fFile.lim.value=iLimit;
		tDoc.fFile.selID.value=iLimit;
		tDoc.fFile.taPath.value="";
		tDoc.fFile.act.value="";
		tDoc.fFile.target="_self";
		tDoc.fFile.action=SelfURL;
		tDoc.fFile.submit();
	}

	function DoAct(iID,iAction) {
		tDoc.fFile.lim.value=startID;
		tDoc.fFile.selID.value=iID;
		tDoc.fFile.taPath.value="";
		tDoc.fFile.act.value=iAction;
		tDoc.fFile.target="_self";
		tDoc.fFile.action=SelfURL;
		tDoc.fFile.submit();
	}

	function DoEdit(iID) {
		if (iID>0) {
			NewWindow('files_mod.php?SID='+SID+'&FID='+iID, 450, 600, 'modfile', 'yes');
		}
	}

	function changeImages() {
		for(var i=0;i<changeImages.arguments.length;i+=2)
			tDoc[changeImages.arguments[i]].src = changeImages.arguments[i+1];
	}

	function chngImg(url) {
		changeImages('filesimg', url);
		return true;
	}

	function ChngSaveButton() {
		tDoc.images.imgSave.src="img/save_w.gif";
	}

	function JTF(upID){
		tDoc.fFile.lim.value=upID;
		tDoc.fFile.selID.value=upID;
		tDoc.fFile.act.value="";
		tDoc.fFile.taPath.value="";
		tDoc.fFile.target="_self";
		tDoc.fFile.action=SelfURL;
		tDoc.fFile.submit();
	}

	function SetTaPath(){
		tDoc.fFile.lim.value=0;
		tDoc.fFile.selID.value=0;
		tDoc.fFile.act.value="";
		tDoc.fFile.target="_self";
		tDoc.fFile.action=SelfURL;
	}

	function JTStr(){
		tDoc.fFile.lim.value=0;
		tDoc.fFile.selID.value=0;
		tDoc.fFile.act.value="";
		tDoc.fFile.target="_self";
		tDoc.fFile.action=SelfURL;
		tDoc.fFile.submit();
	}

	function CheckAllCB(booli){
		var OneIsChckd=false
		for(var i=0;i<tDoc.fFile.elements.length;i++){
			if(tDoc.fFile.elements[i].type=="checkbox"){
				if(!tDoc.fFile.elements[i].disabled){
					if(booli){
						OneIsChckd=true;
						tDoc.fFile.elements[i].checked=true;
					}
					else{
						tDoc.fFile.elements[i].checked=false;
					}
				}
			}
		}

		if(OneIsChckd)
			SetImgAct();
		else
			SetImgDeAct();
	}

	function SetImgAct(){/*more dynamic version will come*/
		tDoc.images.imgDownl1.src=DPATH + "img/bu_dfile.gif";
		//tDoc.images.imgDownl2.src="img/bu_dfile.gif";
	}
	function SetImgDeAct(){/*more dynamic version will come*/
		tDoc.images.imgDownl1.src=DPATH + "img/bu_dfile_o.gif";
		//tDoc.images.imgDownl2.src="img/bu_dfile_o.gif";
	}

	function UnChkImgs(cb) {
		var doncheck=true;
		var unchecked=false;

		if(cb.checked) {
			SetImgAct();
		}
		else {
			for(var i=0;i<tDoc.fFile.elements.length;i++)
				if(tDoc.fFile.elements[i].type=="checkbox")
					if(tDoc.fFile.elements[i].checked)
						unchecked=true;

			if(!unchecked){
				SetImgDeAct();
			}
		}
	}

	function ChckChckBoxes(){
		var unchecked=false;
		for(var i=0;i<tDoc.fFile.elements.length;i++)
			if(tDoc.fFile.elements[i].type=="checkbox")
				if(tDoc.fFile.elements[i].checked)
					unchecked=true;

		return unchecked;
	}

	function BuildMFilesStr(slctRows){
		var mFilesStr="";
		for(var i=0;i<tDoc.fFile.elements.length;i++)
			if(tDoc.fFile.elements[i].type=="checkbox")
				if(tDoc.fFile.elements[i].checked)
					mFilesStr=mFilesStr+tDoc.fFile.elements[i].value+",";


		tDoc.fFile.mFiles.value=CutLastSep(mFilesStr);
		//if(tDoc.fFile.mFiles.value!=""){
		//	tDoc.images.imgPaste1.src="img/bu_paste.gif";
		//	tDoc.images.imgPaste2.src="img/bu_paste.gif";
		//}

		if(slctRows)
			MarkSlctdRows();
	}

	function MarkSlctdRows(){
		if(tDoc.fFile.mFiles.value=="")
			return;

		var tRow1="TRow1";
		var tRow2="TRow2";
		var rowsObj=tDoc.getElementsByTagName('tr');
		var mfArray=tDoc.fFile.mFiles.value.split(",");
		var newClass="bgHighlightClick";
		for(j=0;j<rowsObj.length;j++){
			if(rowsObj[j].id){
				rowsObj[j].className=tRow2;
				if(j%2)
					rowsObj[j].className=tRow1;
			}
		}

		for(i=0;i<mfArray.length;i++)
			for(j=0;j<rowsObj.length;j++)
				if(rowsObj[j].id=="r"+mfArray[i])
					rowsObj[j].className=newClass;
	}

	function DoDownlSlctd(){
		if(!ChckChckBoxes()){
			alert(errSlct);
			return;
		}

		BuildMFilesStr(0);
		tDoc.fFile.target="dlframe";
		tDoc.fFile.action="getfile.php";
		tDoc.fFile.submit();
	}
	function DoDeleteSlctd(){
		if(!ChckChckBoxes()){
			alert(errSlct);
			return;
		}
		if(!confirm(DelQ))
			return;

		BuildMFilesStr(0);
		tDoc.fFile.cut.value=0;
		tDoc.fFile.delFiles.value=1;
		tDoc.fFile.act.value="";
		tDoc.fFile.target="_self";
		tDoc.fFile.taPath.value="";
		tDoc.fFile.action=SelfURL;
		tDoc.fFile.submit();
	}
	function Chk4MarkedFiles(i){
		if(tDoc.fFile.mFiles.value!=""){
			tDoc.images.imgPaste1.src="img/bu_paste.gif";
			tDoc.images.imgPaste2.src="img/bu_paste.gif";
		}
	}


	function CreateFld(){
		if(tDoc.fFile.addFldName.value=="")
			return;

		tDoc.fFile.target="_self";
		tDoc.fFile.taPath.value="";
		tDoc.fFile.addFld.value=1;
		tDoc.fFile.action=SelfURL;
		tDoc.fFile.submit();
	}

	function UplFile(){
		if(tDoc.fFile.addFileName.value=="")
			return;

		tDoc.fFile.target="_self";
		tDoc.fFile.taPath.value="";
		tDoc.fFile.action=SelfURL;
		tDoc.fFile.submit();
	}

	function HideAllOtherLyr(){
		tDoc.all.addFldDiv.style.visibility="hidden";
		tDoc.all.addFileDiv.style.visibility="hidden";
		tDoc.all.addEditDiv.style.visibility="hidden";
	}

	function DoBuNmi(iID){
		HideAllOtherLyr();
		tDoc.fFile.addFldPrnt.value=iID;
		tDoc.all.addFldDiv.style.top=tDoc.body.scrollTop;
		tDoc.all.addFldDiv.style.left=30;
		tDoc.all.addFldDiv.style.visibility="visible";
	}

	function DoBuEmi(iID){
		HideAllOtherLyr();
		tDoc.all.addEditDiv.style.top=tDoc.body.scrollTop;
		tDoc.all.addEditDiv.style.left=30;
		tDoc.all.addEditDiv.style.visibility="visible";

		tDoc.fFile.editFldID.value=iID;
		tDoc.fFile.target="editIFrameN";
		tDoc.fFile.action="files_edit.php";
		tDoc.fFile.submit();
	}

	function DoUpldFile(iID){
		HideAllOtherLyr();
		tDoc.fFile.addFldPrnt.value=iID;
		tDoc.all.addFileDiv.style.top=tDoc.body.scrollTop;
		tDoc.all.addFileDiv.style.left=30;
		tDoc.all.addFileDiv.style.visibility="visible";
	}
	function CloseaddFileDiv(){
		tDoc.fFile.addFldPrnt.value=0;
		tDoc.fFile.addFileName.value="";
		tDoc.all.addFileDiv.style.visibility="hidden";
	}

	function CloseaddFldDiv(){
		tDoc.fFile.addFldPrnt.value=0;
		tDoc.fFile.addFld.value=0;
		tDoc.all.addFldDiv.style.visibility="hidden";
	}

	function DoSaveProp(){
		tDoc.fFile.bSave.value=1;
		tDoc.fFile.target="_self";
		tDoc.fFile.action=SelfURL;
		tDoc.fFile.submit();
	}

	function DoSaveSec(){
		tDoc.all.addGrpDiv.style.visibility="hidden";
		ViewDD();

		tDoc.fFile.sDelGrps.value=CutLastSep(fFile.sDelGrps.value);
		tDoc.fFile.bSaveSec.value=1;
		tDoc.fFile.target="_self";
		tDoc.fFile.action=SelfURL;
		tDoc.fFile.submit();
	}

	function SlctRghts(slct){
		var iOpt=slct[slct.selectedIndex].value;
		var iRights=eval("fFile.iGrpRght_"+iOpt+".value");

		for(i=0;i<arFldRght.length;i++){
			cb=eval("fFile.iFldRight_"+i);

			if(iRights&arFldRght[i])
				cb.checked=true;
			else
				cb.checked=false;
		}
	}

	function ChngiGrpRghtVal(cb){
		var sName=cb.name;
		var iVal=cb.value;
		var iGrp=fFile.iGrpID[fFile.iGrpID.selectedIndex].value;
		var iCVal=eval("fFile.iGrpRght_"+iGrp+".value");

		if(cb.checked)
			eval("fFile.iGrpRght_"+iGrp+".value|="+iVal)
		else
			eval("fFile.iGrpRght_"+iGrp+".value="+iCVal+"&~"+iVal)
	}

	function EditAddGrp(){
		var slctNew=fFile.iAddGrpID;

		tDoc.all.addGrpDiv.style.top=tDoc.body.scrollTop;
		tDoc.all.addGrpDiv.style.left=30;
		tDoc.fFile.iGrpID.style.visibility="hidden";
		for(i=0;i<slctNew.options.length;i++)
			slctNew.options[i].selected=false;

		tDoc.all.addGrpDiv.style.visibility="visible";
	}

	function ViewDD(){
		tDoc.fFile.iGrpID.style.visibility="visible";
	}

	function SlctAllOpt(bool){
		var slctNew=fFile.iAddGrpID;
		for(i=0;i<slctNew.options.length;i++)
			slctNew.options[i].selected=bool;
	}

	function DoAddGrpID(){
		var sSlctIDs="";
		var slctNew=fFile.iAddGrpID;
		var slctOld=fFile.iGrpID;

		for(i=0;i<slctNew.options.length;i++)
			if(slctNew.options[i].selected)
				sSlctIDs+=slctNew.options[i].value+",";

		fFile.sNewSlctGrpIDs.value=CutLastSep(sSlctIDs);
		fFile.bSaveNewGrps.value=1;
		fFile.target="_self";
		fFile.action=tDoc.location.href;
		fFile.submit();
	}

	function EditRmvGrps(){
		var slctOld=fFile.iGrpID;
		var iGrp=fFile.iGrpID[fFile.iGrpID.selectedIndex].value;
		var arVals=new Array();
		var arNames=new Array();

		if(iGrp==0){
			alert(errCantKick);
			return;
		}

		for(i=0;i<slctOld.options.length;i++){
			arVals[i]=slctOld.options[i].value;
			arNames[i]=slctOld.options[i].text;
		}

		slctOld.options.length=0;
		for(i=0;i<arNames.length;i++){
			if(arVals[i]==iGrp)
				continue;

			slctOld.options[slctOld.options.length]=new Option(arNames[i],arVals[i]);
		}
		fFile.sDelGrps.value+=iGrp+",";
	}

	function DoGetRights(){
		if(!confirm(confOverwrite1))
			return;

		tDoc.fFile.getPR.value=1;
		tDoc.fFile.target="_self";
		tDoc.fFile.action=SelfURL;
		tDoc.fFile.submit();
	}

	function DoCpRights(){
		if(!confirm(confOverwrite2))
			return;

		tDoc.fFile.cpPR.value=1;
		tDoc.fFile.bSaveSec.value=1;
		tDoc.fFile.target="_self";
		tDoc.fFile.action=SelfURL;
		tDoc.fFile.submit();
	}

	function ShowImgDetails(iDetail){
		tDoc.fFile.bDetail.value=iDetail;
		tDoc.fFile.target="_self";
		tDoc.fFile.action=SelfURL;
		tDoc.fFile.submit();
	}

	function ClsFileWin(){
		if(opener)
			opener.focus();

		window.close();
	}

	function Callimage(imgName,imgType,iWidth,iHeight,imgID) {
		if (!(top.opener.mediaDB))
			return;

		var arImgData=new Array(2);
		arImgData[0]=iWidth;
		arImgData[1]=iHeight;

		top.opener.focus();
		top.opener.DoImg(imgName,imgID,imgType,arImgData);
		ClsFileWin();
    }

	function Callaudio(sType,iID) {
		return;/*coming soon*/
    }

	function ShowImg(aFID){
		NewWindow3("",640,480,"winShowFile","yes","yes","yes","no","yes");

		tDoc.fFile.action="getfile.php?idI="+aFID;
		tDoc.fFile.target="winShowFile";
		tDoc.fFile.submit();
	}



