function highlightOver(el) {
 var next=el.nextSibling;
 el.style.backgroundImage ="url(www/images/bg_fileItem-hover.gif)";
 while(next.nodeType != 1) next=next.nextSibling;
	next.style.backgroundImage ="url(www/images/bg_fileItem-hover.gif)";
}

function highlightOut(el) {
 var next=el.nextSibling;
  el.style.backgroundImage ="url(www/images/bg_fileItem.gif)";
 while(next.nodeType != 1) next=next.nextSibling;
	next.style.backgroundImage ="url(www/images/bg_fileItem.gif)";
}

function highlightList(el,tname) {
	hovers=document.getElementById(el).getElementsByTagName(tname);
	for (i=0; i<hovers.length; i++) {
		hovers[i].onmouseover=function() {highlightOver(this)}
		hovers[i].onmouseout=function() {highlightOut(this)}
	}
}

function popupOpen(URL, ToWidth, ToHeight) {
	newwindow=window.open(URL,'name','toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=1, height=' + ToHeight + ' ,width=' + ToWidth + ', top=' + eval((screen.availHeight - ToHeight) / 3) +  ', left=' + eval((screen.availWidth - ToWidth) / 2) + '');
	if (window.focus) {newwindow.focus()}
	return false;
}

function showUpload() {
	$('#wrapCreateUpload').show();
	$('#wrapCreate').hide();
	$('#wrapUpload').show();
}
function showCreate() {
	$('#wrapCreateUpload').show();
	$('#wrapUpload').hide();
	$('#wrapCreate').show();
}
function showBrowse() {
	$('#uploadBrowse').show();
}
function showCreateDir() {
	$('#createDir').show();
}

/* validation */
function validateFile(){
	if(document.getElementById('fileUpload').value==''){
		alert('You must select a file to upload');
		return false;
	}
	return true;
}

function validateDirName(){
	if(document.getElementById('dirName').value==''){
		alert('You must enter a directory name');
		return false;
	}
	return true;
}

/* confirms */
function confirmFolder(){
	if(confirm('Are you sure you wish to delete this folder and it\'s contents?'))
		return true;
	else
		return false;
}

function confirmFile(){
	if(confirm('Are you sure you wish to delete this file?'))
		return true;
	else
		return false;
}

window.onload=function(){highlightList('content','dt')}
