//<![CDATA[	
/*---------------------------------------------------
			Desarrollo www.acemtic.com
---------------------------------------------------*/

/* Ampliar foto */
function verFoto(archivo) {
	 if (navigator.appName.indexOf("Explorer") != -1) { 
		settings="top=1,left=1,menubar=no,width=10,height=10,toolbar=no,resize=no";
		newWindow = window.open('ver_foto.php?img=' + archivo,'WindowPics',settings);
	}
	else {
		LeftPosition = (screen.width - 610) / 2;
		TopPosition = (screen.height - 435) / 2;
		settings="top="+TopPosition+",left="+LeftPosition+",menubar=no,width=610,height=435,toolbar=no,resize=no";
		newWindow = window.open('ver_foto.php?img=' + archivo,'WindowPics',settings);
	}
}
/* Comprueba formulario de contacto */
function checkForm (formulario)	{
	if (formulario.txtnombre.value.length < 3) { 
		alert("Introduzca su nombre en el formulario."); 
		formulario.txtnombre.focus();
		return (false); 
	}
	if ((formulario.txtemail.value.indexOf ('@', 0) == -1)||(formulario.txtcorreo.value.length < 5)) { 
		alert("Introduzca una dirección de correo válida en el campo \"E-mail\"."); 
		formulario.txtemail.focus();
		return (false); 
	}
	if (formulario.txtcomentario.length < 2) { 
		alert("Escriba su petición en el campo \" Comentarios\"."); 
		formulario.txtcomentario.focus();
		return (false); 
	}
	return (true);
}
/* Funcion de mensaje de alerta */
function msgWindow(msg,ancho,alto,destino) {
	if (navigator.appName.indexOf("Explorer") != -1) { 
		settings="dialogWidth=" + ancho + "px;dialogHeight=" + alto + "px;border=thin;center=yes;maximize=no;minimize=no;help=no;menubar=no;resizable=no;scrollbars=no;status=no;menubar=no;location=no";
		newWindow = window.showModalDialog('msg.php?msg='+msg,'msgWindow',settings);
	}
	else {
		LeftPosition = (screen.width - ancho) / 2;
		TopPosition = (screen.height - alto) / 2;
		settings="top="+TopPosition+",left="+LeftPosition+",menubar=no,width=" + ancho + ",height=" + alto + ",toolbar=no,resize=no";
		newWindow = window.open('msg.php?msg='+msg,'msgWindow',settings);
	}
	if (destino) {
		location.href = destino;
	}
}
/*-------------------------------------------------------------------------------------------------------------*/
/* Opacidad en los archivos PNG con IExplorer */

if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
	document.writeln('<style type="text/css">img, input.image { visibility:hidden; } </style>');
	window.attachEvent("onload", fnLoadPngs);
}

function fnLoadPngs() {
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);

	for (var i = document.images.length - 1, img = null; (img = document.images[i]); i--) {
		if (itsAllGood && img.src.match(/\.png$/i) != null) {
			fnFixPng(img);
			img.attachEvent("onpropertychange", fnPropertyChanged);
		}
		img.style.visibility = "visible";
	}

	var nl = document.getElementsByTagName("INPUT");
	for (var i = nl.length - 1, e = null; (e = nl[i]); i--) {
		if (e.className && e.className.match(/\bimage\b/i) != null) {
			if (e.src.match(/\.png$/i) != null) {
				fnFixPng(e);
				e.attachEvent("onpropertychange", fnPropertyChanged);
			}
			e.style.visibility = "visible";
		}
	}
}

function fnPropertyChanged() {
	if (window.event.propertyName == "src") {
		var el = window.event.srcElement;
		if (!el.src.match(/x\.gif$/i)) {
			el.filters.item(0).src = el.src;
			el.src = "x.gif";
		}
	}
}

function dbg(o) {
	var s = "";
	var i = 0;
	for (var p in o) {
		s += p + ": " + o[p] + "\n";
		if (++i % 10 == 0) {
			alert(s);
			s = "";
		}
	}
	alert(s);
}

function fnFixPng(img) {
	var src = img.src;
	img.style.width = img.width + "px";
	img.style.height = img.height + "px";
	img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')"
	img.src = "x.gif";
}
//]]>