// Main JS file

$(document).ready(function() {
   
    $('A[rel="external"]').click( function() {
        window.open( $(this).attr('href') );
        return false;
    });
    var abierto=false;
    $('span.leer-desc').click( function() {
        $(this).parent().children('div.descripcion-galeria').toggle('slow');
        
        if($(this).children('span').html()=="+"){
        	$(this).html('Leer <span style="font-size:16px;">-</span>');
        	
        }else{
        	$(this).html('Leer <span style="font-size:16px;">+</span>');
        	
        }
    });
	
	$(function() {
        $('div.galleryBox a').lightBox();
    });
	$(function() {
        $('div.box-trabajos a').lightBox();
    });
	
	$("#btnSubmit").click(function() {
		var nombre = escape($("#tName").val());
		var tel = escape($("#tTel").val());
		var email = escape($("#tEmail").val());
		var Provincia = escape($("#tProv").val());
		var msg = escape($("#tMsg").val());
		
		$.post('sendemail.php', { name:nombre, tel:tel, email:email, Provincia:Provincia, msg:msg }, function(html) { 
			if (html == "1") {
				alert ("El mensaje se ha enviado exitosamente");
				$("#tName").val('');
				$("#tTel").val('');
				$("#tEmail").val('');
				$("#tProv").val('');
				$("#tMsg").val('');
				$("#dInfo").hide(500);
				$("#dForm").show(1200);
			} else {
				alert(html);
			}
		});
	});
	
	$("#aContact").click(function() {
		$("#dInfo").hide(500);
		$("#dForm").show(1200);
	});
	$("#aGoBack").click(function() {
		$("#dForm").hide(500);
		$("#dInfo").show(1200);
	});
	
	$(".gallerypic a").fancybox(); 
});

// Code by pulse at www.artpulse.com.ar
