var dragstarted=false;var currentX=0;var currentY=0;var writing=false;var zindexcount=1;var activeMenu;clipboard=new Object;clipboard.from=false;clipboard.to=false;clipboard.items=new Array;var clipboardAction='copy';var upload2share=false;clipboard.fromuid=false;preloaded=new Array;var dragListBuilded=false;function getById(id){
obj=document.getElementById(id);if(!obj){
return false;
}else{
return obj;
}
}
function BrowserCheck(){
var ua=navigator.userAgent.toLowerCase();this.Opera=ua.indexOf("opera")!=-1;this.IE=(!this.Opera && (ua.indexOf("msie")!=-1));this.NS=(!this.Opera && (ua.indexOf("mozilla")!=-1) && (ua.indexOf("compatible")==-1));if(this.Opera){
this.what='Opera';
} else if(this.IE){
this.what='IE';
} else if(this.NS){
this.what='NS';
} 
}
is=new BrowserCheck();function preloadImg(src){
index=preloaded.length;preloaded[index]=new Image();preloaded[index].src=src;
}
function imageReloadSrc(){
this.src=this.src;
}
if(is.NS){
document.captureEvents(Event.MOUSEMOVE);
}
function cancelBubble(e){
if(is.IE){
eveniment=window.event;e.returnValue=false;event.cancelBubble=true;
}else{
e.stopPropagation();
}
}
function getScrollLeft(){
if(window.pageXOffset!=null){
scroll_left=window.pageXOffset;
}
if(document.body.scrollHeight!=null){
scroll_left=document.body.scrollLeft;
}
return scroll_left;
}
function getScrollTop(){
if(window.pageYOffset!=null){
scroll_top=window.pageYOffset;
}
if(document.body.scrollWidth!=null){
scroll_top=document.body.scrollTop;
}
return scroll_top;
}
function getX(event){
return event.clientX+getScrollLeft();
}
function getY(event){
return event.clientY+getScrollTop();
}
function getBodyH(){
return ((is.NS)?document.body.clientHeight:document.body.offsetHeight);
}
function getBodyW(){
return ((is.NS)?document.body.clientWidth:document.body.offsetWidth);
}
function newHiddenIframe(id){
el=document.createElement('IFRAME');el.name=id;el.id=id;el.src='blank.html';AfianHandler.iframesContainer.appendChild(el);return el;
}
function formatFileSize(filesize){
if(filesize >= 1024 && filesize < 1048576){
filesize=filesize/1024;dotpos=filesize.toString().indexOf(".");if(dotpos==-1){
dotpos=filesize.toString().length;
}
filesize=filesize.toString().substring(0,dotpos+2);filesize += " KB";
} else if(filesize >= 1048576){
filesize=(filesize/1024)/1024;dotpos=filesize.toString().indexOf(".");if(dotpos==-1){
dotpos=filesize.toString().length;
}
filesize=filesize.toString().substring(0,dotpos+2);filesize += " MB";
} else if(filesize > 0){
filesize=filesize;filesize += " Bytes";
}else{
filesize="0 Bytes";
}
return filesize;
}
Array.prototype.has4ValidElms=function(){
count=0;for (var i=0 ;i < this.length;i++){
if(this[i]!=undefined){
count++;
}
}
if(count > 3){
return true;
}else{
return false;
}
};function gluePath(pieces){
path='';for (var i=0 ;i < pieces.length;i++){
pieces[i]=addSingleSlashess(pieces[i]);if(path.substring(path.length-1, path.length)=='/'){
if(pieces[i].substring(0, 1)=='/'){
path += pieces[i].substring(1, pieces[i].length);
}else{
path += pieces[i];
}
}else{
if(pieces[i].substring(0, 1)!='/'){
if(pieces[i].length > 0){
path += '/'+pieces[i];
}else{
path += pieces[i];
}
}else{
path += pieces[i];
}
}
}
return path;
}
function addSingleSlashess(str){
return str.replace("\\","").replace("\'","\\\'");
}
function insertHTMLBeforeEnd (el, sHTML){
if(el.insertAdjacentHTML!=null){
el.insertAdjacentHTML("BeforeEnd", sHTML)
return;
}
var r=el.ownerDocument.createRange();r.selectNodeContents(el);r.collapse(false);df=r.createContextualFragment(sHTML);el.appendChild(df);
}
function isLegalFilename(filename){
bad=new Array;bad[0]="\\";bad[1]="/";bad[2]=":";bad[3]="*";bad[4]="?";bad[5]="<";bad[6]=">";bad[7]="|";bad[7]="\"";for (var i=0;i < bad.length ;i++){
if(filename.indexOf(bad[i])!=-1){
return false;
}
}
return true;
}
function debugLog(str){
debugWindow.document.write(str);debugWindow.document.write('<br>');
}
function popup(url, name, height, width, scrollbars){
var popwin;var opts="toolbar=no,status=yes,location=no,menubar=no,resizable=yes";opts += ",height=" + height + ",width=" + width + ",top="+(((screen.height/2)-height/2)-20)+",left=" + ((screen.width/2)-width/2) + ",scrollbars=" + scrollbars;popwin=window.open("", ''+name+'', opts);if(popwin){
popwin.location.replace(url);popwin.focus();
}
return popwin;
}
selectableTags=["input", "textarea", "select"];function disableselect(e){
if(is.IE){
target=event.srcElement;
}else{
target=e.target;
}
if(target.getAttribute('selectable')){
return true;
}else{
if(inArray(selectableTags, target.tagName.toLowerCase())){
return true;
}else{
return false;
}
}
}
function inArray(arr, needle){
for (var i=0 ;i < arr.length;i++){
if(arr[i]==needle){
return true;
}
}
return false;
}
if(window.name=='AfianMainWindow'){
if(typeof document.onselectstart!="undefined"){
document.onselectstart=disableselect;
}else{
document.onmousedown=disableselect;document.onmouseup=function(){return true;};
}
}
/* COOKIES */
function setCookie(key, value){
document.cookie=key + "=" + escape(value);
}
function getCookie(key){
if(document.cookie){
var start=document.cookie.indexOf(' ' + key + '=');if(start==-1){
return null;
}
var end=document.cookie.indexOf(";", start);if(end==-1){
end=document.cookie.length;
}
end -= start;var cookie=document.cookie.substr(start,end);return unescape(cookie.substr(cookie.indexOf('=') + 1, cookie.length - cookie.indexOf('=') + 1));
}else{
return null;
}
}
/* END COOKIES */
function insertJavaApplet(placeHolder, postURL){
app=document.createElement('APPLET');placeHolder.appendChild(app);app.setAttribute('archive', 'jupload.jar');app.setAttribute('code', 'wjhk.jupload.JUploadApplet.class');app.setAttribute('height', '200');app.setAttribute('width', '200');app.setAttribute('mayscript', '1');par=document.createElement('PARAM');par.setAttribute('name', 'postURL');par.setAttribute('value', postURL);app.appendChild(par);par=document.createElement('PARAM');par.setAttribute('name', 'text_labels[drag]');par.setAttribute('value', jlabels[0]);app.appendChild(par);par=document.createElement('PARAM');par.setAttribute('name', 'text_labels[uploading]');par.setAttribute('value', jlabels[1]);app.appendChild(par);par=document.createElement('PARAM');par.setAttribute('name', 'text_labels[of]');par.setAttribute('value', jlabels[2]);app.appendChild(par);par=document.createElement('PARAM');par.setAttribute('name', 'text_labels[files]');par.setAttribute('value', jlabels[3]);app.appendChild(par);
}
/* JAVA Upload */
var filearr=new Array();var JAVAUploadSettings=new Array();function onJavaUploadBeforeUpload(){
b='';for (var i=0 ;i < filearr.length ;i++){
b += filearr[i]['filename']+'\r\n';
}
//alert(b);
}
function onJavaUploadStart(){
JAVAUploadSettings['tb']=AfianHandler.allTabs[JAVAUploadSettings['tabId']];JAVAUploadSettings['tb'].showHourGlass();getById('cancelButton').style.display='block';
}
function onJavaUploadFinish(){
JAVAUploadSettings['tb'].hideHourGlass();cd(JAVAUploadSettings['tb'].basepath, false, JAVAUploadSettings['tb'].title);getById('cancelButton').style.display='none';
}
function cancelJavaUpload(){
document.applets[0].stopUpload();document.applets[0].reset();getById('cancelButton').style.display='none';JAVAUploadSettings['tb'].hideHourGlass();cd(JAVAUploadSettings['tb'].basepath, false, JAVAUploadSettings['tb'].title);var div=getById('juploadHTMLCode');var html=getById('juploadHTMLCodeTextarea').value;div.innerHTML=html;
}
function onJavaUploadReply(replytext){
console.log(replytext);boundarStart='---REPLY START---';var boundaryStartPos=replytext.indexOf(boundarStart);pos=boundaryStartPos+boundarStart.length;var withoutHeader=replytext.substring(pos);var reply=withoutHeader.substring(0, withoutHeader.length-15);replyParts=reply.split("|");replyAction=replyParts[0];replyMsg=replyParts[1];if(replyAction=='CANCEL'){
cancelJavaUpload();
}
if(replyMsg!=undefined){
AfianAlert(replyMsg);
}
}
function addFile(filename, fullpath, filesize, uploaded){
var nFile=new Array();nFile['filename']=filename;nFile['fullpath']=fullpath;nFile['filesize']=filesize;nFile['uploaded']=uploaded;filearr.push(nFile);
}
function clearFiles(){
fileArr=new Array();
}
var popMenuTemplate='<table cellspacing="0" cellpadding="0" border="0"><tr id="POPM_ID"> <td width="9" height="21"><img src="images/interface/popmenu/sp-titlebar-top-left.gif" width="9" height="21" alt="" border="0"></td> <td background="images/interface/popmenu/sp-titlebar-top-bg.gif" style="background-repeat:repeat-x;font-weight:bold;background-color:silver" align="center">POPM_TOP</td> <td width="11" height="21"><img src="images/interface/popmenu/sp-titlebar-top-right.gif" width="11" height="21" alt="" border="0"></td></tr><tr> <td width="9" height="5"><img src="images/interface/popmenu/sp-titlebar2-top-left.gif" width="9" height="5" alt="" border="0"></td> <td height="5" background="images/interface/popmenu/sp-titlebar2-top-bg.gif" style="background-repeat:repeat-x"><img src="images/interface/pixel.gif" width="1" height="5" border="0" alt=""></td> <td width="11" height="5"><img src="images/interface/popmenu/sp-titlebar2-top-right.gif" width="11" height="5" alt="" border="0"></td></tr><tr> <td width="9" background="images/interface/popmenu/sp-left.gif" style="background-repeat:repeat-y"><img src="images/interface/pixel.gif" width="9" height="1" border="0" alt=""></td> <td style="background-color:#E4E4E4;padding-left:20px;padding-right:20px;padding-top:10px" align="center">POPM_MIDDLE</td> <td width="11" background="images/interface/popmenu/sp-right.gif" style="background-repeat:repeat-y"><img src="images/interface/pixel.gif" width="9" height="1" border="0" alt=""></td></tr><tr> <td width="9" height="44"><img src="images/interface/popmenu/sp-bottom-left.gif" width="9" height="44" alt="" border="0"></td> <td height="44" background="images/interface/popmenu/sp-bottom-bg.gif" style="background-repeat:repeat-x;background-color:whitesmoke" align="center">POPM_BOTTOM</td> <td width="11" height="44"><img src="images/interface/popmenu/sp-bottom-right.gif" width="11" height="44" alt="" border="0"></td></tr></table>';function preloadAllImages(){
var imgdir='images/interface/';preloadImg(imgdir+'popmenu/sp-bottom-bg.gif');preloadImg(imgdir+'popmenu/sp-bottom-left.gif');preloadImg(imgdir+'popmenu/sp-bottom-right.gif');preloadImg(imgdir+'popmenu/sp-left.gif');preloadImg(imgdir+'popmenu/sp-right.gif');preloadImg(imgdir+'popmenu/sp-titlebar2-top-bg.gif');preloadImg(imgdir+'popmenu/sp-titlebar2-top-left.gif');preloadImg(imgdir+'popmenu/sp-titlebar2-top-right.gif');preloadImg(imgdir+'popmenu/sp-titlebar-top-bg.gif');preloadImg(imgdir+'popmenu/sp-titlebar-top-left.gif');preloadImg(imgdir+'popmenu/sp-titlebar-top-right.gif');preloadImg(imgdir+'hourglass.gif');preloadImg(imgdir+'dropdown-dot.gif');preloadImg(imgdir+'iconbg.gif');
};function clipSelected(){
clipboard.items.length=0;clipboard.fromtabid=AfianHandler.activeTab.id;clipboard.fromtabbasepath=AfianHandler.activeTab.basepath;if(AfianHandler.activeTab.uid){
clipboard.fromuid=AfianHandler.activeTab.uid;
}
for (var i=0 ;i < AfianHandler.activeTab.items.length;i++){
if(AfianHandler.activeTab.items[i]!=undefined){
if(AfianHandler.activeTab.items[i].selected){
clipboard.items[clipboard.items.length]=AfianHandler.activeTab.items[i].input_value;
}
}
}
if(AfianHandler.activeTab.section!='browseshare'){
getById('MyFilesPasteButton').style.visibility='visible';
}else{
getById('BSharePasteButton').style.visibility='visible';
}
AfianHandler.activeTab.unselectAll();
}
function resetClipboard(){
clipboard.from=false;clipboard.to=false;clipboard.items=new Array;clipboard.length=0;clipboardAction='copy';clipboard.fromuid=false;
}
function fillHiddenFormItemList(){
document.hiddenForm.itemlist.value='';for (var i=0 ;i < AfianHandler.activeTab.items.length;i++){
if(AfianHandler.activeTab.items[i]!=undefined){
if(AfianHandler.activeTab.items[i].selected){
document.hiddenForm.itemlist.value += '|'+encodeURIComponent(AfianHandler.activeTab.items[i].input_value);
}
}
}
}
function showMenu(menuId){
if(activeMenu){
hideMenu(activeMenu);
}
meniu=getById(menuId);scroll_left=getScrollLeft();scroll_top=getScrollTop();if(meniu){
var leftPos=parseInt(currentX+20);var topPos=parseInt(currentY+15);if(leftPos+meniu.offsetWidth > getBodyW()+scroll_left-25){
leftPos=leftPos+((getBodyW()+scroll_left)-(leftPos+meniu.offsetWidth+25));
}
if(topPos+meniu.offsetHeight > getBodyH()+scroll_top-10){
topPos=topPos+((getBodyH()+scroll_top)-(topPos+meniu.offsetHeight)-10);
}
meniu.style.visibility='visible';meniu.style.left=leftPos;meniu.style.top=topPos;zindexcount=zindexcount++;meniu.style.zIndex=zindexcount;hideStupidMSIEElements(meniu);if(menuId!='popmenu-alert' && menuId!='popmenu-prompt' && menuId.indexOf('context')==-1){
activeMenu=menuId;
}
}
}
function hideMenu(menuId){
getById(menuId).style.visibility='hidden';showStupidMSIEElements();
}
function centeredMenu(menuId){
if(activeMenu){
hideMenu(activeMenu);
}
scroll_left=getScrollLeft();scroll_top=getScrollTop();meniu=getById(menuId);leftPos=(getBodyW()/2)-(meniu.offsetWidth/2);topPos=(getBodyH()/2)-(meniu.offsetHeight/2);if(meniu.offsetHeight > getBodyH()){
topPos=20;
}
meniu.style.left=leftPos;meniu.style.top=topPos+scroll_top;meniu.style.visibility='visible';zindexcount=zindexcount++;meniu.style.zIndex=zindexcount;hideStupidMSIEElements(meniu);if(menuId!='popmenu-alert' && menuId!='popmenu-prompt'){
activeMenu=menuId;
}
}
function getBreadCrumbs(startHTML, path, endHTML){
str='';splited=path.split('/');pt='';if(splited.length==1){
return path;
}else{
for (var i=0 ;i < splited.length;i++){
pt=gluePath([pt, splited[i]]);str += startHTML+splited[i]+endHTML;str=str.replace(/PATH/g, pt);if(splited[i+1]!=undefined){
if(splited[i+1].substring(0, 1)!='/'){
str += '/';
}
}
}
return str;
}
}
function btnOnMUp(){this.className='button';}
function btnOnMDown(){this.className='pushedbutton';}
function btnOnMOut(){this.className='button';}
function buttonize(){
buttons=document.getElementsByTagName('TABLE');for (var i=0 ;i < buttons.length;i++){
if(buttons[i].className=='button'){
histd=buttons[i];histd.onmouseup=btnOnMUp;histd.onmousedown=btnOnMDown;histd.onmouseout=btnOnMOut;
}
}
}
function styleDisableButton(id){
if(!AfianUserPermissions['ui_has_tree']){
return true;
}
btn=getById(id);if(is.IE){
btn.disabled=true;
}else{
btn.style.color='gray';
}
}
function styleEnableButton(id){
if(!AfianUserPermissions['ui_has_tree']){
return true;
}
btn=getById(id);if(is.IE){
btn.disabled=false;
}else{
btn.style.color='black';
}
}
function toggleView(how){
if(AfianHandler.activeTab.section=='browseshare'){
postfix='-bshare';
}else{
postfix='';
}
iBtn=getById('iconBtn'+postfix);lBtn=getById('listBtn'+postfix);tBtn=getById('thumbBtn'+postfix);if(how=='icons'){
iBtn.className='viewModeSelected';lBtn.className='viewMode';tBtn.className='viewMode';
} else if(how=='list'){
iBtn.className='viewMode';lBtn.className='viewModeSelected';tBtn.className='viewMode';
}else{
iBtn.className='viewMode';lBtn.className='viewMode';tBtn.className='viewModeSelected';
}
}
function changeView(how){
tb=AfianHandler.activeTab;tb.viewMode=how;tb.destroyItems();tb.buildItems();tb.showItems();setCookie('AfianViewMode', how);
}
afian_submenus=new Array;function Afian_SubMenu(menuid, left, top){
this.obj=getById(menuid);afian_submenus[menuid]=this;this.obj.onmouseover= new Function('Afian_SubMenu.Pause(\''+menuid+'\')');this.obj.onmouseout= new Function('Afian_SubMenu.Out(\''+menuid+'\')');this.obj.onclick= new Function('Afian_SubMenu.Out(\''+menuid+'\')');this.obj.onfocus=new Function('blur()');
}
Afian_SubMenu.Over=function(menuid, left, top){
if(!afian_submenus[menuid].draw){
clearTimeout(afian_submenus[menuid].stopTimer);afian_submenus[menuid].startTimer=setTimeout('Afian_SubMenu.Draw(\''+menuid+'\', \''+left+'\', \''+top+'\')', '0');
}else{
Afian_SubMenu.Pause(menuid);
}
if(Afian_SubMenu.activeMenuId!=menuid && Afian_SubMenu.activeMenuId!=undefined){
Afian_SubMenu.Hide(Afian_SubMenu.activeMenuId);
}
}
Afian_SubMenu.Draw=function(menuid, left, top){
afian_submenus[menuid].draw=true;menu=afian_submenus[menuid].obj;menu.style.left=left;menu.style.top=top;menu.style.display='block';zindexcount++;getById('afian_hmenu').style.zIndex=zindexcount;Afian_SubMenu.activeMenuId=menuid;
}
Afian_SubMenu.Out=function(menuid){
clearTimeout(afian_submenus[menuid].startTimer);afian_submenus[menuid].stopTimer=setTimeout('Afian_SubMenu.Hide(\''+menuid+'\')', 100);
}
Afian_SubMenu.Hide=function(menuid){
menu=afian_submenus[menuid].obj;menu.style.display='none';afian_submenus[menuid].draw=false;
}
Afian_SubMenu.Pause=function(menuid){
clearTimeout(afian_submenus[menuid].stopTimer);
}
function fileNameExists(name){
for (var i=0;i < AfianHandler.activeTab.items.length;i++){
if(AfianHandler.activeTab.items[i]!=undefined){
if(AfianHandler.activeTab.items[i].icon_title==name){
return true;
}
}
}
return false;
}
function makeDragable(objid){
Drag.init(getById(objid),null);
}
function titleDrag(objid){
Drag.init(getById('popmenu-titlebar-'+objid), getById('popmenu-'+objid));
}
function makePopMenu(id){
tp=getById('popmenu-top-'+id);mid=getById('popmenu-middle-'+id);bot=getById('popmenu-bottom-'+id);content=popMenuTemplate.replace('POPM_TOP', tp.innerHTML);content=content.replace('POPM_MIDDLE', mid.innerHTML);content=content.replace('POPM_BOTTOM', bot.innerHTML);content=content.replace('POPM_ID', 'popmenu-titlebar-'+id);tp.innerHTML='';mid.innerHTML='';bot.innerHTML='';getById('popmenu-'+id).innerHTML=content;
}
function AfianAlert(str){
getById('popmenu-alert-message').innerHTML=str;centeredMenu('popmenu-alert');
}
function AfianPrompt(str, buttons){
getById('popmenu-prompt-message').innerHTML=str;str='';for (var i=0 ;i < buttons.length;i++){
str += '<td><table cellspacing="0" cellpadding="0" class="button" onclick="javascript:'+buttons[i]['onclick']+'"><tr><td align="center">'+buttons[i]['title']+'</td></tr></table></td>';
}
getById('popmenu-prompt-buttons').innerHTML='<table border="0" cellpadding="1" cellspacing="0"><tr>'+str+'</tr></table>';buttonize();centeredMenu('popmenu-prompt');
}
function addUploadFields(){
if(is.Opera){
AfianAlert('Opera browser does not support this feature.');
}else{
tr=document.createElement('TR');td=document.createElement('TD');td.align='right';td.innerHTML='<input type="file" name="uploadfiles[]" class="inputfile" onFocus="javascript:writing=true;" onBlur="javascript:writing=false;" name="upload_extra_fileds[]">';tr.appendChild(td);getById('afian_upload_fields').appendChild(tr);
}
}
function msg(type, simplealert){
if(simplealert){
fnc=alert;
}else{
fnc=AfianAlert;
}
if(type=='noperm'){
fnc(AfianMessages['You are not allowed to perform this operation']);
} else if(type=='nospace'){
fnc(AfianMessages['Not enough space']);
} else if(type=='notraffic'){
fnc(AfianMessages['Traffic quota exceeded']);
}else{
fnc(AfianMessages['Option unavailable']);
}
}
function setQuotaIndicators (wich, curr, quota){
prefix=(wich=='space')?'space':'traffic';proc=Math.round((curr*100)/quota);getById(prefix+'_curr').style.width=proc+'%';getById(prefix+'_curr_num').innerHTML=formatFileSize(curr);getById(prefix+'_quota_num').innerHTML=formatFileSize(quota);getById(prefix+'_txt').style.color= (curr >= quota)?'red':'dimgray';
}
function AdminLoadCalendar(uid){
cali=getById('califrame');cali.setAttribute('src', 'javascript:document.write(\'<body style="border:1px solid silver;padding:5px;font-size:11px;font-family: verdana, tahoma, arial, sans-serif;color:#363636;" bgcolor="#E4E4E4">'+AfianMessages['Loading, please wait...']+'</body>\')');window.setTimeout('loadCalendarUID('+uid+')', 500);
}
function loadCalendarUID(uid){
cali.setAttribute('src', '?file=calendar'+((uid)?'&uid='+uid:'')+'');
}
var hideinterval;function AfianBubbleMessage(str, delay){
if(str.length==0){
hidePopupMessage();
}
if(!delay){
delay=2100;
}
if(hideinterval){
window.clearInterval(hideinterval);
}
container=getById('bubbleMessage');container.innerHTML=str;container.style.visibility='visible';hideinterval=window.setInterval('hidePopupMessage()',delay);
}
function hidePopupMessage(){
getById('bubbleMessage').style.visibility='hidden';if(hideinterval){
window.clearInterval(hideinterval);
}
}
function debugMode(how){
ic=document.getElementById('iframesContainer');if(how==false){
ic.style.display='none';
}else{
ic.style.display='block';
}
}
var dragstarted;var AfianTreeConfig={
rootIcon : 'images/tree/foldericon.gif',
openRootIcon : 'images/tree/openfoldericon.gif',
folderIcon : 'images/tree/foldericon.gif',
openFolderIcon : 'images/tree/openfoldericon.gif',
fileIcon : 'images/tree/file.gif',
iIcon : 'images/tree/i.gif',
lIcon : 'images/tree/l.gif',
lMinusIcon : 'images/tree/lminus.gif',
lPlusIcon : 'images/tree/lplus.gif',
tIcon : 'images/tree/t.gif',
tMinusIcon : 'images/tree/tminus.gif',
tPlusIcon : 'images/tree/tplus.gif',
blankIcon : 'images/tree/blank.gif',
defaultText : 'Tree Item',
defaultAction : 'javascript:void(0);',
defaultBehavior : 'explorer',
loadingText: AfianMessages['Loading...'],
reloadingText: AfianMessages['Reloading...']
};var selectedPath;var AfianTreeHandler={
idCounter : 0,
idPrefix : "afian_tree_",
all : new Array,
all2 : new Array,
behavior : null,
selected : null,
onSelect : null,
getId : function(){ return this.idPrefix + this.idCounter++;},
toggle : function (oItem){ this.all[oItem.id.replace('-plus','')].toggle();},
idtoggle : function (id){ this.all[id].toggle();},
reload : function (oItem){
this.all[oItem.id.replace('-icon','')].reload();
},
dropdrag: function (oItem){
this.all[oItem.id.replace('-anchor','')].dropdrag();
},
mouseover: function (oItem){
this.all[oItem.id.replace('-anchor','')].mouseover();
},
mouseout: function (oItem){
this.all[oItem.id.replace('-anchor','')].mouseout();
},
select : function (oItem){ this.all[oItem.id.replace('-anchor','')].select();},
blur : function (oItem){ this.all[oItem.id.replace('-anchor','')].blur();},
rootOnClick: function(){},
insertHTMLBeforeEnd:function (oElement, sHTML){
if(oElement.insertAdjacentHTML!=null){
oElement.insertAdjacentHTML("BeforeEnd", sHTML)
return;
}
var df;var r=oElement.ownerDocument.createRange();r.selectNodeContents(oElement);r.collapse(false);df=r.createContextualFragment(sHTML);oElement.appendChild(df);
}
};function AfianTreeAbstractNode(sText, sAction){
this.childNodes=[];this.id=AfianTreeHandler.getId();this.text=sText || AfianTreeConfig.defaultText;this.action=sAction || AfianTreeConfig.defaultAction;this._last=false;this.all2index=AfianTreeHandler.all2.length;AfianTreeHandler.all[this.id]=this;AfianTreeHandler.all2[this.all2index]=this;
}
AfianTreeAbstractNode.prototype.add=function (node, bNoIdent){
node.parentNode=this;this.childNodes[this.childNodes.length]=node;var root=this;if(this.childNodes.length >= 2){
this.childNodes[this.childNodes.length - 2]._last=false;
}
while (root.parentNode){ root=root.parentNode;}
if(root.rendered){
if(this.childNodes.length >= 2){
getById(this.childNodes[this.childNodes.length - 2].id + '-plus').src=((this.childNodes[this.childNodes.length -2].folder)?((this.childNodes[this.childNodes.length -2].open)?AfianTreeConfig.tMinusIcon:AfianTreeConfig.tPlusIcon):AfianTreeConfig.tIcon);this.childNodes[this.childNodes.length - 2].plusIcon=AfianTreeConfig.tPlusIcon;this.childNodes[this.childNodes.length - 2].minusIcon=AfianTreeConfig.tMinusIcon;this.childNodes[this.childNodes.length - 2]._last=false;
}
this._last=true;var foo=this;while (foo.parentNode){
for (var i=0;i < foo.parentNode.childNodes.length;i++){
if(foo.id==foo.parentNode.childNodes[i].id){ break;}
}
if(i==foo.parentNode.childNodes.length - 1){ foo.parentNode._last=true;}
else { foo.parentNode._last=false;}
foo=foo.parentNode;
}
AfianTreeHandler.insertHTMLBeforeEnd(getById(this.id + '-cont'), node.toString());if((!this.folder) && (!this.openIcon)){
this.icon=AfianTreeConfig.folderIcon;this.openIcon=AfianTreeConfig.openFolderIcon;
}
if(!this.folder){ this.folder=true;this.collapse(true);}
if(!bNoIdent){ this.indent();}
}
return node;
}
AfianTreeAbstractNode.prototype.toggle=function(){
if(this.folder){
if(this.open){ this.collapse();}
else { this.expand();}
}}
AfianTreeAbstractNode.prototype.select=function(){
if((AfianTreeHandler.selected) && (AfianTreeHandler.selected!=this) && (AfianTreeHandler.all[AfianTreeHandler.selected.id]!=undefined)){ AfianTreeHandler.selected.deSelect();
}
AfianTreeHandler.selected=this;if((this.openIcon)){
getById(this.id + '-icon').src=this.openIcon;
}
getById(this.id + '-anchor').className='tree-item-fulltitle-selected';if(AfianTreeHandler.onSelect){ AfianTreeHandler.onSelect(this);}
}
AfianTreeAbstractNode.prototype.deSelect=function(){
getById(this.id + '-anchor').className='tree-item-fulltitle';if((this.openIcon)){
getById(this.id + '-icon').src=this.icon;
}
AfianTreeHandler.selected=null;
}
AfianTreeAbstractNode.prototype.doExpand=function(){
/*if(AfianTreeHandler.behavior=='classic'){ getById(this.id + '-icon').src=this.openIcon;}*/
if(this.childNodes.length){ getById(this.id + '-cont').style.display='block';}
this.open=true;
}
AfianTreeAbstractNode.prototype.doCollapse=function(){
/*if(AfianTreeHandler.behavior=='classic'){ getById(this.id + '-icon').src=this.icon;}*/
if(this.childNodes.length){ getById(this.id + '-cont').style.display='none';}
this.open=false;
}
AfianTreeAbstractNode.prototype.expandAll=function(){
this.expandChildren();if((this.folder) && (!this.open)){ this.expand();}
}
AfianTreeAbstractNode.prototype.expandChildren=function(){
for (var i=0;i < this.childNodes.length;i++){
this.childNodes[i].expandAll();
} }
AfianTreeAbstractNode.prototype.collapseAll=function(){
this.collapseChildren();if((this.folder) && (this.open)){ this.collapse(true);}
}
AfianTreeAbstractNode.prototype.collapseChildren=function(){
for (var i=0;i < this.childNodes.length;i++){
this.childNodes[i].collapseAll();
} }
AfianTreeAbstractNode.prototype.indent=function(lvl, del, last, level, nodesLeft){
if(lvl==null){ lvl=-2;}
var state=0;for (var i=this.childNodes.length - 1;i >= 0 ;i--){
state=this.childNodes[i].indent(lvl + 1, del, last, level);if(state){ return;}
}
if(del){
if((level >= this._level) && (getById(this.id + '-plus'))){
if(this.folder){
getById(this.id + '-plus').src=(this.open)?AfianTreeConfig.lMinusIcon:AfianTreeConfig.lPlusIcon;this.plusIcon=AfianTreeConfig.lPlusIcon;this.minusIcon=AfianTreeConfig.lMinusIcon;
}
else if(nodesLeft){ getById(this.id + '-plus').src=AfianTreeConfig.lIcon;}
return 1;
}}
var foo=getById(this.id + '-indent-' + lvl);if(foo){
if((foo._last) || ((del) && (last))){ foo.src=AfianTreeConfig.blankIcon;}
else { foo.src=AfianTreeConfig.iIcon;}
}
return 0;
}
function AfianTree(sText, sAction, sBehavior, sIcon, sOpenIcon){
this.base=AfianTreeAbstractNode;this.base(sText, sAction);this.icon=sIcon || AfianTreeConfig.rootIcon;this.openIcon=sOpenIcon || AfianTreeConfig.openRootIcon;this.open=true;this.folder=true;this.rendered=false;this.onSelect=null;if(!AfianTreeHandler.behavior){ AfianTreeHandler.behavior=sBehavior || AfianTreeConfig.defaultBehavior;}
}
AfianTree.prototype=new AfianTreeAbstractNode;AfianTree.prototype.setBehavior=function (sBehavior){
AfianTreeHandler.behavior=sBehavior;
};AfianTree.prototype.getBehavior=function (sBehavior){
return AfianTreeHandler.behavior;
};AfianTree.prototype.getSelected=function(){
if(AfianTreeHandler.selected){ return AfianTreeHandler.selected;}
else { return null;}
}
AfianTree.prototype.remove=function(){ }
AfianTree.prototype.expand=function(){
this.doExpand();
}
AfianTree.prototype.collapse=function(b){
this.doCollapse();
}
AfianTree.prototype.getFirst=function(){
return null;
}
AfianTree.prototype.getLast=function(){
return null;
}
AfianTree.prototype.getNextSibling=function(){
return null;
}
AfianTree.prototype.getPreviousSibling=function(){
return null;
}
AfianTree.prototype.toString=function(){
var str="<div id=\"" + this.id + "\" class=\"afian-tree-item\">" +
"<span class=\"tree-item-fulltitle\" onclick=\"" + this.action + "\"><img id=\"" + this.id + "-icon\" class=\"afian-tree-icon\" src=\"" + ((AfianTreeHandler.behavior=='classic' && this.open)?this.openIcon:this.icon) + "\" onclick=\"AfianTreeHandler.rootOnClick();\">" +
"<span class=\"tree-item-title\">" + this.text + "</span></span></div>" +
"<div id=\"" + this.id + "-cont\" class=\"afian-tree-container\" style=\"display: " + ((this.open)?'block':'none') + ";\">";var sb=[];for (var i=0;i < this.childNodes.length;i++){
sb[i]=this.childNodes[i].toString(i, this.childNodes.length);
}
this.rendered=true;return str + sb.join("") + "</div>";
};function AfianTreeItem(sText, sAction, eParent, sIcon, sOpenIcon, dynamic){
this.base=AfianTreeAbstractNode;this.base(sText, sAction);this.dynamic=dynamic;if(AfianTreeConfig.usePersistence){
this.open=(AfianTreeHandler.cookies.getCookie(this.id.substr(18,this.id.length - 18))=='1')?true:false;
}else{ this.open=false;}
if(sIcon){ this.icon=sIcon;}
if(sOpenIcon){ this.openIcon=sOpenIcon;}
if(eParent){ eParent.add(this);}
}
AfianTreeItem.prototype=new AfianTreeAbstractNode;AfianTreeItem.prototype.remove=function(){
var iconSrc=getById(this.id + '-plus').src;var parentNode=this.parentNode;var prevSibling=this.getPreviousSibling(true);var nextSibling=this.getNextSibling(true);var folder=this.parentNode.folder;var last=((nextSibling) && (nextSibling.parentNode) && (nextSibling.parentNode.id==parentNode.id))?false:true;this._remove();if(parentNode.childNodes.length==0){
getById(parentNode.id + '-cont').style.display='none';parentNode.doCollapse();parentNode.folder=false;parentNode.open=false;
}
if(!nextSibling || last){ parentNode.indent(null, true, last, this._level, parentNode.childNodes.length);}
if((prevSibling==parentNode) && !(parentNode.childNodes.length)){
prevSibling.folder=false;prevSibling.open=false;iconSrc=getById(prevSibling.id + '-plus').src;iconSrc=iconSrc.replace('minus', '').replace('plus', '');getById(prevSibling.id + '-plus').src=iconSrc;getById(prevSibling.id + '-icon').src=prevSibling.icon;
}
if(getById(prevSibling.id + '-plus')){
if(parentNode==prevSibling.parentNode){
iconSrc=iconSrc.replace('minus', '').replace('plus', '');getById(prevSibling.id + '-plus').src=iconSrc;
}}}
AfianTreeItem.prototype._remove=function(){
for (var i=this.childNodes.length - 1;i >= 0;i--){
this.childNodes[i]._remove();
 }
for (var i=0;i < this.parentNode.childNodes.length;i++){
if(this==this.parentNode.childNodes[i]){
for (var j=i;j < this.parentNode.childNodes.length;j++){
this.parentNode.childNodes[j]=this.parentNode.childNodes[j+1];
}
this.parentNode.childNodes.length -= 1;if(i + 1==this.parentNode.childNodes.length){ this.parentNode._last=true;}
break;
}}
AfianTreeHandler.all[this.id]=null;delete AfianTreeHandler.all2[this.all2index];var tmp=getById(this.id);if(tmp){ tmp.parentNode.removeChild(tmp);}
tmp=getById(this.id + '-cont');if(tmp){ tmp.parentNode.removeChild(tmp);}
}
AfianTreeItem.prototype.expand=function(){
this.doExpand();getById(this.id + '-plus').src=this.minusIcon;
}
AfianTreeItem.prototype.collapse=function(b){
this.doCollapse();getById(this.id + '-plus').src=this.plusIcon;
}
AfianTreeItem.prototype.getFirst=function(){
return this.childNodes[0];
}
AfianTreeItem.prototype.getLast=function(){
if(this.childNodes[this.childNodes.length - 1].open){ return this.childNodes[this.childNodes.length - 1].getLast();}
else { return this.childNodes[this.childNodes.length - 1];}
}
AfianTreeItem.prototype.getNextSibling=function(){
for (var i=0;i < this.parentNode.childNodes.length;i++){
if(this==this.parentNode.childNodes[i]){ break;}
}
if(++i==this.parentNode.childNodes.length){ return this.parentNode.getNextSibling();}
else { return this.parentNode.childNodes[i];}
}
AfianTreeItem.prototype.getPreviousSibling=function(b){
for (var i=0;i < this.parentNode.childNodes.length;i++){
if(this==this.parentNode.childNodes[i]){ break;}
}
if(i==0){ return this.parentNode;}
else {
if((this.parentNode.childNodes[--i].open) || (b && this.parentNode.childNodes[i].folder)){ return this.parentNode.childNodes[i].getLast();}
else { return this.parentNode.childNodes[i];}
} }
AfianTreeItem.prototype.toString=function (nItem, nItemCount){
var foo=this.parentNode;var indent='';if(nItem + 1==nItemCount){ this.parentNode._last=true;}
var i=0;while (foo.parentNode){
foo=foo.parentNode;indent="<img id=\"" + this.id + "-indent-" + i + "\" src=\"" + ((foo._last)?AfianTreeConfig.blankIcon:AfianTreeConfig.iIcon) + "\" alt=\"\" width=\"19\" height=\"16\">" + indent;i++;
}
this._level=i;if(this.childNodes.length){ this.folder=1;}
else { this.open=false;}
if((this.folder) || (AfianTreeHandler.behavior!='classic')){
if(!this.icon){ this.icon=AfianTreeConfig.folderIcon;}
if(!this.openIcon){ this.openIcon=AfianTreeConfig.openFolderIcon;}
}
else if(!this.icon){ this.icon=AfianTreeConfig.fileIcon;}
var label=this.text.replace(/</g, '&lt;').replace(/>/g, '&gt;');var str="<div id=\"" + this.id + "\" class=\"afian-tree-item\" >" +
indent +
"<img id=\"" + this.id + "-plus\" src=\"" + ((this.folder)?((this.open)?((this.parentNode._last)?AfianTreeConfig.lMinusIcon:AfianTreeConfig.tMinusIcon):((this.parentNode._last)?AfianTreeConfig.lPlusIcon:AfianTreeConfig.tPlusIcon)):((this.parentNode._last)?AfianTreeConfig.lIcon:AfianTreeConfig.tIcon)) + "\" onclick=\"AfianTreeHandler.toggle(this);\" width=\"19\" height=\"16\" alt=\"\" onmouseover=\"check4dragTreePlus(this)\" onmouseout=\"cancelCheck4dragTreePlus(this)\">" +
"<span class=\"tree-item-fulltitle\" onclick=\"" + ((this.action!='X')?this.action:'javascript:AfianTreeHandler.idtoggle(\''+this.id+'\')') + "\" id=\"" + this.id + "-anchor\" " +
(this.target ? " target=\"" + this.target + "\"" : "") +
" onmouseup=\"AfianTreeHandler.dropdrag(this)\" onmouseover=\"AfianTreeHandler.mouseover(this)\" onmouseout=\"AfianTreeHandler.mouseout(this)\"><img id=\"" + this.id + "-icon\" class=\"afian-tree-icon\" src=\"" + ((this.open)?this.openIcon:this.icon) + "\" width=\"16\" height=\"16\">" +
"<span class=\"tree-item-title\">" + label + "</span></span></div>" +
"<div id=\"" + this.id + "-cont\" class=\"afian-tree-container\" style=\"display: " + ((this.open)?'block':'none') + ";\">";
/*"+((this.MyFilesItem)?"title=\"Click to browse '"+this.path+"'\"":"")+"*/
var sb=[];for (var i=0;i < this.childNodes.length;i++){
sb[i]=this.childNodes[i].toString(i,this.childNodes.length);
}
this.plusIcon=((this.parentNode._last)?AfianTreeConfig.lPlusIcon:AfianTreeConfig.tPlusIcon);this.minusIcon=((this.parentNode._last)?AfianTreeConfig.lMinusIcon:AfianTreeConfig.tMinusIcon);return str + sb.join("") + "</div>";
}
function check4dragTreePlus(item){
if(dragstarted){
item=AfianTreeHandler.all[item.id.replace('-plus','')];if(item.MyFilesItem){
if(!item.open){
item.toggleTimeOut=window.setTimeout('AfianTreeHandler.idtoggle(\''+item.id+'\')', 500);
}
}
}
}
function cancelCheck4dragTreePlus(item){
if(dragstarted){
item=AfianTreeHandler.all[item.id.replace('-plus','')];if(item.toggleTimeOut){
window.clearTimeout(item.toggleTimeOut);
}
}
}
function AfianDynTree(sText, sXmlSrc, sAction, sBehavior, sIcon, sOpenIcon){
this.AfianTree=AfianTree;this.AfianTree(sText, sAction, sBehavior, sIcon, sOpenIcon);this.src=sXmlSrc;this.loading=false;this.loaded=false;this.errorText="";if(this.open)
AfianTreeLoadData(this.src, this);else {
this._loadingItem=new AfianTreeItem(AfianTreeConfig.loadingText);this.add(this._loadingItem);
}
}
AfianDynTree.prototype=new AfianTree;AfianDynTree.prototype._AfianTree_expand=AfianTree.prototype.expand;AfianDynTree.prototype.expand=function(){
if(!this.loaded && !this.loading){
AfianTreeLoadData(this.src, this);
}
this._AfianTree_expand();
};function AfianDynTreeItem(sText, sXmlSrc, sAction, eParent, sIcon, sOpenIcon){
this.AfianTreeItem=AfianTreeItem;this.AfianTreeItem(sText, sAction, eParent, sIcon, sOpenIcon, true);this.src=sXmlSrc;this.loading=false;this.loaded=false;this.errorText="";if(this.open)
AfianTreeLoadData(this.src, this);else {
this._loadingItem=new AfianTreeItem(AfianTreeConfig.loadingText);this.add(this._loadingItem);
}
}
AfianDynTreeItem.prototype=new AfianTreeItem;AfianDynTreeItem.prototype._AfianTreeitem_expand=AfianTreeItem.prototype.expand;AfianDynTreeItem.prototype.expand=function(){
if(!this.loaded && !this.loading){
AfianTreeLoadData(this.src, this);
}
this._AfianTreeitem_expand();
};AfianDynTree.prototype.reload =
AfianDynTreeItem.prototype.reload=function (){
if(this.loaded){
var open=this.open;while (this.childNodes.length > 0)
this.childNodes[this.childNodes.length - 1].remove();this.loaded=false;this._loadingItem=new AfianTreeItem(AfianTreeConfig.reloadingText);this.add(this._loadingItem);
 this.expand();
 
 
 if(AfianTreeHandler.selected){
selectedPath=AfianTreeHandler.selected.path;
}
if(selectedPath){
this.onreload=new Function('onreload(\''+addSingleSlashess(selectedPath)+'\')');
}
 
 
}
else if(this.open && !this.loading)
AfianTreeLoadData(this.src, this);
};function AfianTreeLoadData(sSrc, jsNode){
if(jsNode.loading || jsNode.loaded)
return;jsNode.loading=true;ifrm=newHiddenIframe(jsNode.id+'-tree-iframe')
ifrm.src=sSrc+'&id='+jsNode.id;jsNode.iframe=ifrm;
}
function FolderBrowserLoadTreeItem(oNode){
var text=oNode["text"];var parent=null;var icon=oNode["icon"];var openIcon=AfianTreeConfig.openFolderIcon;var target=oNode["target"];var path=oNode['path'];var dynamic=true;var action='javascript:writePath(\''+addSingleSlashess(path)+'\', \''+addSingleSlashess(text)+'\')';var src='index.php?folder_browser_data_feeder=1&path='+encodeURIComponent(path);var jsNode=new AfianDynTreeItem(text, src, action, parent, icon, openIcon, dynamic);jsNode.path=path;return jsNode;
}
function MyFilesLoadTreeItem(oNode){
var text=oNode["text"];var parent=null;var icon=oNode["icon"];var openIcon=AfianTreeConfig.openFolderIcon;var target=oNode["target"];var path=oNode['path'];var dynamic=true;action='javascript:OpenTreeFolder(\''+addSingleSlashess(path)+'\', \''+addSingleSlashess(text)+'\')';var src='?file=tree_listing&path='+encodeURIComponent(path);var jsNode;if(src!=null && src!="")
jsNode=new AfianDynTreeItem(text, src, action, parent, icon, openIcon, dynamic);else
jsNode=new AfianTreeItem(text, action, parent, icon, openIcon);if(target!="")
jsNode.target=target;jsNode.path=path;jsNode.MyFilesItem=true;return jsNode;
}
function ListUser(oNode){
var text=oNode["text"];var parent=null;var icon="images/tree/afn.gif";var src='?listusers=1&sub=treelisting&uid='+oNode['uid'];var dynamic=true;var action='X';var jsNode;jsNode=new AfianDynTreeItem(text, src, action, parent, icon, icon, dynamic);jsNode.path=path;return jsNode;
}
function ListSharedFolder(oNode){
var text=oNode["text"];var parent=null;var icon=oNode["icon"];var openIcon=oNode["openIcon"];var target=oNode["target"];if(oNode['path']){
var path=oNode['path'];
}else{
var path='/'+text;
}
var src='?listusers=1&sub=treelisting&uid='+oNode['uid']+'&path='+oNode['uid']+'::'+encodeURIComponent(path);var action='javascript:openShare(\''+oNode['user']+'\', \''+oNode['uid']+'\', \''+path+'\')';var jsNode;jsNode=new AfianDynTreeItem(text, src, action, parent, icon, openIcon, true);jsNode.path=oNode['user']+'::'+path;return jsNode;
}
function AfianTreeDataLoaded(newIcons, jsParentNode, fnc){
if(jsParentNode.loaded)
return;if(!fnc){
fnc=MyFilesLoadTreeItem;
}
var bIndent=false;var bAnyChildren=false;jsParentNode.loaded=true;jsParentNode.loading=false;cs=newIcons
var l=cs.length;for (var i=0;i < l;i++){
bAnyChildren=true;bIndent=true;jsParentNode.add(fnc(cs[i]), true);
}
if(jsParentNode._loadingItem!=null){
jsParentNode._loadingItem.remove();bIndent=true;
}
AfianHandler.iframesContainer.removeChild(jsParentNode.iframe);if(bIndent){
jsParentNode.indent();
}
if(jsParentNode.errorText!="")
window.status=jsParentNode.errorText;if(jsParentNode.onreload){
jsParentNode.onreload();
}
}
function reloadTreeByPath(path){
for (var i=0 ;i < AfianTreeHandler.all2.length;i++){
if(AfianTreeHandler.all2[i]!=undefined && AfianTreeHandler.all2[i].path==path){
AfianTreeHandler.all2[i].reload();return;
}
}
}
function onreload(path){
toggleTreeByPath(path);
}
function toggleTreeByPath(path){
for (var i=0 ;i < AfianTreeHandler.all2.length;i++){
if((AfianTreeHandler.all2[i]!=undefined) && (AfianTreeHandler.all2[i].path==path)){
if(AfianTreeHandler.all2[i].folder){
if(!AfianTreeHandler.all2[i].open){
AfianTreeHandler.all2[i].expand();
}
}
AfianTreeHandler.all2[i].select();return;
}
}
}
function parseTree(treeitem, str){
for (var i=0 ;i < AfianTreeHandler.all2.length;i++){
if(AfianTreeHandler.all2[i]!=undefined){
str += AfianTreeHandler.all2[i].text;str += '\r\n';
}
}
return str;
}
function OpenTreeFolder(path, text){
bp=AfianHandler.activeTab.section;
//cd(path, (bp!='myfiles')?true:false, text);//opens in same tab
cd(path, true, text);
}
/* drag and drop */
AfianTreeAbstractNode.prototype.dropdrag=function (){
if(dragstarted){
if(this.MyFilesItem){
MyFilesDropDrag(this.path);
}else{
if(this.path=='trash@afian'){
MyFilesDel();
}
}
if(this.dragOverHilight){
this.mouseout();
}
}
};AfianTreeAbstractNode.prototype.mouseover=function (){
thea=getById(this.id+'-anchor');if(dragstarted){
if(this.MyFilesItem || this.path=='trash@afian'){
this.origBgColor=thea.style.backgroundColor;thea.style.backgroundColor='#d7d7d7';/*#B3E8FE*/
thea.style.textDecoration='none';this.dragOverHilight=true;
/*
getById('dragcontainer').style.border='1px solid gray';if(this.MyFilesItem){
AfianBubbleMessage('Move dragged items to \''+this.path+'\'', 10000);
}else{
AfianBubbleMessage('Move dragged items to Trash', 10000);
}
*/
}
}else{
thea.style.textDecoration='underline';thea.style.color='navy';
}
};AfianTreeAbstractNode.prototype.mouseout=function (){
thea=getById(this.id+'-anchor');if(dragstarted){
if(this.MyFilesItem || this.path=='trash@afian'){
if(this.origBgColor!=undefined){
thea.style.backgroundColor=this.origBgColor;thea.style.textDecoration='';this.dragOverHilight=false;delete this.origBgColor;
/*
getById('dragcontainer').style.border='none';AfianBubbleMessage('', 0);
*/
}
}
}else{
thea.style.textDecoration='none';thea.style.color='black';
}
};
/**************************************************
 * dom-drag.js
 * 09.25.2001
 * www.youngpup.net
 **************************************************/
var Drag={
obj : null,
init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
{
o.onmousedown= Drag.start;o.hmode= bSwapHorzRef ? false : true ;o.vmode= bSwapVertRef ? false : true ;o.root=oRoot && oRoot!=null ? oRoot : o ;if(o.hmode && isNaN(parseInt(o.root.style.left ))) o.root.style.left="0px";if(o.vmode && isNaN(parseInt(o.root.style.top ))) o.root.style.top="0px";if(!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right="0px";if(!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom="0px";o.minX= typeof minX!='undefined' ? minX : null;o.minY= typeof minY!='undefined' ? minY : null;o.maxX= typeof maxX!='undefined' ? maxX : null;o.maxY= typeof maxY!='undefined' ? maxY : null;o.xMapper=fXMapper ? fXMapper : null;o.yMapper=fYMapper ? fYMapper : null;o.root.onDragStart= new Function();o.root.onDragEnd= new Function();o.root.onDrag= new Function();o.root.onmouseover=function(){
zindexcount=zindexcount+100;this.style.zIndex=zindexcount;
}
},
start : function(e)
{
if(is.IE){
eveniment=window.event;
}else{
eveniment=e;
}
if(is.IE){
elementul=eveniment.srcElement;
}else{
elementul=eveniment.target;
}
if(elementul.tagName=='A' || elementul.tagName=='INPUT'){
document.onmousemove= null;document.onmouseup= null;return false;
}
var o=Drag.obj=this;e=Drag.fixE(e);var y=parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);var x=parseInt(o.hmode ? o.root.style.left : o.root.style.right );o.root.onDragStart(x, y);o.lastMouseX= e.clientX;o.lastMouseY= e.clientY;if(o.hmode){
if(o.minX!=null)o.minMouseX= e.clientX - x + o.minX;if(o.maxX!=null)o.maxMouseX= o.minMouseX + o.maxX - o.minX;
}else{
if(o.minX!=null) o.maxMouseX=-o.minX + e.clientX + x;if(o.maxX!=null) o.minMouseX=-o.maxX + e.clientX + x;
}
if(o.vmode){
if(o.minY!=null)o.minMouseY= e.clientY - y + o.minY;if(o.maxY!=null)o.maxMouseY= o.minMouseY + o.maxY - o.minY;
}else{
if(o.minY!=null) o.maxMouseY=-o.minY + e.clientY + y;if(o.maxY!=null) o.minMouseY=-o.maxY + e.clientY + y;
}
document.onmousemove= Drag.drag;document.onmouseup= Drag.end;return false;
},
drag : function(e){
e=Drag.fixE(e);var o=Drag.obj;hideStupidMSIEElements(Drag.obj.root);var ey= e.clientY;var ex= e.clientX;var y=parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);var x=parseInt(o.hmode ? o.root.style.left : o.root.style.right );var nx, ny;if(o.minX!=null) ex=o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);if(o.maxX!=null) ex=o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);if(o.minY!=null) ey=o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);if(o.maxY!=null) ey=o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);nx=x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));ny=y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));if(o.xMapper)nx=o.xMapper(y)
else if(o.yMapper)ny=o.yMapper(x)
Drag.obj.root.style[o.hmode ? "left" : "right"]=nx + "px";Drag.obj.root.style[o.vmode ? "top" : "bottom"]=ny + "px";Drag.obj.lastMouseX= ex;Drag.obj.lastMouseY= ey;Drag.obj.root.onDrag(nx, ny, Drag.obj);if(elementul.tagName!="IMG"){ /*MSIE image dragging workaround*/
return false;
}
},
end : function()
{
document.onmousemove=null;document.onmouseup=null;Drag.obj.root.onDragEnd(parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), 
parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]), Drag.obj);Drag.obj=null;
},
fixE : function(e)
{
if(typeof e=='undefined') e=window.event;if(typeof e.layerX=='undefined') e.layerX=e.offsetX;if(typeof e.layerY=='undefined') e.layerY=e.offsetY;return e;
}
};var allDropDownMenus=false;function preloadStupidMSIEElementsPosition(){
allDropDownMenus=document.getElementsByTagName('select');preloadedPositions=new Array;for (var i=0;i < allDropDownMenus.length;i++){
index=preloadedPositions.length;p=getAbsolutePos(allDropDownMenus[i]);preloadedPositions[index]=new Array;preloadedPositions[index]['object']=allDropDownMenus[i];preloadedPositions[index]['x']=p.x;preloadedPositions[index]['y']=p.y;preloadedPositions[index]['h']=allDropDownMenus[i].offsetHeight;preloadedPositions[index]['w']=allDropDownMenus[i].offsetWidth;preloadedPositions[index]['nohide']=allDropDownMenus[i].getAttribute('nohide');
}
}
function prelIsOver(dragElX, dragElY, dragElH, dragElW, i){
targetEl=preloadedPositions[i];if((dragElX > targetEl['x']+targetEl['w']) || (dragElX+dragElW < targetEl['x']) || (dragElY > targetEl['y']+targetEl['h']) || (dragElY+dragElH < targetEl['y'])){
return false;
}else{
if(targetEl['nohide']=="1"){
return false;
}else{
return true;
}
}
}
function getAbsolutePos(el){
var r={ x: el.offsetLeft, y: el.offsetTop };if(el.offsetParent){
var tmp=getAbsolutePos(el.offsetParent);r.x += tmp.x;r.y += tmp.y;
}
return r;
}
var tempDiv=Array;function hideStupidMSIEElements(dragEl){
dragElX=dragEl.offsetLeft;dragElY=dragEl.offsetTop;dragElH=dragEl.offsetHeight;dragElW=dragEl.offsetWidth;for (var i=0;i<allDropDownMenus.length;i++){
if(prelIsOver(dragElX,dragElY,dragElH,dragElW,i)){
/*
if(!tempDiv[i]){
tempDiv[i]=document.createElement("div");tempDiv[i].style.border='1px solid silver';tempDiv[i].style.backgroundColor='white';tempDiv[i].style.overflow='hidden';tempDiv[i].style.height=preloadedPositions[i]['h']+'px';tempDiv[i].style.width=preloadedPositions[i]['w']+'px';allDropDownMenus[i].parentNode.appendChild(tempDiv[i]);tempDiv[i].appendChild(allDropDownMenus[i]);
}
*/
allDropDownMenus[i].style.visibility='hidden';
}else{
/*
if(tempDiv[i]){
if(tempDiv[i].firstChild){
tempDiv[i].parentNode.appendChild(tempDiv[i].firstChild);
}
allDropDownMenus[i].parentNode.removeChild(tempDiv[i]);tempDiv[i]=false;
}*/
allDropDownMenus[i].style.width=preloadedPositions[i]['w']+1;allDropDownMenus[i].style.height=preloadedPositions[i]['h']+1;allDropDownMenus[i].style.visibility='inherit';
}
}
}
function showStupidMSIEElements(){
for (var i=0;i < allDropDownMenus.length;i ++){
allDropDownMenus[i].style.visibility='inherit';
}
}
