function confirmRemoveUser()
{
	c = confirm('Are you sure you want to delete this user?\nThis action is irreversible.');
	if (c)
	{
		return true;
	}
	else
	{
		return false;
	}	
}

function confirmRemoveArt()
{
	c = confirm('Are you sure you want to delete this art series or file?\nThis action is irreversible.');
	if (c)
	{
		return true;
	}
	else
	{
		return false;
	}	
}

function validateLogin(name,password)
{
	var userName = trim(name.value);
	var userPassword = trim(password.value);

	if (userName.length < 5 && userPassword.length < 7)
	{
		name.value = '';
		password.value = '';
		name.focus();
		alert('Please fill in all fields.\nMinimum User Name length is 5 characters.\nMinimum Password length is 7 characters.');
		return false;
	}
	else if (userName.length < 5)
	{
		name.value = '';
		password.value = '';
		name.focus();
		alert('Please fill in all fields.\nMinimum User Name length is 5 characters.');
		return false;
	}
	else if (userPassword.length < 4)
	{
		password.value = '';
		password.focus();
		alert('Please fill in all fields.\nMinimum User Password length is 7 characters.');
		return false;
	}
	else
	{
		return true;
	}
}

function handleArtTypeChange()
{
	var series = document.getElementById('inputTypeSeries');
	
	if (series.checked)
	{
		document.getElementById('art1').style.display = 'none';
		document.getElementById('art2').style.display = 'none';
		document.getElementById('art3').style.display = 'none';
		document.getElementById('art4').style.display = 'none';
		document.getElementById('art5').style.display = 'none';
		document.getElementById('art6').style.display = 'none';
		
		document.getElementById('series1').style.display = '';
		document.getElementById('series2').style.display = '';
		document.getElementById('series3').style.display = '';
		document.getElementById('series4').style.display = '';
	}
	else
	{
		document.getElementById('series1').style.display = 'none';
		document.getElementById('series2').style.display = 'none';
		document.getElementById('series3').style.display = 'none';
		document.getElementById('series4').style.display = 'none';
		
		document.getElementById('art1').style.display = '';
		document.getElementById('art2').style.display = '';
		document.getElementById('art3').style.display = '';
		document.getElementById('art4').style.display = '';
		document.getElementById('art5').style.display = '';
		document.getElementById('art6').style.display = '';
	}
}

function showAndHide(obj)
{
	displayStyle = obj.style.display;
	if (displayStyle == 'none')
	{
		obj.style.display='block';
	}
	if (displayStyle == '' || displayStyle == 'block')
	{
		obj.style.display='none';
	}
}

function loadStoryboard(dir,file)
{
	window.open("./includes/popup_storyboards.php?d=" + dir + "&f=" + file,"_blank","height=500,width=700,status=yes,toolbar=no,menubar=no,location=no");
}

function refreshStoryboard(dir,file)
{
	window.open("popup_storyboards.php?d=" + dir + "&f=" + file,"_self","status=yes,toolbar=no,menubar=no,location=no");
}


function trim(s)
{
	return s.replace(/^\s+|\s+$/g,"");
}

document.getElementsByClassName = function(cl) {
var retnode = [];
var myclass = new RegExp('\\b'+cl+'\\b');
var elem = this.getElementsByTagName('*');
for (var i = 0; i < elem.length; i++) {
var classes = elem[i].className;
if (myclass.test(classes)) retnode.push(elem[i]);
}
return retnode;
}; 