<!--
//////////////////////////// editation mode /////////////////////////////////
var active_el;

function pws_edit(obj) {
	if (obj != active_el) {
		pws_set_child_style(obj.firstChild.style);
		//obj.firstChild.style.left = obj.firstChild.nextSibling["offsetLeft"];//computePlacement(obj.firstChild.nextSibling, "offsetLeft");
		//obj.firstChild.style.top = obj.firstChild.nextSibling["offsetTop"]; //computePlacement(obj.firstChild.nextSibling, "offsetTop");
		autoscaling(obj);
		obj.onclick = function () {pws_stay(this);}
		obj.onmouseout = function () {pws_hide_not_active(this);}
	}
}

function pws_stay(obj) {
	var hide_obj = active_el;
	active_el = obj;
	if (obj.getElementsByTagName('LABEL')[0])
		obj.getElementsByTagName('LABEL')[0].style.display='block';
	pws_hide_not_active(hide_obj);
}

function pws_hide_not_active(obj) {
	if (obj && obj != active_el)
		pws_hide(obj);
}

function pws_hide(obj) {
	obj.firstChild.style.display='none';
	if (obj == active_el)
		active_el = null;
}

function pws_set_child_style(styleobj) {
	styleobj.display = '';
	//styleobj.padding = '4px';
	//styleobj.txtAlign = 'left';
	//styleobj.background = '#000925';
	//styleobj.font = 'small tahoma';
	//styleobj.border = '1px outset #c0c0c0';
	//styleobj.position = 'absolute';
	//styleobj.zIndex = '2';
}

function pws_set_default_style(styleobj) {
	if (styleobj) {
		styleobj.border = '0px';
		styleobj.margin = '0px';
		styleobj.padding = '0px';
	}
}

//////////////////////////// explorer /////////////////////////////////

function detail_on(filename, size, image) {
  var objects = new Array("name", "force", "description");
  var node;
  var objElm;
  var newElm;
  var oldElm;
  var elmLink;
  for (var i=0; i<objects.length; i++) {
    node = document.getElementById(filename+"_"+objects[i]).firstChild
    objElm = document.getElementById("explorer_preview_"+objects[i]);
    newElm = document.createTextNode(node ? node.nodeValue : "...");
    objElm.replaceChild(newElm, objElm.firstChild);
  }
  var elmName = document.getElementById("explorer_preview_filename");
  var elmSize = document.getElementById("explorer_preview_size");
  var newName = document.createTextNode(filename);
	var newSize = document.createTextNode(size);
  var oldName = elmName.firstChild;
	var oldSize = elmSize.firstChild;

  elmName.replaceChild(newName, oldName);
	elmSize.replaceChild(newSize, oldSize);
  
  if (image.length) {
    (tmp = document.getElementById("explorer_preview_img")).style.display = "";
	  tmp.src = image;
	  tmp.alt = filename;
  }
  else
    document.getElementById("explorer_preview_img").style.display = "none";
    
	document.getElementById("explorer_preview_file").value = filename;
	document.getElementById("explorer_preview_submit").disabled = "";
	(elmLink = document.getElementById("explorer_preview_link")).href = document.getElementById(filename+"_link").firstChild.nodeValue;
	elmLink.style.display = 'block';
}

function detail_off(image) {
  var detail = document.getElementById("explorer_preview_detail");
  var newText = document.createTextNode('');
  var oldText = detail.firstChild;
  detail.replaceChild(newText, oldText);
  document.getElementById("explorer_preview_img").src = image;
}
  
function rename(file, name) {
  var elm = document.getElementById("explorer_rename");
  var elm_input = document.getElementById("new_name");
  elm_input.value = name;
  elm.action = "?input=file&action=rename&rename_file="+file;
  elm.className = "explorer_enabled";
  elm.disabled = "";
  document.getElementById("explorer_rename_submit").disabled = "";
}

function edit_attr(filename) {
  var node;
  var form = document.getElementById("explorer_edit");
  form.className = "explorer_enabled";
  form.disabled = "";
  document.getElementById("input_filename").value = filename;
  document.getElementById("input_name").value        = (node = document.getElementById(filename+"_name").firstChild)        ? node.nodeValue : '';
  document.getElementById("input_change").value      = (node = document.getElementById(filename+"_change").firstChild)      ? node.nodeValue : '';
  document.getElementById("input_force").value       = (node = document.getElementById(filename+"_force").firstChild)       ? node.nodeValue : '';
  document.getElementById("input_description").value = (node = document.getElementById(filename+"_description").firstChild) ? node.nodeValue : '';
}


function move_file(file) {
  document.getElementById("input_move_file").value = file;
  var tags = document.getElementsByTagName("A");
  for (var i=0; i<tags.length; i++) {
    if (tags[i].className.indexOf("explorer_move_to_dir") == -1) continue;
    tags[i].style.display = '';
  }
}

function move_to_dir(dir) {
  document.getElementById("input_move_to_dir").value = dir;
  document.getElementById("explorer_move").submit();
}

//////////////////////////// detail /////////////////////////////////

function detail_addRow(id){
  var tbody = document.getElementById(id).getElementsByTagName("TBODY")[0];
  var row = document.createElement("TR");
  var first_row;
  var cols;
  var count = 0;
  var i = 0;
  if (first_row = tbody.getElementsByTagName("TR")[0])
    if (cols = first_row.getElementsByTagName("TD"))
      count = cols.length;
  do {
    td = document.createElement("TD");
    td.style.border = "1px solid #C0C0C0";
    input = document.createElement("INPUT");
    input.name = 'detail['+tbody.getElementsByTagName("TR").length+'][]';
    input.type = 'text';
    input.style.margin = "0px";
    input.style.border = "0px";
    input.style.padding = "0px";
    input.style.background = "transparent";
    input.style.font = "100%, tahoma, verdana";
    td.appendChild(input);
    row.appendChild(td);
    i++;
  } while (i<count);
  tbody.appendChild(row);
}

function detail_addCol(id){
  var rows = document.getElementById(id).getElementsByTagName("TR");
  var td;
  var input;
  for (var i=0; i<rows.length; i++) {
    td = document.createElement("TD");
    td.style.border = "1px solid #C0C0C0";
    input = document.createElement("INPUT");
    input.name = 'detail['+i+'][]';
    input.type = 'text';
    input.style.margin = "0px";
    input.style.border = "0px";
    input.style.padding = "0px";
    input.style.background = "transparent";
    input.style.font = "100%, tahoma, verdana";
    td.appendChild(input);
    rows[i].appendChild(td);
  }
}
  
//////////////////////////// pws /////////////////////////////////

function edit_button_hover(button) {
	button.className = "pws_clear pws_edit pws_edit_hover";
	button.onmouseout = function () { this.className = "pws_clear pws_edit"; }
}

function autoscaling(parent) {
  if (!(textarea = parent.getElementsByTagName("textarea")[0]))
    return;
  var isset = parent.offsetWidth > 100;
  textarea.style.width =  isset ? (parent.offsetWidth+25)+"px" : 500+"px";
  textarea.style.height = isset ? (parent.offsetHeight+15)+"px" : 200+"px";
}

function addEvent(obj, evType, fn) {
  if (obj.addEventListener)
    obj.addEventListener(evType, fn, false);
  else if (obj.attachEvent)
    return obj.attachEvent("on"+evType, fn);
  else
    return false;
}

function listPane(obj, imgdir) {
	if (obj.nextSibling.style.display == 'none') {
		obj.nextSibling.style.display = '';
		obj.firstChild.src = imgdir + "minus.gif";
	}
	else {
		obj.nextSibling.style.display = 'none';
		obj.firstChild.src = imgdir + "plus.gif";
	} 
}

function computePlacement(element, atribut) {
  //computes placement of some element
  //use atribut  "offsetLeft" or "offsetTop"
  var placement = 0;
  while (element) {
    placement += element[atribut];
    element = element.offsetParent;
  }
  return placement;
}

var pws_image_frame = null;
var pws_image_background = null;

function pws_get_scrolltop() {
	if (window.innerHeight)
    return window.pageYOffset; // FF
  else if (document.documentElement && document.documentElement.scrollTop)
    return document.documentElement.scrollTop; // IE
  else if (document.body)
    return document.body.scrollTop;
  return 0;
}

function pws_get_scrollleft() {
	if (window.innerWidth)
    return window.pageXOffset; // FF
  else if (document.documentElement && document.documentElement.scrollLeft)
    return document.documentElement.scrollLeft; // IE
  else if (document.body)
    return document.body.scrollLeft;
  return 0;
}

function pws_display_image(element) {
	var tmpWidth = pws_get_scrollleft() + document.documentElement.clientWidth;
	var tmpHeight = pws_get_scrolltop() + document.documentElement.clientHeight;

	pws_image_background = document.createElement("div");
	pws_image_background.onclick = function() {this.parentNode.removeChild(this);};
	pws_image_background.className = 'pws_image_background';
	pws_image_background.style.width = (document.body.offsetWidth > tmpWidth ? document.body.offsetWidth : tmpWidth) + 'px';
	pws_image_background.style.height = (document.body.offsetHeight > tmpHeight ? document.body.offsetHeight : tmpHeight) + 'px';
	pws_image_background.innerHTML = '<div class="pws_image_loading" style="left: ' + ((document.documentElement.clientWidth - 52)/2) + 'px; top: ' + (pws_get_scrolltop() + (document.documentElement.clientHeight - 32)/2) + 'px">&nbsp;</div>';

	document.body.appendChild(pws_image_background);
	
  var image = document.createElement("img");
	image.onload = function() { pws_image_loaded(this); }
	image.alt = element.title;
	image.src = element.href;
}

function pws_image_loaded(image) {
		var newWidth = image.width * ((document.documentElement.clientHeight - 80) / image.height);
		if (newWidth > document.documentElement.clientWidth - 80) {
				image.height = image.height * ((document.documentElement.clientWidth - 80) / image.width);
				image.width = document.documentElement.clientWidth - 80;
		}
		else { 
				image.width = newWidth;
				image.height = document.documentElement.clientHeight - 80;
		}

	var topOffset = (document.documentElement.clientHeight - image.height - 40)/2;
	var stepsCount = 20;
	var widthStep = image.width/stepsCount;
	var heightStep = image.height/stepsCount;
	var delay = 240;
	
	pws_image_background.innerHTML = '<div class="pws_image_frame" style="width: 0px; height: 0px; top: ' + (pws_get_scrolltop() + (topOffset < 10 ? 10 : topOffset)) + 'px; left: ' + ((document.documentElement.clientWidth - image.width - 20)/2) + 'px;"></div>';
	pws_image_frame = pws_image_background.firstChild;	
	pws_image_frame.appendChild(image);
	pws_image_frame_stretch(0, stepsCount, delay/stepsCount, 0, 0, widthStep, heightStep);
}


function pws_image_frame_stretch(index, limit, timeout, width, height, widthStep, heightStep) {
	pws_image_frame.style.width = width + "px";
	pws_image_frame.style.height = height + "px";
	if (++index < limit)
		setTimeout('pws_image_frame_stretch('+index+', '+limit+', '+timeout+', '+(width+widthStep)+', '+(height+heightStep)+', '+widthStep+', '+heightStep+')', timeout);
	else {
		pws_image_frame.style.width = null;
		pws_image_frame.style.height = null;
	}
}

-->