
function do_copy() {
	 holdtext.innerText = furl.innerText;
	 Copied = holdtext.createTextRange();
	 Copied.execCommand("Copy");
}
function do_delete(f_name, url){
	if(confirm('Are you sure you want to delete this file?')){
//		alert('Who the hell are you to delete my files?');
		document.location=url;
	}
}

/* LOGIN.JS */
function hide_login(){
	document.getElementById('login_j').className='login_j_i';
	document.getElementById('login_label').innerHTML='authorize';
}

function show_login(){
	document.getElementById('login_j').className='login_j_v';
	document.getElementById('login_label').innerHTML='&nbsp;';
}
function do_login(){
	document.forms.frm_login.submit();
	document.getElementById('login_j').innerHTML='Logging in…';
	return false;
}
/* /LOGIN.JS */

/* TOOLTIP.JS */

function mouseX(e) {

    if(e.pageX) {
        return e.pageX;
    }
    
    return e.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
}

function mouseY(e) {
   
   if(e.pageY) {
        return e.pageY;
    } 
    
    return e.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);    
}

function showTooltip(txt, myEv){
	var t=0;
	var l=0;
	t = mouseY(myEv) + 16;
	l = mouseX(myEv);
	tool_t=document.getElementById('tooltip');
	tool_t.className='tooltip_vis';
	tool_t.style.left=(l-15)+'px';
	tool_t.style.top=(t-15)+'px';
	tool_t.innerHTML='<img src="thumb.php?name='+txt+'&id='+Math.random()+'" alt="" />';
}
function hideTooltip(){
 document.getElementById('tooltip').className='tooltip_hid';
 document.getElementById('tooltip').innerHTML='';
}

function start_upload(){
  document.forms.frm.image.className='btn_file_i';
  document.getElementById('info').innerHTML+='<p style="color:#00aa00;"><img src="images/progress.gif" border="0" alt="" /> Uploading...</p>';
//  document.forms.frm.style.visibility='hidden';
  document.getElementById('content').style.visibility='hidden';
  document.forms.frm.submit();
}

/* /TOOLTIP.JS */


function addRow(f_chmod, f_modified, f_size, f_name, r_f_name){
	var tbl = top.document.getElementById('f_listing');
	var _table = tbl.insertRow(0);
	_table.className='cur';
  
  var cell0 = _table.insertCell(0);
  var cell1 = _table.insertCell(1);
  var cell2 = _table.insertCell(2);
  var cell3 = _table.insertCell(3);
  var cell4 = _table.insertCell(4);
  var cell5 = _table.insertCell(5);

  cell1.className='num';
  cell1.className='finfo';
  cell2.className='minfo';
  cell3.className='fsize';
  cell4.className='fname';
  cell5.className='fdel';

  cell0.innerHTML = '0:';
  cell1.innerHTML = f_chmod;
  cell2.innerHTML = f_modified;
  cell3.innerHTML = f_size;
  cell4.innerHTML = f_name;
  cell5.innerHTML = r_f_name;
  
}
function removeRow(rows)
{ var _row = rows.parentElement.parentElement;
  document.getElementById('f_listing').deleteRow(_row.rowIndex);
}



/* RENAME */
function show_mv(f_name, e){
	if (!e) var e = window.event;
	var mvbox=document.getElementById('mv_j');
	mvbox.className='mv_j_v';
	var html;
	var t=0;
	var l=0;
	html='';
	html+='<form name="frm_mv" action="index.php" method="post">';
	html+=' <input type="hidden" name="o_name" value="'+f_name+'" />';
	html+=' <input type="hidden" name="act" value="mv" />';
	html+=' <p><strong>Old name:</strong> '+f_name+'</p>';
	html+=' <p><strong>New name:</strong> <input type="text" name="n_name" value="'+f_name+'" /></p>';
	html+=' <p><a href="javascript:do_mv();return;">Rename</a> | <a href="javascript:hide_mv();">Cancel</a></p>';
	html+='</form>';


	t=l=80;


	t = mouseY(e)+16;
	l = mouseX(e);
	mvbox.innerHTML=html;
	
	document.getElementById('mv_j').style.top=t+'px';
	document.getElementById('mv_j').style.left=l+'px';

}
function hide_mv(){
	document.getElementById('mv_j').className='mv_j_i';
}
function do_mv(){
	document.forms.frm_mv.submit();
}
/* /RENAME */



var btn_list_o='upload (-)';
var btn_list_c='upload (+)';
var velocity=50;
function roll(id, btn_id){
	var cur_style='';
	var max_h=120;
	var min_h=0;
	cur_style=document.getElementById(id).className;
	if(cur_style=='invis'){
		btn_list_c=document.getElementById(btn_id).innerHTML;
		document.getElementById(btn_id).innerHTML=btn_list_o;
		document.getElementById(id).className='vis';
		appear(id, min_h, max_h);
	}else{
		document.getElementById(btn_id).innerHTML=btn_list_c;
		max_h=document.getElementById(id).style.height.replace('px','');
		disappear(id, max_h, min_h);
	}
}
function appear(id, h, max_h){
	document.getElementById(id).style.height=h+'px';
	var call='appear(\''+id+'\', '+(h+velocity)+', '+max_h+')';
	if(h<max_h){
		return setTimeout(call, 1);
	}else	return 0;
}
function disappear(id, h, min_h){
	document.getElementById(id).style.height=h+'px';
	var call='disappear(\''+id+'\', '+(h-velocity)+', '+min_h+')';
	if(h>min_h){
		return setTimeout(call, 1);
	}else{
		document.getElementById(id).className='invis';
		return 0;
	}
}

function uf_size (pathField, previewName) { 
	var str = ''; 
	var path = pathField.value; 
	document[previewName].src = 'file://'+path.replace(/\\/gi,'/'); 
	var img = new Image(); 
	img.src = 'file://'+path.replace(/\\/gi,'/'); 
	var size_pic = document.getElementById(previewName).filesize; 
	str = "file size="+size_pic; 
	return (str); 
}


/*
function getMousePosition(e) {

	mouseX = window.event.x + document.body.scrollLeft;

	mouseY = window.event.y + document.body.scrollTop;

	mouseOut = false;

	if (followMouse) {

		diva.style.left = mouseX - pic.width / 2;

		diva.style.top = mouseY - pic.height / 2;

		   }

}
*/
