function BotonDerecho(e){
	var msg = "Copyright© 2006";
	if ((navigator.appName == 'Netscape' && e.which == 3) || (navigator.appName == 'Microsoft Internet Explorer' && event.button==2)){
		alert(msg);
	}
	return false;
}

//document.onmousedown = BotonDerecho;
//document.oncontextmenu = BotonDerecho;

function setClassName(objId, className2) {
	document.getElementById(objId).className = className2;
}

function CambiaColor(ncolor, id){
	document.getElementById(id).style.background = "#"+ncolor;
}

function Ventana(URL, target, x, y) {
	if (x || y) {
		LeftPos = (screen.width) ? (screen.width - x) / 2 : 0;
		TopPos = (screen.height) ? (screen.height - y) / 2 : 0;
	} else {
		LeftPos = (screen.width) ? (screen.width - x - 30) : 0;
		TopPos = (screen.height) ? (screen.height - y) / 2 : 0;
	}
	//window.onerror=BIMpopERROR; 
	BIM=window.open(URL , target, "height=" + y + ",width=" + x + ",toolbar=no,location=no,status=no,directories=no,scrollbars=no,resizable=no,left=" + LeftPos + ",top=" + TopPos); 
	//BIM=window.showModalDialog(URL,target,"dialogHeight: "+y+"px; dialogWidth: "+x+"px; dialogTop: px; dialogLeft: px; center: Yes; resizable: No; status: No;");
	BIM.focus();
	//TerremotoXY(BIM,5);
	return false;
}

function Ventana2(URL, target, x, y) {
	if (x || y) {
		LeftPos = (screen.width) ? (screen.width - x) / 2 : 0;
		TopPos = (screen.height) ? (screen.height - y) / 2 : 0;
	} else {
		LeftPos = (screen.width) ? (screen.width - x - 30) : 0;
		TopPos = (screen.height) ? (screen.height - y) / 2 : 0;
	}
	//window.onerror=BIMpopERROR; 
	BIM=window.open(URL , target, "height=" + y + ",width=" + x + ",toolbar=no,location=no,status=no,directories=no,scrollbars=yes,resizable=no,left=" + LeftPos + ",top=" + TopPos); 
	//BIM=window.showModalDialog(URL,target,"dialogHeight: "+y+"px; dialogWidth: "+x+"px; dialogTop: px; dialogLeft: px; center: Yes; resizable: No; status: No;");
	BIM.focus();
	//TerremotoXY(BIM,5);
	return false;
}

function BIMpopERROR() {
	if (!BIM) if (confirm("Probablemente tienes un programa que bloquea los POPUPs. Por favor intentalo de nuevo dando clic y presionando la tecla CTRL")); 
}

function TerremotoXY(target, n) {
	if (target.moveBy) {
		for (i = 10; i > 0; i--) {
			for (j = n; j > 0; j--) {
				target.moveBy(0,i);
				target.moveBy(i,0);
				target.moveBy(0,-i);
				target.moveBy(-i,0);
			}
		}
	}
}

function TerremotoX(target, n) {
	if (target.moveBy) {
		for (i = 10; i > 0; i--) {
			for (j = n; j > 0; j--) {
				target.moveBy(i,0);
				target.moveBy(-i,0);
			}
		}
	}
}

function TerremotoY(target, n) {
	if (target.moveBy) {
		for (i = 10; i > 0; i--) {
			for (j = n; j > 0; j--) {
				target.moveBy(0,i);
				target.moveBy(0,-i);
			}
		}
	}
}

function ValidaDelete(url){
	if(confirm("żEstá seguro que desea borrar este elemento?")){
		window.location = url;	
	}
}

function ValidaDeleteUser(url){
	if(confirm("żEsta seguro que desea borrar a este usuario?")){
		window.location = url;	
	}
}

function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            oldonload();
            func();
        }
    }
}

var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

function FixPNG(){
	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='scale');\"></span>"
			 img.outerHTML = strNewHTML
			 i = i-1
		  }
	   }
	}
}

addLoadEvent(FixPNG);