	$("#logo").click(function () { $("img#tarjeta").toggle("fast");});
	$("a#mapa_uy").click(function () { $("img#mapauy").toggle("slow");});
	$("img#mapauy").click(function () { $(this).toggle("slow");});
	$("a#mapa_py").click(function () { $("img#mapapy").toggle("slow");});
	$("img#mapapy").click(function () { $(this).toggle("slow");});
	
	
/*	$("#pinicio").click(function () {
		$("#contenido").load("index.php span#html");
		return false;
	});
	$("#pformacion").click(function () {
		$("#contenido").load("formacion.php span#html");
		$("title").html("Formaci&oacute;n - "+ titulo);
		return false;
	});
	$("#ptrabajos").click(function () {
		$("#contenido").load("trabajos.php span#html");
		return false;
	});
	$("#pacerca").click(function () {
		$("#contenido").load("acerca.php span#html");
		return false;
	});
	$("#pcontacto").click(function () {
		$("#contenido").load("contacto.php span#html");
		return false;
	});*/

	function slideSwitch() {
		var $active = $('#slideshow IMG.active');
	
		if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
	
		var $next =  $active.next().length ? $active.next()
			: $('#slideshow IMG:first');
	
		$active.addClass('last-active');
	
		$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 1000, function() {
				$active.removeClass('active last-active');
			});
	}

	$(function() {
		setInterval( "slideSwitch()", 5000 );
	});
	
	$("a.anchorLink").click(function () {	
			elementClick = $(this).attr("href")
			destination = $(elementClick).offset().top;
			$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 1100 );
		  	return false;
	});
	
function so_clearInnerHTML(obj) {
	// perform a shallow clone on obj
	nObj = obj.cloneNode(false);
	// insert the cloned object into the DOM before the original one
	obj.parentNode.insertBefore(nObj,obj);
	// remove the original object
	obj.parentNode.removeChild(obj);
}

enviarMensaje=function(){
	
	var nombre = document.getElementById("nombre");
	var telefono = document.getElementById("telefono");
	var direccion = document.getElementById("direccion");
	var correo = document.getElementById("email");
	var mensaje = document.getElementById("mensaje");
	var verificacion = document.getElementById("verificacion");

	var valores ="verificacion="+verificacion.value+"&nombre="+nombre.value+"&telefono="+telefono.value+"&direccion="+direccion.value+"&email="+correo.value+"&mensaje="+mensaje.value;

	so_clearInnerHTML(document.getElementById("enviando"));
	eDIV = document.createElement("div");
	eDIV.setAttribute("id","carga");
	eImage = document.createElement("img");
	eImage.setAttribute("src","img/enviando.gif");
	eImage.setAttribute("alt","Enviando");
	eDIV.appendChild(eImage);
	eDIV.appendChild(document.createTextNode(" Enviando mensaje"));
	document.getElementById("enviando").appendChild(eDIV);
	

	//$enviando = document.getElementById("enviando");
	//$enviando.innerHTML = '<img src="images/enviando.gif" alt="Enviando" /> Enviando mensaje';
	// ===== Enviar datos a la base de datos ==
	$.ajax({
		type: "POST",
		url: "inc/correo.php",
		data: valores,
		success: function(msg){
			var id = msg;
			//$enviando.innerHTML = '* Informaci&oacute;n obligatoria';
			so_clearInnerHTML(document.getElementById("enviando"));
			eDIV = document.createElement("div");
			eDIV.setAttribute("id","carga");
			eDIV.appendChild(document.createTextNode("* Informacion obligatoria"));
			document.getElementById("enviando").appendChild(eDIV);
			
			if (id == 1) {
				alert("Debe ingresar su nombre, como minimo debe tener 3 caracteres");
			} else if  (id == 2) {
				alert("Debe ingresar su correo electronico");
			} else if  (id == 3) {
				alert("El correo electronico no es valido");
			} else if  (id == 4) {
				alert("Ocurrio un error y no se ha podido enviar el mensaje.\nIntentelo mas tarde.");
			} else if  (id == 5) {
				document.getElementById("nombre").value = '';
				document.getElementById("telefono").value = '';
				document.getElementById("direccion").value = '';
				document.getElementById("email").value = '';
				document.getElementById("mensaje").value = '';
				alert("Mensaje enviado correctamente.");
			} else if  (id == 6) {
				alert("SPAM!!");
			}
		},
		error: function(msg){
			//$enviando.innerHTML = '* Informaci&oacute;n obligatoria';
			so_clearInnerHTML(document.getElementById("enviando"));
			eDIV = document.createElement("div");
			eDIV.setAttribute("id","carga");
			eDIV.appendChild(document.createTextNode("* Informacion obligatoria"));
			document.getElementById("enviando").appendChild(eDIV);

			alert("Ha ocurrido un error, intente mas tarde");
		}
	});
};
