// JavaScript Document
$(function() {
	$(".external").attr("target","_blank");
});
//formulario
function ponsrc() {
	var nombre = document.getElementById('nombre').value;
	var telefono = document.getElementById('telefono').value;
	var email = document.getElementById('email').value;
	var datos_tratados = document.getElementById('datos_tratados').value;
	if( nombre == '' ) {
		alert('Escriba el Nombre');
	} else {
		if( telefono == '' ) {
			alert('Escriba el Telefono');		
		} else {
			if( email == '' ) {
				alert('Escriba el Email');			
			} else {
				if(!document.getElementById('verificacion').checked) {
					alert('Acepte politica de privacidad');
				} else {
					
					sendMailAjax('?nombre='+ nombre + '&email=' + email + '&datos_tratados=' + datos_tratados + '&telefono=' + telefono);
				}
			}
		}
	}
}
function obligatorios() {
		var arrobligatorios = new Array("nombre", "email", "telefono");
		var obj;
		for (i in arrobligatorios) {
			if(obj=document.getElementById(arrobligatorios[i])) {
				if(obj.value=="") {
					alert("El campo " + arrobligatorios[i] + " es obligatorio");
					obj.focus();
					return false;
				}
			}
		}
		document.form_curr.submit();
}
 function sendMailAjax(url) {  
     if (window.XMLHttpRequest) {  
         xmlhttp = new XMLHttpRequest();  
     } else {  
         xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");  
     }  
     xmlhttp.onreadystatechange = function() {  
         if (xmlhttp.readyState == 4) {
             document.getElementById("formularioconsultas").innerHTML = xmlhttp.responseText;  
         }  
     }  
     xmlhttp.open("GET", "http://www.susdatos.es/sites/all/themes/susdatos/sendmail.php" + url, true);  
     xmlhttp.send(null);
 } 
 
 function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

