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();
	}
}

function pngFix() {
	var arVersion = navigator.appVersion.split("MSIE");
	var version = parseFloat(arVersion[1]);
	if ((version >= 5.5) && (document.body.filters)) {
		for (var i=0; i<document.images.length; i++) {
			var img = document.images[i];
			var imgName = img.src.toUpperCase();
			if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
				var imgID = (img.id) ? "id='" + img.id + "' " : "";
				var imgClass = (img.className) ? "class='" + img.className + "' " : "";
				var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
				var imgStyle = "display: inline-block;" + img.style.cssText;
				if (img.align == "left")
					imgStyle = "float: left;" + imgStyle;
				if (img.align == "right")
					imgStyle = "float: right;" + imgStyle;
				if (img.parentElement.href)
					imgStyle = "cursor: hand;" + imgStyle;
				var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + " filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + img.src + "\', sizingMethod='image');\"></span>";
				img.outerHTML = strNewHTML;
				i = i-1;
			}
		}
	}
}