var slideCache = new Array();
function RunSlideShow(pictureName,imageFiles,displaySecs){
	var imageSeparator = imageFiles.indexOf(";");
	var nextImage = imageFiles.substring(0,imageSeparator);
	if (document.all){
		document.getElementById(pictureName).style.filter="blendTrans(duration=2)";
		document.getElementById(pictureName).filters.blendTrans.Apply();
	}
	document.getElementById(pictureName).src = nextImage;
	if (document.all){
		document.getElementById(pictureName).filters.blendTrans.Play();
	}
	var futureImages= imageFiles.substring(imageSeparator+1,imageFiles.length)
	+ ';' + nextImage;
	setTimeout("RunSlideShow('"+pictureName+"','"+futureImages+"',"+displaySecs+")", displaySecs*1000);
	imageSeparator = futureImages.indexOf(";");
	nextImage = futureImages.substring(0,imageSeparator);
	if (slideCache[nextImage] == null) {
		slideCache[nextImage] = new Image;
		slideCache[nextImage].src = nextImage;
	}
}
function enviarEmail(){
	formulario=document.formContacto;
	if(formulario.nombre.value==""){
		alert("Debe escribir su Nombre");
		formulario.nombre.focus();
	}else if(formulario.email.value==""){
		alert("Debe escribir su Email");
		formulario.email.focus();
	}else if(formulario.email.value.search(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/ig)){
        alert("Email Invalido");
		formulario.email.value="";
		formulario.email.focus();
    }else if(formulario.ciudad.value==""){
		alert("Debe escribir su Ciudad");
		formulario.ciudad.focus();
	}else if(formulario.pais.value==""){
		alert("Debe escoger su Pais");
		formulario.pais.focus();
	}else if(formulario.comentario.value==""){
		alert("Por favor escribir su mensaje o comentario");
		formulario.comentario.focus();
	}else if(formulario.code.value==""){
		alert("Por favor escribir Codigo de Seguridad CAPTCHA");
		formulario.code.focus();
	}else{
		formulario.submit();
	}
}
function ajaxFunction() {
	var xmlHttp;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		return xmlHttp;
	} catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			return xmlHttp;
		} catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				return xmlHttp;
			} catch (e) {
				alert("Tu navegador no soporta AJAX!");
				return false;
			}
		}
	}
}
function Mostrar(_pagina,capa) {
	var ajax;
	ajax = ajaxFunction();
	ajax.open("GET", _pagina, true);
	ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=ISO-8859-1'); 
	ajax.onreadystatechange = function(){
		if (ajax.readyState==1){
			document.getElementById(capa).innerHTML = "<center><span class='loading'>Please Wait</span></center>";
		}
		if (ajax.readyState == 4){
			if (ajax.status==200){
				document.getElementById(capa).innerHTML = ajax.responseText;
			}else{
				alert(ajax.status)
			}
		}
	}
	ajax.send(null);
}
