




  var i=1;
  var ua = navigator.userAgent;
  var opera = /opera [56789]|opera\/[56789]/i.test(ua);
  var ie = !opera && /MSIE/.test(ua);
  var ie50 = ie && /MSIE 5\.[01234]/.test(ua);
  var ie6 = ie && /MSIE [6789]/.test(ua);
  var ieBox = ie && (document.compatMode == null || document.compatMode != "CSS1Compat");
  var moz = !opera && /gecko/i.test(ua);
  var nn6 = !opera && /netscape.*6\./i.test(ua);
  var safari = ua.indexOf('Safari')>-1;
  function removeFileField(d){
      var ftr=document.getElementById("fid"+d);
      ftr=ftr.parentNode.parentNode;
      ftr.parentNode.removeChild(ftr);
  }

  function cloneFileField(){
      var ftr=document.getElementById("fileTR");
      var ftr2= ftr.cloneNode(true);

      var td=ftr2.getElementsByTagName("input")[0];
      td.name="fff"+i;
      td.id="fid"+i;
      td.value = "";
      
      var a=ftr2.getElementsByTagName("a")[0];
      a.href="javascript:removeFileField("+i+")";
      a.style.display="inline";

      var ftable=document.getElementById("fileTBODY");
      ftable.appendChild(ftr2);
      i++;
  }

  function createDirectory(e){
     var desc = "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0438\u043c\u044f \u043f\u0430\u043f\u043a\u0438";
     var title = "\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u043f\u0430\u043f\u043a\u0443";
     var baseValue = "";
     promptIE7(e,desc, title , baseValue, "createDirectoryAction");

  }

  function createDirectoryAction(dirName){
     if (dirName){
      document.theForm.newdir.value=dirName;
       document.theForm.submit();
     }
    return false;
  }



  function upDir(){
     document.theForm.updir.value="1";
     document.theForm.submit();
  }
  function emptyRecycleBin(){
    if(window.confirm("\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0438\u0437 \u041a\u043e\u0440\u0437\u0438\u043d\u044b?  ")){
      massAction(18);
    }
  }

  function deldir(id,name){
       delImpl(id,name,1);
  }

  function delfile(id,name){
       delImpl(id,name,2);
  }

  function delImpl(id,name,w){
    var confirmMsg = "\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c $[p1] \u0432 \u041a\u043e\u0440\u0437\u0438\u043d\u0443?\n\u0424\u0430\u0439\u043b\u044b, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0435\u0441\u044f \u0432 \u043a\u043e\u0440\u0437\u0438\u043d\u0435, \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0443\u0434\u0430\u043b\u0435\u043d\u044b \u0432 \u043b\u044e\u0431\u043e\u0435 \u0432\u0440\u0435\u043c\u044f.";
   confirmMsg =  confirmMsg.replace(/\$\[p1\]/,"\""+name+"\"");
  
    if (window.confirm(confirmMsg)){
      if (w==1){
       document.theForm.deldir.value=id;
      }else {
       document.theForm.delfile.value=id;
      }
      document.theForm.submit();
    }
  }
  function delfilePerm(id,name){
       delImplPerm(id,name,2);
  }
  function delmessagePerm(id,name){
    delImplPermForForm(id,name,3,document.pmForm);
  }
  function delImplPerm(id,name,w){
    delImplPermForForm(id,name,w,document.theForm);
  }
  function delImplPermForForm(id,name,w,aForm){
    var confirmMsg = "\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c $[p1] ? ";
    confirmMsg = confirmMsg.replace(/\$\[p1\]/,"\""+name+"\"");
    if (window.confirm(confirmMsg)){
      if (w==1){
       aForm.deldir.value=id;
      }else  {
      if (w==2){
       aForm.delfile.value=id;
      } else {
       aForm.delmessage.value=id;
}
      }
      aForm.submit();
    }
  }
  function restoreFile(id,name){
    var confirmMsg = "\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c $[p1] ?  ";
    confirmMsg = confirmMsg.replace(/\$\[p1\]/,"\""+name+"\"");
    if (window.confirm(confirmMsg)){
      document.theForm.restorefile.value=id;
      document.theForm.submit();
    }
  }


  function checkIt(checked){
      var el = document.getElementsByTagName("input");
      var rowIndex=0;
      for (i = 0; i < el.length; i++) {
          var elem = el[i];
          if (elem.type != 'checkbox' || elem.name == null || elem.value == null || elem.value == 'undefined') {
              continue;
          }
          if (elem.name == 'ch_f') {
              if(elem.checked!=checked){
                fileDown(elem.parentNode.parentNode,rowIndex,false);
                fileOut(elem.parentNode.parentNode,false,null,rowIndex++);
              }
              elem.checked=checked;
          }
          if (elem.name == 'ch_d') {
              if(elem.checked!=checked && elem.parentNode!=null){
                fileDown(elem.parentNode.parentNode,rowIndex,true)
                fileOut(elem.parentNode.parentNode,false,null,rowIndex++);
              }
              elem.checked=checked;
          }

          if (elem.name == 'ch_n') {
              if(elem.checked!=checked){
                fileDown(elem.parentNode.parentNode,rowIndex,true);
                fileOut(elem.parentNode.parentNode,false,null,rowIndex++);
              }
              elem.checked=checked;
          }
      }


  }

  var selectAll=true;

  function selectAllOrNone(){
    var sAll=document.getElementById("selectAll");
    if (selectAll){
      checkIt(true);
      sAll.title="Select None";
      selectAll=false;
    } else {
      checkIt(false);
      sAll.title="\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0438 \u043f\u0430\u043f\u043a\u0438";
      selectAll=true;
    }


  }

  function checkFileWithId(fileid){
      var el = document.getElementsByTagName("input");
      for (i = 0; i < el.length; i++) {
          var elem = el[i];
          if (elem.type != 'checkbox' || elem.name == null || elem.value == null || elem.value == 'undefined') {
              continue;
          }
          if (elem.name == 'ch_f' && elem.value==fileid) {
              elem.checked=true;
          }
      }
  }
        
  function checkDirWithId(dirid){
      var el = document.getElementsByTagName("input");
      for (i = 0; i < el.length; i++) {
          var elem = el[i];
          if (elem.type != 'checkbox' || elem.name == null || elem.value == null || elem.value == 'undefined') {
              continue;
          }
          if (elem.name == 'ch_d' && elem.value==dirid) {
              elem.checked=true;
          }
      }
  }

  function uncheckAll(){
    checkDirsImpl(false);
    checkFilesImpl(false);
  }

  function checkDirs(){
    checkDirsImpl(true);
  }
  function checkDirsImpl(checkValue){
      var el = document.getElementsByTagName("input");
      for (i = 0; i < el.length; i++) {
          var elem = el[i];
          if (elem.type != 'checkbox' || elem.name == null || elem.value == null || elem.value == 'undefined') {
              continue;
          }
          if (elem.name == 'ch_d') {
              elem.checked=checkValue;
          }
      }
  }

  function checkFiles(){
    checkFilesImpl(true);
  }
  function unCheckFiles(){
    checkFilesImpl(false);
  }
  function checkFilesImpl(checkValue){
      var el = document.getElementsByTagName("input");
      for (i = 0; i < el.length; i++) {
          var elem = el[i];
          if (elem.type != 'checkbox' || elem.name == null || elem.value == null || elem.value == 'undefined') {
              continue;
          }
          if (elem.name == 'ch_f') {
              elem.checked=checkValue;
          }
      }
  }

  function hasCheckedFiles(){
      var el = document.getElementsByTagName("input");
      for (i = 0; i < el.length; i++) {
          var elem = el[i];
          if (elem.type != 'checkbox' || elem.name == null || elem.value == null || elem.value == 'undefined' || !elem.checked) {
              continue;
          }
          if (elem.name == 'ch_f' || elem.name == 'ch_d') {
              return true;
          }
      }
      return false;

  }

  function toEmail(mode){
    if (!hasCheckedFiles()){
      alert("Please check files to email");
    }else {
      massAction(mode);
    }

  }

  function massAction(mode){
      document.theForm.homemode.value=mode;
      document.theForm.submit();
  }

  function goForward(){
    massAction(14);
  }
  function goBack(){
    massAction(13);
  }

  function copyFiles(mode){
    if (!hasCheckedFiles()){
      alert("Please check files to copy");
    }else {
      massAction(mode);
    }
  }
  function makeRenameWOEvent(oldname,fid,isItFileToRename){
    document.theForm.renamefileid.value=fid;
    document.theForm.isFileToRename.value=isItFileToRename;
    var desc = "Please enter new name";
    var title = "\u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c";
    promptIE7(contextMenuEvent,desc, title , oldname, "renameFileAction2",contextMenuEventX,contextMenuEventY,true);
  }

  
  function renameFile(event,oldname,fid,isItFileToRename,offx,offy){
    document.theForm.renamefileid.value=fid;
    document.theForm.isFileToRename.value=isItFileToRename;
    var desc = "Please enter new name";
    var title = "\u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c";
    promptIE7(event, desc , title , oldname, "renameFileAction2",offx,offy);
  }

  function renameFileAction2(s){
    if(s.length==0){
      alert("Name should not be empty");
    }else {
      document.theForm.newfilename.value=s;
      massAction(12);
    }
    return false;
  }

  function addChangeFolderDescription(event,olddescription,dirid,offx,offy){
    document.theForm.addchangedescriptionfolderid.value=dirid;
    var desc = "Please enter new description";
    var title = "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0430\u043f\u043a\u0438";
    promptBigWindowIE7(event, desc , title , olddescription, "addChangeFolderDescription2",offx,offy);
}

  function addChangeFolderDescription2(s){
    if(s.length==0){
      alert("Description should not be empty");
    }else {
    writeDrag.hide();
     // document.theForm.newfolderdescription.value=s;
      changeDirAddParams="&homemode="+21+"&newfolderdescription="+ encodeURIComponent(s) + "&addchangedescriptionfolderid="+currentDirId;
         changeDirImpl(currentDirId,true);
     // massAction(21);
    }
    return false;
  }

  function cutFiles(mode){
    if (!hasCheckedFiles()){
      alert("Please check files to cut");
    }else {
      massAction(mode);
    }
  }


  function deleteFiles(mode){
      if (!hasCheckedFiles()){
          alert("Please check files to move to the Recycle Bin");
      }else {
          if (window.confirm("\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0432 \u041a\u043e\u0440\u0437\u0438\u043d\u0443?  \n\u0424\u0430\u0439\u043b\u044b, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0435\u0441\u044f \u0432 \u043a\u043e\u0440\u0437\u0438\u043d\u0435, \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0443\u0434\u0430\u043b\u0435\u043d\u044b \u0432 \u043b\u044e\u0431\u043e\u0435 \u0432\u0440\u0435\u043c\u044f.")){
              massAction(mode);
          }
      }
  }
  function restoreFiles(mode){
      if (!hasCheckedFiles()){
          alert("Please check files to restore");
      }else {
          if (window.confirm("\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b?")){
              massAction(mode);
          }
      }
  }
  function deleteFilesPerm(mode){
      if (!hasCheckedFiles()){
          alert("Please check files to delete");
      }else {
          if (window.confirm("\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b?")){
              massAction(mode);
          }
      }
  }
  function zipFiles(event,offx,offy){
      if (!hasCheckedFiles()){
          alert("Please check files to zip");
      }else {
        var desc = "\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 zip-\u0430\u0440\u0445\u0438\u0432\u0430";
        var title = "Zip";
         promptIE7(event, desc , title ,document.theForm.defaultZipName.value , "zipFilesAction",offx,offy);

      }
  }

   function zipFilesAction(s){
         var enteredZipName=s;
        if(enteredZipName==null || enteredZipName=='undefined' || enteredZipName==''){
          alert("\u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u0432\u0435\u0441\u0442\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 zip-\u0430\u0440\u0445\u0438\u0432\u0430");
          return false;
        }
         writeDrag.hide();
         document.theForm.zipname.value=enteredZipName;
         var oldTarget =document.theForm.target;
         var oldAction =document.theForm.action;
         document.theForm.target='zipframe';
         document.theForm.action=document.theForm.zipFormURL.value;

         top.zipStarts = true;
         massAction(9);
         showProgressBar('zip');
         document.theForm.target=oldTarget;
         document.theForm.action=oldAction;
        return false;
      }




    function markFiles(mode){
      if (!hasCheckedFiles()){
        alert("Please check files to mark as public");
      }else {
        massAction(mode);
      }
    }

    function markOffFiles(mode){
      if (!hasCheckedFiles()){
        alert("Please check files to mark off as public");
      }else {
        massAction(mode);
      }
    }

    function showPreview(url){
      var img=document.getElementById("smallImg");
      img.src = url;
      img.style.display="inline";
    }

    function hidePreview(){
      var img=document.getElementById("smallImg");
      img.style.display="none";
    }

    function fileOver(page,isImg,link,rowNum){
//     if (isImg){
//       showPreview(link);
//     }
    setPointer(page,rowNum, 'over', 'Window', (safari?'#FFFFDE':'InfoBackground'), '#C3D9FF');
    //setPointer(page,rowNum, 'over', '#E5E5E5', '#CCFFCC', '#C3D9FF');

    }
    function fileOut(page,isImg,link,rowNum){
//     if (isImg){
//       hidePreview();
//     }
     //setPointer(page,rowNum, 'out', '#E5E5E5', '#CCFFCC', '#C3D9FF');
     setPointer(page, rowNum, 'out', 'Window', (safari?'#FFFFDE':'InfoBackground'), '#C3D9FF');
    }

    function fileDown(page,rowNum,isFile){
      //if (isFile){
        setPointer(page, rowNum, 'click', 'Window', (safari?'#FFFFDE':'InfoBackground'), '#C3D9FF');
      //}
    }


     function fileDownCheckBox(isFile,fid,td,rowNum){
      var el = document.getElementsByTagName("input");
      for(i=0;i<el.length;i++){
          var elem = el[i];
          if(elem.value!=fid || elem.type!='checkbox' || elem.name==null){
              continue;
          }
          if(isFile  && elem.name=='ch_f'){
              elem.checked=!elem.checked;
              break;
          }
          if(!isFile && elem.name=='ch_d'){
              elem.checked=!elem.checked;
          }
      }
      fileDown(td.parentNode,rowNum,isFile);
    }

function cloneObjShallow(myObj)
{
	if(typeof(myObj) != 'object') return myObj;
	if(myObj == null) return myObj;

	var myNewObj = new Object();

	for(var ifield in myObj)
		myNewObj[ifield] = myObj[ifield];

	return myNewObj;
}

//writeDrag.writeId = "cntnt";
function wrapContent(e, img, w, h, txt,
                     downloadLink, fileExt,
                     wd, offx, offy) {
  var imgStr, cntnt, win, str;
  imgStr = '<img src="' + img + '"' + (w? ' width="' + w + '"': "") + (h? ' height="' + h + '"': "") + '>';
  if( downloadLink ){
      window.originalMediaPreviewEvent=cloneObjShallow(e);
      txt += '\n<a href="#" onclick="return showMediaPreview(window.originalMediaPreviewEvent, \''
              + downloadLink + '\',\''+ fileExt + '\')">';
      txt += '\n<img alt="Play" src="/images/play.gif" title="Play media file" class="absmid" /></a>';
  }
  if ( dragObj.supported && typeof document.body.innerHTML != "undefined" ) {
    cntnt = '<div class="previewImg">' + imgStr + '</div>';
    if (txt) cntnt += '<div class="previewMsg">' + txt + '</div>';
    if (!wd) wd = w;
    document.getElementById("popupTitle").innerHTML = '\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440';
    writeDrag.set(e, cntnt, wd, offx, offy);
  } else { // non-capable browsers will open sub window
    w = w+80 || wd || 250; h = h+80 || 250; // size
    win = window.open('', 'subwin', 'resizable,width='+w+',height='+h+',left=100,top=100');
    if (win && !win.closed) win.resizeTo(w,h);
    str = '<html><head><title>Image Display</title></head>';
  	str += '<body style="text-align:center">';
    str += imgStr + (txt? '<p>' + txt + '</p>':"");
  	str += '</body></html>'
  	win.document.write(str);
  	win.document.close();
    if (win && !win.closed) win.focus();
  }
  return false;
}







function showMediaPreview(e, url, ext, haveFlv, streamer) {
  var spanStr, cntnt, win, str;
  spanStr = '<span id=\'music1\'></span>';
  var w = 330;
  var h = 250; // size
  if ( dragObj.supported && typeof document.body.innerHTML != "undefined" ) {
    cntnt = '<div class="previewImg">' + spanStr + '</div>';
    document.getElementById("popupTitle").innerHTML = '\u041f\u0440\u043e\u0441\u043b\u0443\u0448\u0430\u0442\u044c';
    writeDrag.set(e, cntnt, w, 0, 0);
    playMedia(document, url, ext, haveFlv, streamer);
  } else { // non-capable browsers will open sub window
    win = window.open('', 'subwin', 'resizable,width='+w+',height='+h+',left=100,top=100');
    if (win && !win.closed) win.resizeTo(w,h);
    str = '<html><head><title>Media  Preview</title></head>';
  	str += '<body style="text-align:center">';
    str += spanStr ;
  	str += '</body></html>'
  	win.document.write(str);
  	win.document.close();
    if (win && !win.closed) win.focus();
    playMedia(win.document, url, ext, streamer);
  }
  return false;
}



function showZipPreview(e, previewURL, w, h, wd, fid,unzipFormUrl,unzipProgressUrl) {
  var imgStr, cntnt, win, str;
  if(document.unzipForm!=null){
     document.unzipForm.zipFile.value=fid;
     document.unzipForm.action=unzipFormUrl;
     document.unzipForm.unzipProgressUrl.value=unzipProgressUrl;
  }
  iframeStr = '<iframe src="'+previewURL + '"' + (w? ' width="' + w + '"': "") + (h? ' height="' + h + '"': "") + ' scrolling="yes"></iframe>';
  if (dragObj.supported && typeof document.body.innerHTML != "undefined" ) {//****************
    if(unzipFormUrl!=null && unzipFormUrl!=''){
      cntnt = '<div class="previewImg"><button type="button" class="oneline" onclick="top.unzipAction();" id="unzipButton">Unzip</button><br>' +iframeStr + '</div>';
    }else {
      cntnt = '<div class="previewImg"><br>' +iframeStr + '</div>';
    }

    if (!wd) wd = w;
    document.getElementById("popupTitle").innerHTML = 'Zip preview';
    writeDrag.set(e, cntnt, wd, 0, 0);
  } else { // non-capable browsers will open sub window
    w = w+80 || wd || 250; h = h+80 || 250; // size
    win = window.open(previewURL, 'subwin', 'resizable,width='+w+',height='+h+',left=100,top=100');
    if (win && !win.closed) win.resizeTo(w,h);
    if (win && !win.closed) win.focus();
  }
  return false;
}
function showTextPreview(e, fid, w, h, wd, offx, offy) {
  var imgStr, cntnt, win, str;
  iframeStr = '<iframe src="'+fid + '"' + (w? ' width="' + w + '"': "") + (h? ' height="' + h + '"': "") + ' scrolling="yes"></iframe>';
  if (dragObj.supported && typeof document.body.innerHTML != "undefined" ) {//****************
    cntnt = '<div class="previewImg">' + iframeStr + '</div>';
    if (!wd) wd = w;
    document.getElementById("popupTitle").innerHTML = 'Text preview';
    writeDrag.set(e, cntnt, wd, offx, offy);
  } else { // non-capable browsers will open sub window
    w = w+80 || wd || 250; h = h+80 || 250; // size
    win = window.open(fid, 'subwin', 'resizable,width='+w+',height='+h+',left=100,top=100');
    if (win && !win.closed) win.resizeTo(w,h);
    if (win && !win.closed) win.focus();
  }
  return false;
}


function showFileLinks(e, directLinkEnabled, selectionType, w, h, wd, offx, offy) {

    var f="";
    var filesCount=0;
    var sharedDirsCount =0;
    var notSharedDirsCount = 0;

    var el = document.getElementsByTagName("input");
    for (i = 0; i < el.length; i++) {
        var elem = el[i];
        if (elem.type != 'checkbox' || elem.name == null || elem.value == null || elem.value == 'undefined' || !elem.checked) {
            continue;
        }
        if (elem.name == 'ch_f') {
            f += "f=" + elem.value + "&";
            filesCount++;
        }
        if (elem.name == 'ch_d') {
            if (document.getElementById("ch_sd_id_" + elem.value)) {
                f += "d=" + elem.value + "&";
                sharedDirsCount++;
            } else {
                f += "nsd=" + elem.value + "&";
                notSharedDirsCount++;
            }
        }
    }
    if (f.length==0)  {
     alert('Please select files or folders you would like to get links to.');
     return;
     }
     if (filesCount==0 && sharedDirsCount==0 && notSharedDirsCount > 0) return;
    
    if (directLinkEnabled=='true') {
        f+="dl=true";
    } else {
        f+="dl=false";
    }
    if (selectionType=='select') {
       f+="&st=sel";
    } else {
       f+="&st=upl";
    }
    f = "&"+f;
    var aj = new AjaxHelper();
    aj.sendGetTextRequest('/account/fileLinksOnSelectOrUpload.jsp?sId=1B3tErowQd0TLv0j'+f
      ,
      function(linksStr){
          var cntnt, win, str;
          if (dragObj.supported && typeof document.body.innerHTML != "undefined" ) {//****************
            cntnt = '<div class="previewImg">' + linksStr + '</div>';
            if (!wd) wd = w;
            document.getElementById("popupTitle").innerHTML = 'C\u0441\u044b\u043b\u043a\u0438';
            //writeDrag.s
            writeDrag.set(e, cntnt, wd, offx, offy);
            setupAllTabs();
          } else { // non-capable browsers will open sub window
            w = w+80 || wd || 250; h = h+80 || 250; // size
            win = window.open(fid, 'subwin', 'resizable,width='+w+',height='+h+',left=100,top=100');
            if (win && !win.closed) win.resizeTo(w,h);
            if (win && !win.closed) win.focus();
          }

      }
    );


/*
  if (dragObj.supported && typeof document.body.innerHTML != "undefined" ) {/*/
/****************
    cntnt = '<div class="previewImg">' + linksStr + '</div>';
    if (!wd) wd = w;
    document.getElementById("popupTitle").innerHTML = 'File links';
    writeDrag.s
    writeDrag.set(e, cntnt, wd, offx, offy);
    setupAllTabs();
  } else { // non-capable browsers will open sub window
    w = w+80 || wd || 250; h = h+80 || 250; // size
    win = window.open(fid, 'subwin', 'resizable,width='+w+',height='+h+',left=100,top=100');
    if (win && !win.closed) win.resizeTo(w,h);
    if (win && !win.closed) win.focus();
  }
*/
  return false;
}



  function openNewWindow(url){
        document.newWindowForm.action=url;
        document.newWindowForm.submit();
    }


  function promptIE7(event, desc, title, baseValue, method,offx,offy, ppEvent){
  var w = 250;
  var h = 250; // size

  if ( dragObj.supported && typeof document.body.innerHTML != "undefined" ) {
    var action = method+"(document.prompt.promptText.value)";
    var cntnt;
    try {
      cntnt = '<div class="text"><form name="prompt" onSubmit="return eval('+action+')" style="padding:5px">'+
              desc+'<br />'+
          '<input type="text" name="promptText" value="'+baseValue+'" style="width:180px" class="xBox" /> '+
          '<input type="submit" value="Ok" style="width:50px" /></form></div>';
      // class="xBox" is attached to the text element so that mouse were working inside the text as usual
      // (selecting text), not dragging the prompt. If class attribute is needed for design
      // then dw_drag.js must be changed to perform substring, not exact class comparison
      document.getElementById("popupTitle").innerHTML = title;
      writeDrag.set(event, cntnt, w, offx,offy,ppEvent);
      document.prompt.promptText.focus();
      document.prompt.promptText.select();
    }catch (e){
    alert(e);
  }
  } else {
    var oldA = method+"(prompt('"+s+"'))";
    return eval(oldA);
  }
  return false;
  }

  function editFileInfo(e, fileId, dirId, index, offx, offy) {
    var evnt = cloneEventFix(e);
    var w = 348;
    var f='&fId=' + fileId + '&dId=' + dirId + (index != undefined ? '&startPage=' + index : '');
    var aj = new AjaxHelper();
    aj.sendGetTextRequest('/account/editFileInfoForm.jsp?sId=1B3tErowQd0TLv0j'+f
      ,
      function(linksStr){
          var cntnt, win;
          if (dragObj.supported && typeof document.body.innerHTML != "undefined" ) {//****************
            cntnt = '<div class="previewImg">' + linksStr + '</div>';
            document.getElementById("popupTitle").innerHTML = 'Edit info';
            writeDrag.set(evnt, cntnt, w, offx, offy);
            setupAllTabs();
          } else { // non-capable browsers will open sub window
            w = w+80 || wd || 250; h = h+80 || 250; // size
            win = window.open(fid, 'subwin', 'resizable,width='+w+',height='+h+',left=100,top=100');
            if (win && !win.closed) win.resizeTo(w,h);
            if (win && !win.closed) win.focus();
          }
      }
    );
  }

  function cloneEventFix(obj){
    if(obj == null || typeof(obj) != 'object')
      return obj;

    var temp = {};
    for(var key in obj)
      temp[key] = obj[key];

    return temp;
  }

  function promptBigWindowIE7(event, desc, title, baseValue, method,offx,offy, ppEvent){
  var w = 345;
  var h = 450; // size

  if ( dragObj.supported && typeof document.body.innerHTML != "undefined" ) {
    var action = method+"(document.prompt.promptText.value)";
    var cntnt;
    try {
      cntnt = '<div class="text"><form name="prompt" onSubmit="return eval('+action+')" style="padding:5px">'+
              desc+'<br />'+
          '<textarea rows="10" cols="61" name="promptText" style="width:330px" class="xBox">'+baseValue+'</textarea><br />' +
          //'<input type="text" name="promptText" value="'+baseValue+'" style="width:180px" class="xBox" /> '+
          '<div class="alignRight"><input type="submit" value="Ok" style="width:70px" /></div></form></div>';
      // class="xBox" is attached to the text element so that mouse were working inside the text as usual
      // (selecting text), not dragging the prompt. If class attribute is needed for design
      // then dw_drag.js must be changed to perform substring, not exact class comparison
      document.getElementById("popupTitle").innerHTML = title;
      writeDrag.set(event, cntnt, w, offx,offy,ppEvent);
      document.prompt.promptText.focus();
      document.prompt.promptText.select();
    }catch (e){
    alert(e);
  }
  } else {
    var oldA = method+"(prompt('"+s+"'))";
    return eval(oldA);
  }
  return false;




  }
/*

  function promptIE7PrivateMessage(event, desc, title, method,offx,offy, ppEvent){
  var w = 345;
  var h = 450; // size

  if ( dragObj.supported && typeof document.body.innerHTML != "undefined" ) {
    var action = method+"(document.prompt.promptText.value)";
    var cntnt;
    try {
      cntnt = '<div class="text"><form name="prompt" onSubmit="return eval('+action+')" style="padding:5px">'+
              desc+'<br />'+
              'Subject: <input type=" text" name="subj"/><br />'+
          '<textarea rows="10" cols="61" name="promptText" style="width:330px" class="xBox">'+baseValue+'</textarea><br />' +
          //'<input type="text" name="promptText" value="'+baseValue+'" style="width:180px" class="xBox" /> '+
          '<div align="right"><input type="submit" value="Ok" style="width:70px" /></div></form></div>';
      // class="xBox" is attached to the text element so that mouse were working inside the text as usual
      // (selecting text), not dragging the prompt. If class attribute is needed for design
      // then dw_drag.js must be changed to perform substring, not exact class comparison
      document.getElementById("popupTitle").innerHTML = title;
      writeDrag.set(event, cntnt, w, offx,offy,ppEvent);
      document.prompt.promptText.focus();
      document.prompt.promptText.select();
    }catch (e){
    alert(e);
  }
  } else {
    var oldA = method+"(prompt('"+s+"'))";
    return eval(oldA);
  }
  return false;




  }

*/



