function confirmDelete(url)
{
	if (confirm("Are you sure you want to delete this item?\nThis action is cannot be undone."))
	{
		location.href = url;
	}
}

function validEmail(str)
{
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return filter.test(str);
}

function validImage(str)
{
	return str.toLowerCase().match(/^.*(\.jpg|\.jpeg|\.tif|\.tiff|\.bmp|\.jfif|\.gif|\.png)$/);
}

function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
}

function doDisplay(objectId) {
   object = getStyleObject(objectId);
   if (object.display == 'none' || object.display == '')
       object.display='block';
   else
       object.display='none'; 
}

var newWin;

function zoom(id,w,h,path) {
	if (newWin && !newWin.closed)
		newWin.close();
	newWin = window.open('wm.php?id='+id+'&path='+path,'newWin','width='+w+',height='+h+',resizable=no,scrollbar=no');
	newWin.focus();
}

function newWindow(url,w,h) {
	if (newWin && !newWin.closed)
		newWin.close();
	newWin = window.open(url,'newWin','width='+w+',height='+h+',resizable=no,scrollbar=no');
	newWin.focus();
}

var chatWin;

function chat() {
	if (!chatWin || chatWin.closed) {
		chatWin = window.open('chat/index.php','chatWin','width=550,height=350,resizable=no,status=no,scrollbar=no');
		chatWin.focus();
	} else {
		chatWin.focus();
	}
}