function findObj(theObj, theDoc)

{

  var p, i, foundObj;

  

  if(!theDoc) theDoc = document;

  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)

  {

    theDoc = parent.frames[theObj.substring(p+1)].document;

    theObj = theObj.substring(0,p);

  }

  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];

  for (i=0; !foundObj && i < theDoc.forms.length; i++) 

    foundObj = theDoc.forms[i][theObj];

  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 

    foundObj = findObj(theObj,theDoc.layers[i].document);

  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);

  

  return foundObj;

}

function Upload(button)

{

	if(document.form_upload.accept_rules.checked == false) alert("Nesúhlasili ste s pravidlami našej stránky");
	else
	
	
	{
		button.value='Prebieha nahrávanie ...';
	
		button.disabled = true;
			
	
		div = findObj("filediv");
	
		div.style.display = 'none';
	
		divt = findObj("filedivtext");
	
		divt.style.display = 'none';
	
	
	
		divObr = findObj("ajax_loader");
	
		divObr.style.display = 'block';
		
		document.form_upload.submit();
	
	}

return true;
}

function delete_file(num)
{
  zmazat = window.confirm("Naozaj chcete vymazať súbor?"); 
  if (zmazat)
  {
    location.href="/user/files/my/list/delete/"+num+"";
  }
return true;  
}

function Download(button)
{
		button.value='Prebieha download súboru';
		button.disabled = true;
		document.fd.submit();		
return true;
}

function AddDirectory(){
	  naz = window.prompt('Zadajte názov nového priečinka:');
  if (naz!=null)
  {
    location.href="/user/files/directory/add/title/"+naz;
  }
}

function SelectAll(CheckBoxControl)
{
	if (CheckBoxControl.checked == true)
	{
		var i;
		for (i=0; i < document.forms[0].elements.length; i++)
		{
			if (document.forms[0].elements[i].type == 'checkbox')
			{
				document.forms[0].elements[i].checked = true;
			}
		}
	}
	else
	{
		var i;
		for (i=0; i < document.forms[0].elements.length; i++)
		{
			if (document.forms[0].elements[i].type == 'checkbox')
			{
				document.forms[0].elements[i].checked = false;
			}
		}
	}
}

function DeleteDirectory(num)
{
  zmazat = window.confirm("Naozaj chcete vymazať tento adresár a celý jeho obsah?"); 
  if (zmazat)
  {
    location.href="/user/files/my/list/deletedir/"+num+"";
  }
}

function EditDirectory(num,name){
	  naz = window.prompt('Zadajte nový názov priečinka:',name);
  if (naz!=null)
  {
    location.href="/user/files/my/list/editdir/"+num+"/new/"+naz;
  }
}

function ActionChange(sel)
{
	if(sel.value != 1)
	{
		div = findObj("move_select");
		div.style.display = 'none';	
	}
	else
	{
		div = findObj("move_select");
		div.style.display = 'inline';	
	}
	

}