
//window.addEvent('domready', recogeDatos);
function inserta_suscripcion ()
{
	elementoFormulario = document.forms.news;
	divContenedor = $('newsletter');
	
	var prueboRequest = new Request({
		method: 'post',
		data: elementoFormulario,
		url: 'http://www.accioncontraelhambre.org/lib/data_action.php?action=insert_suscripcion',
		onRequest: function() { divContenedor.set('html', '<p><img src="images/spinner.gif" /></p>'); },
		onSuccess: function(texto, xmlrespuesta){ divContenedor.set('html', texto);},
		onFailure: function(){alert('Fallo al enviar los datos.');}
	}).send();
}

function inserta_cv ()
{
	elementoFormulario = document.forms.empleo_cv;
	divContenedor = $('empleo_cv');
	
	var prueboRequest = new Request({
		method: 'post',
		data: elementoFormulario,
		url: 'http://www.accioncontraelhambre.org/lib/data_action.php?action=insert_cv',
		onRequest: function() { divContenedor.set('html', '<p><img src="images/spinner.gif" /></p>'); },
		onSuccess: function(texto, xmlrespuesta){ divContenedor.set('html', texto);},
		onFailure: function(){alert('Fallo al enviar los datos.');}
	}).send();
}

function inserta_suscripcion_prensa ()
{
	elementoFormulario = document.forms.news;
	divContenedor = $('respuesta');
	
	var prueboRequest = new Request({
		method: 'post',
		data: elementoFormulario,
		url: 'http://www.accioncontraelhambre.org/lib/data_action.php?action=inserta_suscripcion_prensa',
		onRequest: function() { divContenedor.set('html', '<p><img src="images/spinner.gif" /></p>'); },
		onSuccess: function(texto, xmlrespuesta){ divContenedor.set('html', texto);},
		onFailure: function(){alert('Fallo al enviar los datos.');}
	}).send();
}


function user_login ()
{
	elementoFormulario = document.forms.login;
	divContenedor = $('newsletter');
	
	var prueboRequest = new Request({
		method: 'post',
		data: elementoFormulario,
		url: 'http://www.accioncontraelhambre.org/lib/data_action.php?action=insert_suscripcion',
		onRequest: function() { divContenedor.set('html', '<p><img src="images/spinner.gif" /></p>'); },
		onSuccess: function(texto, xmlrespuesta){ divContenedor.set('html', texto);},
		onFailure: function(){alert('Fallo al enviar los datos.');}
	}).send();
}


function enviarDatos(formulario)
{
	if (validateStandard(formulario))
	{
		if (document.getElementById('privacidad').checked)
		{
			divContenedor = $('texto_cont');
			
			var prueboRequest = new Request({
				method: 'post',
				data: formulario,
				url: 'http://www.accioncontraelhambre.org/lib/data_action.php?action=send_contact',
				onRequest: function() { divContenedor.set('html', '<p><img src="images/spinner.gif" /></p>'); },
				onSuccess: function(texto, xmlrespuesta){ divContenedor.set('html', texto);},
				onFailure: function(){alert('Fallo al enviar los datos.');}
			}).send();
		} else {
			alert("Debe aceptar la política de privacidad.");
		}
	}
}

function load_data_pais (url)
{
	/*url_cortada = url.split('#');
	if (url_cortada[1]!=undefined)
	{
		url_parametros = url_cortada[1].split('/');
		//alert("El ID es "+url_parametros[1]+" y el pais "+url_parametros[3]);
		document.location.hash = "#id_map/"+url_parametros[1]+"/pais/"+url_parametros[3];
		
		$('selector').value = document.location.hash;
		//$('selector').fireEvent('change');
		
		divContenedor = $('ficha1');
		
		var prueboRequest = new Request({
			method: 'get',
			url: 'http://www.accioncontraelhambre.org/lib/ficha_pais.php?id_map='+url_parametros[1]+'&cache=a87ff679a2f3e71d9181a67b7542122c',
			onRequest: function() { divContenedor.set('html', '<p><img src="images/spinner.gif" /></p>'); },
			onSuccess: function(texto, xmlrespuesta){ divContenedor.set('html', texto);},
			onFailure: function(){alert('Fallo al enviar los datos.');}
		}).send();
	}*/
	document.location.href = url;
}

function save_config_cooperante (url)
{
	elementoFormulario = document.forms.modulos;
	divContenedor = $('respuesta');
	
	var prueboRequest = new Request({
		method: 'post',
		data: elementoFormulario,
		url: 'http://www.accioncontraelhambre.org/lib/data_action.php?action=save_config_cooperante',
		onRequest: function() { divContenedor.set('html', '<p><img src="../images/spinner.gif" /></p>'); },
		onSuccess: function(texto, xmlrespuesta){
					document.location.href = url;
					//divContenedor.set('html', texto);
					},
		onFailure: function(){alert('Fallo al enviar los datos.');}
	}).send();
}


function hazte_socio ()
{
	elementoFormulario = document.forms.form1;
	divContenedor = $('respuesta');
	
	var prueboRequest = new Request({
		method: 'post',
		data: elementoFormulario,
		url: 'http://www.accioncontraelhambre.org/lib/data_action.php?action=hazte_socio',
		onRequest: function() { divContenedor.set('html', '<p><img src="images/spinner.gif" /></p>'); },
		onSuccess: function(texto, xmlrespuesta){
			var contenido = "";
			var respuesta = texto;
			switch (texto)
			{
				case "fallo_bbdd":
					error_socio_bbdd(3);
					contenido = "<p style='color:#FF0000'>Ha ocurrido un error en el registro. Por favor, inténtelo de nuevo más tarde.</p>";
					break;
				case "fallo_email":
					contenido = "<p style='color:#FF0000'>El e-mail introducido no es correcto. Por favor, inténtelo de nuevo.</p>";
					break;
				case "all_ok":
					limpia_form();
					var contador = 1;
					var trig = $$(".formu_nav li a");
					trig.each(function(e){
						if (contador<=3)
						{
							e.addEvent('click', function()
							{
								create_tabs("final");
							});
						}
						contador++;
					});
			}
			divContenedor.set('html', contenido);
		},
		onFailure: function(texto, xmlrespuesta){alert('Ha ocurrido un fallo en la petición AJAX.');}
	}).send();
}

var url_actual = document.location;
function create_tabs(desde) {
	
	var paneles = $$(".tabs");
	var trig = $$(".formu_nav li a");
	var lis = $$("ul.formu_nav li");
	
	if (String(url_actual).indexOf('donativo')!=-1)
	{
		var btn_siguiente = "bt_siguiente_azul.gif";
		var btn_siguiente_over = "bt_siguiente_azul.jpg";
		var fondo_botones = "bt_datos_azul.jpg";
		var fondo_botones2 = "bt_datos_2_azul.jpg";
	} else {
		var btn_siguiente = "bt_siguiente.gif";
		var btn_siguiente_over = "bt_siguiente_over.jpg";
		var fondo_botones = "bt_datos.jpg";
		var fondo_botones2 = "bt_datos_2.jpg";
	}
	
	var coleccionRad = $$('#Tab2 input.radio');
	coleccionRad.each(function(e){
		e.addEvent('click', function(obj){
		if (String(url_actual).indexOf('donativo')!=-1)
		{
			switch(this.value)
			{
				case "40":
					$('banner_ideas').src = 'http://www.accioncontraelhambre.org/images/formulario/banner_azul1.jpg';
					break;
				case "60":
					$('banner_ideas').src = 'http://www.accioncontraelhambre.org/images/formulario/banner_azul2.jpg';
					break;
				case "100":
				default:
					$('banner_ideas').src = 'http://www.accioncontraelhambre.org/images/formulario/banner_azul3.jpg';
					break;
			}
		} else {
			switch(this.value)
			{
				case "10":
					$('banner_ideas').src = 'http://www.accioncontraelhambre.org/images/formulario/banner.jpg';
					break;
				case "15":
				case "20":
				default:
					$('banner_ideas').src = 'http://www.accioncontraelhambre.org/images/formulario/20.jpg';
					break;
			}
		}
		});
	});
	
	/*for(var i=1; i<=4; i++)
	{
		var objetos = $$('#Tab'+i+' input.required');
		objetos.each(function(e){
			if ($(e.name)!=null)
			{
				$(e.name).setStyle('display', 'none');
			}
		});
	}*/
	$$(".bt_siguiente").removeEvents('mouseover');
	$$(".bt_siguiente").removeEvents('mouseout');
	$$(".bt_siguiente").addEvent('mouseover', function()
	{
		/*var myFx = new Fx.Elements(this).set({
			'0': {
				'opacity': 0.7
			}
		});*/
		this.src = 'images/formulario/'+btn_siguiente_over;
	});
	$$(".bt_siguiente").addEvent('mouseout', function()
	{
		/*var myFx = new Fx.Elements(this).set({
			'0': {
				'opacity': 1
			}
		});*/
		this.src = 'images/formulario/'+btn_siguiente;
	});
	var contador = 0;
	$$(".bt_siguiente").each(function(e){
		contador++;
		e.elid = contador;
	});
	
	$('banner_ideas').setStyle('display', 'none');
	
	var contador = 0;
	paneles.each(function(e){
		if (contador>=1)
		{
			e.setStyle('display', 'none');
		}
		contador++;
	});
	contador = 0;
	lis.each(function(e){
		if (contador>=1)
		{
			e.setStyle('background', 'none');
		}
		contador++;
	});
	contador = 0;
	var primer_btn;
	trig.each(function(e){
		if (contador>=1)
		{
			e.setStyle('display', 'none');
			
		} else {
			primer_btn = e;
		}
		contador++;
	});
	trig.removeEvents('click');
	trig.addEvent('click', function()
	{
		$('image_final').setStyle('display', 'inline');
		$('banner_ideas').setStyle('display', 'none');
		$('formulario1').setStyle('background', 'url(images/formulario/fondo_formu.jpg) repeat-y');
		for (var i=1; i<=4; i++)
		{
			if (this.href.split("#")[1]==i)
			{
				$('Tab'+i).setStyle('display', 'block');
			} else {
				$('Tab'+i).setStyle('display', 'none');
			}
		}
		for (var i=1; i<=this.href.split("#")[1]; i++)
		{
			if (i<4)
			{
				if (i<this.href.split("#")[1])
				{
					$('li_'+i).setStyle('background', 'url(images/formulario/'+fondo_botones2+') no-repeat');
				} else {
					$('li_'+i).setStyle('background', 'url(images/formulario/'+fondo_botones+') no-repeat');
				}
			} else {
				$('li_'+i).setStyle('background', 'url(images/formulario/bt_gracias.jpg) no-repeat');
			}
		}
		if (this.href.split("#")[1]==4)
		{
			$('image_final').setStyle('display', 'none');
			$('formulario1').setStyle('background', 'none');
		}
		if (this.href.split("#")[1]==2)
		{
			$('banner_ideas').setStyle('display', 'inline');
		}
	});
	if (desde=="final")
	{
		primer_btn.fireEvent('click');
	}
	for (var i=1; i<=3; i++)
	{
		var coleccion = $$('#Tab'+i+' input.number');
		var coleccionReq = $$('#Tab'+i+' input.required');
		coleccion.each(function(e){
			if (e.name=="datos[SOCIO_dia]" || e.name=="datos[SOCIO_mes]" || e.name=="datos[SOCIO_agno]")
			{
				e.addEvent('keypress', function(obj){
					if ((obj.key>=0 && obj.key<=9) || obj.key=="backspace")
					{
						return true;
					} else {
						return false;
					}
				});
				e.addEvent('blur', function(obj){
					if (this.value!="")
					{
						switch (this.name)
						{
							case "datos[SOCIO_dia]":
								if (this.value<1 || this.value>31)
								{
									alert("El día es incorrecto.");
								}
								break;
							case "datos[SOCIO_mes]":
								if (this.value<1 || this.value>12)
								{
									alert("El mes es incorrecto.");
								}
								break;
							case "datos[SOCIO_agno]":
								if (this.value<1900 || this.value>2020)
								{
									alert("El año es incorrecto.");
								}
								break;
						}
					}
				});
			}
		});
		coleccionReq.each(function(e){
			if (e.name=="datos[SOCIO_telefono]" || e.name=="datos[SOCIO_cantidad_texto]" || e.name=="datos[SOCIO_cc1]" || e.name=="datos[SOCIO_cc2]" || e.name=="datos[SOCIO_cc3]" || e.name=="datos[SOCIO_cc4]")
			{
				e.addEvent('keypress', function(obj){
					if ((obj.key>=0 && obj.key<=9) || obj.key=="backspace")
					{
						return true;
					} else {
						return false;
					}
				});
			}
			if (e.name=="datos[SOCIO_cantidad_texto]")
			{
				e.addEvent('focus', function(o){
					$('otra').checked = true;
					$('banner_ideas').src = 'http://www.accioncontraelhambre.org/images/formulario/banner_azul3.jpg';
				});
			}
		});
	}
	$('dni').addEvent('blur', function(e){
		var regular = new RegExp(/^[ABCDEFGHKLMNPQS]\d\d\d\d\d\d\d[0-9,A-J]$/g);
		if (regular.exec(this.value))
		{
			var nuevoElemento = new Element("input", {
			   "name": "datos[SOCIO_empresa]",
			   "type": "text",
			   "id": "empresa",
			   "value": "Nombre de empresa"
			});
			nuevoElemento.setStyles({
				"position": "absolute",
				"width": "175px",
				"height": "18px",
				"top": $('dni').getCoordinates().top+'px',
				"left": $('dni').getCoordinates().left+'px'
				});
			nuevoElemento.injectAfter($('dni'));
		} else {
			if ($('empresa'))
			{
				$('empresa').destroy();
			}
		}
	});
}


function lanzaTPV()
{
	elementoFormulario = document.forms.form1;
	divContenedor = $('respuesta');
	
	var prueboRequest = new Request({
		method: 'post',
		data: elementoFormulario,
		url: 'http://www.accioncontraelhambre.org/lib/data_action.php?action=haz_donativo',
		onRequest: function() { divContenedor.set('html', '<p><img src="images/spinner.gif" /></p>'); },
		onSuccess: function(texto, xmlrespuesta){
						arrayDatos = texto.split("|");
						Shadowbox.open({
							language: "es",
							content:    'http://www.accioncontraelhambre.org/lib/conexion_TPV.php?order='+arrayDatos[0]+'&store='+arrayDatos[1]+'&from=ach',
							player:     "iframe",
							title:      "Conexión a TPV",
							width:      750,
							height: 	450
						});
						divContenedor.set('html', '');
					},
		onFailure: function(){alert('Fallo al enviar los datos.');}
	}).send();
}

function lanzaTPV5000(nombre, apellidos, email, cantidad, posicion, comentarios, filename)
{
	var prueboRequest = new Request({
		method: 'get',
		url: 'http://www.accioncontraelhambre.org/lib/data_action.php?action=haz_donativo_5000&nombre='+nombre+'&apellidos='+apellidos+'&email='+email+'&cantidad='+cantidad+'&posicion='+posicion+'&comentarios='+comentarios+'&filename='+filename,
		onRequest: function() {  },
		onSuccess: function(texto, xmlrespuesta){
						arrayDatos = texto.split("|");
						
						Shadowbox.open({
							language: "es",
							content:    "http://www.accioncontraelhambre.org/lib/conexion_TPV.php?order="+arrayDatos[0]+"&store="+arrayDatos[1]+"&from=ms_5000",
							player:     "iframe",
							title:      "Conexión a TPV",
							width:      750,
							height: 	450
							
							
							
						});
						
					},
		onFailure: function(){alert('Fallo al enviar los datos.');}
	}).send();
	
}

function create_cuestionario()
{
	var total_divs = 5;
	for (i=2; i<=total_divs; i++)
	{
		$('cuestionario'+i).setStyle('display', 'none');
	}
	$$('.hazte').setStyle('display', 'none');
	
	for (i=1; i<=total_divs; i++)
	{
		var coleccionRadios = $$('#cuestionario'+i+' input.cuestionario');
		$$('#cuestionario'+i+' img.adelante2').setStyle('display', 'none');
		$$('#cuestionario'+i+' img.adelante2').each(function(obj){
			obj.elid = i;
		});
		$$('#cuestionario'+i+' img.adelante2').addEvent('click', function(e){
			actualID = this.elid;
			for (j=1; j<=total_divs; j++)
			{
				if (j==(this.elid+1))
				{
					$('cuestionario'+j).setStyle('display', 'block');
				} else {
					$('cuestionario'+j).setStyle('display', 'none');
				}
				if (j<=this.elid+1)
				{
					$('numero'+j).src = 'http://www.accioncontraelhambre.org/images/cooperante/menu'+j+'_on.png';
				} else {
					$('numero'+j).src = 'http://www.accioncontraelhambre.org/images/cooperante/menu'+j+'.png';
				}
			}
		});

		$$('#cuestionario'+i+' img.adelante').setStyle('display', 'none');
		$$('#cuestionario'+i+' img.adelante').each(function(obj){
			obj.elid = i;
		});
		$$('#cuestionario'+i+' img.adelante').addEvent('click', function(e){
			actualID = this.elid;
			for (j=1; j<=total_divs; j++)
			{
				if (j==(this.elid-1))
				{
					$('cuestionario'+j).setStyle('display', 'block');
				} else {
					$('cuestionario'+j).setStyle('display', 'none');
				}
				if (j<=this.elid-1)
				{
					$('numero'+j).src = 'http://www.accioncontraelhambre.org/images/cooperante/menu'+j+'_on.png';
				} else {
					$('numero'+j).src = 'http://www.accioncontraelhambre.org/images/cooperante/menu'+j+'.png';
				}
			}
		});
		
		coleccionRadios.each(function(e){
			e.respuesta = $$('#cuestionario'+i+' p.cuestionario');
			e.bot_sig = $$('#cuestionario'+i+' img.adelante2');
			e.bot_ant = $$('#cuestionario'+i+' img.adelante');
			e.elid = i;
			e.addEvent('click', function(o){
				this.respuesta.setStyle('display', 'block');
				this.bot_sig.setStyle('display', 'inline');
				this.bot_ant.setStyle('display', 'inline');
				if (this.elid==total_divs)
				{
					$$('.hazte').setStyle('display', 'inline');
				}
			});
		});
	}
	
	var respuestas = $$('p.cuestionario');
	respuestas.each(function(e){
		e.setStyle('display', 'none');
	});
}

function nif_correcto (dni) {
	dni = String(dni).toUpperCase();
	if (dni.substr(0, 1)=="X" || dni.substr(0, 1)=="Y" || dni.substr(0, 1)=="Z")
	{
		return validaNIE2008(dni);
	} else {
		var regular = new RegExp(/^[ABCDEFGHKLMNPQS]\d\d\d\d\d\d\d[0-9,A-J]$/g);
		if (!regular.exec(dni))
		{
			numero = dni.substr(0,dni.length-1);
			let = dni.substr(dni.length-1,1);
			numero = numero % 23;
			letra='TRWAGMYFPDXBNJZSQVHLCKET';
			letra=letra.substring(numero,numero+1);
			if (letra!=let) {
				return false;
			}else{
				return true;
			}
		} else {
			return validarCIF(dni);
		}
	}
}

var nav4 = window.event ? true : false;
function esDigito(evt){
	var key = nav4 ? evt.which : evt.keycode;
	return (key <= 13 || (key >= 48 && key <= 57));
}

function validarCIF(texto){
	
	var pares = 0;
	var impares = 0;
	var suma;
	var ultima;
	var unumero;
	var uletra = new Array("J", "A", "B", "C", "D", "E", "F", "G", "H", "I");
	var xxx;

	texto = texto.toUpperCase();

	var regular = new RegExp(/^[ABCDEFGHKLMNPQS]\d\d\d\d\d\d\d[0-9,A-J]$/g);
	 if (!regular.exec(texto)) return false;
		 
	 ultima = texto.substr(8,1);

	 for (var cont = 1 ; cont < 7 ; cont ++){
		 xxx = (2 * parseInt(texto.substr(cont++,1))).toString() + "0";
		 impares += parseInt(xxx.substr(0,1)) + parseInt(xxx.substr(1,1));
		 pares += parseInt(texto.substr(cont,1));
	 }
	 xxx = (2 * parseInt(texto.substr(cont,1))).toString() + "0";
	 impares += parseInt(xxx.substr(0,1)) + parseInt(xxx.substr(1,1));
	 
	 suma = (pares + impares).toString();
	 unumero = parseInt(suma.substr(suma.length - 1, 1));
	 unumero = (10 - unumero).toString();
	 if(unumero == 10) unumero = 0;
	 
	 if ((ultima == unumero) || (ultima == uletra[unumero]))
		 return true;
	 else
		 return false;

} 

function validaNIE2008 (strNie)
    {   
    // ---- no olvidar que tb hay que usar la función "HacerTrim"
    strLenNie = strNie.length;
    alfa="abcdefghijklmnñopqrstuvwxyz";
   
    var strPerfijo = strNie.substr(0,1);
           
    if (strPerfijo!='X' && strPerfijo!='x' && strPerfijo!='Y' && strPerfijo!='y' && strPerfijo!='Z' && strPerfijo!='z')
        { //No empieza por X Y Z           
        alert("N.I.E. Incorrecto\n\nEl N.I.E. debe comenzar por la letra 'X', 'Y' o 'Z'.");
        return false;       
        }
   
    strPerfijo = strPerfijo.toUpperCase();
   
   
    letraNie =strNie.substr(strLenNie-1,1)
    if (alfa.indexOf(letraNie)==-1 && (alfa.toUpperCase()).indexOf(letraNie)==-1)
        {//No acaba con una letra
        alert("N.I.E. Incorrecto\n\nEl N.I.E. debe acabar por una letra.");
        return false;
        }
    else
        letraNie=letraNie.toUpperCase();
   
    numNie =strNie.substr(1,strLenNie-2);

    // SAD:14/03/2006    Si usamos - lo toma como signo 'menos'

    if (isNaN(numNie) || numNie < 0 || numNie.length > 7)    
        { //La parte númerica contiene alguna letra   
        //alert("N.I.E. Incorrecto\n\nEl N.I.E. introducido es incorrecto, por favor revíselo antes de continuar.");
        return false;
        }


    numNie = HacerTrim(numNie);

        /*
        -------------------------------------------------------------    
        En teoría, todos deben ser de 7 dígitos, pero en la BBDD puede estar con 8, por lo tanto:
        - Dejamos el NIE EN 7 POSICIONES
        - En programa, es donde deberemos BUSCAR el NIE con 7 y 8 dígitos, siempre que empiece por 'X'
        - Si empieza por 'Y' ó 'Z' --> debe ser de 7 dígitos
        -------------------------------------------------------------    
        */

    while (numNie.length < 7)  // 04.07.2008
        {//Completa con 0 por la izquierda (7 DÍGITOS)
        numNie="0"+numNie;
        }

               
    vletras=["T","R","W","A","G","M","Y","F","P","D","X","B","N","J","Z","S","Q","V","H","L","C","K","E","T"];
    /*
    NUEVO!!! 04.07.2008
    Substituyo los pesos de las letras
        X = 0
        Y = 1
        Z = 2   
    */
    var numNie2008="";
    if (strPerfijo=='X'){ numNie2008 = "0"+ numNie; }
    if (strPerfijo=='Y'){ numNie2008 = "1"+ numNie; }
    if (strPerfijo=='Z'){ numNie2008 = "2"+ numNie; }

    valNie = numNie2008 % 23;
   
    if (valNie > vletras.length-1)
        { //Desborda el array
        //alert("N.I.E. Incorrecto\n\nEl N.I.E. introducido es incorrecto, por favor revíselo antes de continuar.");
        return false;
        }
       
    letraAux=vletras[valNie];       
           
    //if (letraNie != letraAux)
        //alert("N.I.E. Incorrecto\n\nEl N.I.E. introducido es incorrecto, por favor revíselo antes de continuar.");


    return (letraNie===letraAux)?true:false           
}// function validaNIE2008 (strNie)  

function HacerTrim(cadena)
   {
   for(i=0; i<cadena.length;)
   {
       if(cadena.charAt(i)==" ")
           {
           cadena=cadena.substring(i+1, cadena.length);
           }
       else
           break;
   }

   for(i=cadena.length-1; i>=0; i=cadena.length-1)
   {
       if(cadena.charAt(i)==" ")
           {
           cadena=cadena.substring(0,i);
           }
       else
           break;
   }
   return cadena;
}


function validaLibreta(i_entidad, i_oficina, i_digito, i_cuenta){
	// VALIDACIÓN DE CUALQUIER LIBRETA DE CUALQUIER ENTIDAD BANCARIA.
	// Funcion recibe como parámetro la entidad, la oficina,
	// el digito (concatenación del de control entidad-oficina y del de control entidad)
	// y la cuenta. Espera los valores con 0's a la izquierda.
	// Devuelve true o false.
	// NOTAS:
	// Formato deseado de los parámetros:
	// - i_entidad (4)
	// - i_oficina (4)
	// - i_digito (2)
	// - i_cuenta (10)
	var wtotal,wcociente, wresto;
	if (i_entidad.length != 4){
		return false;
	}
	if (i_oficina.length != 4){
		return false;
	}
	if (i_digito.length != 2){
		return false;
	}
	if (i_cuenta.length != 10){
		return false;
	}
	wtotal = i_entidad.charAt(0) * 4;
	wtotal += i_entidad.charAt(1) * 8;
	wtotal += i_entidad.charAt(2) * 5;
	wtotal += i_entidad.charAt(3) * 10;
	wtotal += i_oficina.charAt(0) * 9;
	wtotal += i_oficina.charAt(1) * 7;
	wtotal += i_oficina.charAt(2) * 3;
	wtotal += i_oficina.charAt(3) * 6;
	// busco el resto de dividir wtotal entre 11
	wcociente = Math.floor(wtotal / 11);
	wresto = wtotal - (wcociente * 11);
	//
	wtotal = 11 - wresto;
	if (wtotal == 11){
		wtotal=0;
	}
	if (wtotal == 10){
		wtotal=1;
	}
	if (wtotal != i_digito.charAt(0)){
		return false;
	}
	//hemos validado la entidad y oficina
	//-----------------------------------
	wtotal = i_cuenta.charAt(0) * 1;
	wtotal += i_cuenta.charAt(1) * 2;
	wtotal += i_cuenta.charAt(2) * 4;
	wtotal += i_cuenta.charAt(3) * 8;
	wtotal += i_cuenta.charAt(4) * 5;
	wtotal += i_cuenta.charAt(5) * 10;
	wtotal += i_cuenta.charAt(6) * 9;
	wtotal += i_cuenta.charAt(7) * 7;
	wtotal += i_cuenta.charAt(8) * 3;
	wtotal += i_cuenta.charAt(9) * 6;

	// busco el resto de dividir wtotal entre 11
	wcociente = Math.floor(wtotal / 11);
	wresto = wtotal - (wcociente * 11);
	//
	wtotal = 11 - wresto;
	if (wtotal == 11){wtotal=0;}
	if (wtotal == 10){wtotal=1;}

	if (wtotal != i_digito.charAt(1)){
		//alert(wtotal+' y no '+i_digito.charAt(1));
		return false;
	}
	// hemos validado la cuenta corriente

	return true;
}


function validate_form_socio(paso)
{
	var coleccion = $$('#Tab'+paso+' input.required');
	var coleccionSel = $$('#Tab'+paso+' select.required');
	var coleccionRad = $$('#Tab'+paso+' input.radio');
	var total = 0;
	var cuantos = 0;

	pixelesX = 0;
    quienx= "Para ser socio o donante debe aceptar nuestra política de privacidad.";
    
    if (paso==1000) { quienx="Para ser socio o donante debe aceptar nuestra política de privacidad"; paso=1; }
	
	switch (paso)
	{
		case 1:
			total = 9;
			if ($('socio_check').checked==true && $('politica_check').checked==true)
			{
            	
				coleccion.each(function(e){
					e.addEvent('blur', function(obj){
						if(this.value!='' && this.value!="Datos obligatorios o incorrectos")
						{
							this.setStyle('border', '1px solid #b0b0b0');
						}
					});
					e.addEvent('focus', function(obj){
						if (this.value=='Datos obligatorios o incorrectos')
						{
							this.value='';
						}
					});
					if (e.value!="" && e.value!="Datos obligatorios o incorrectos" && e.getAttribute('regexp')!="VAL_DNI")
					{
						cuantos++;
						tipo = "ok";
						e.setStyle('border', '1px solid #b0b0b0');
					} else {
						if (e.getAttribute('regexp')!="VAL_DNI")
						{
							cuantos--;
							tipo = "ko";
							e.setStyle('border', '1px solid red');
							e.value = 'Datos obligatorios o incorrectos';
						}
					}
                    
					if (e.getAttribute('regexp')=="VAL_EMAIL")
					{
						ok = (/^[a-zA-ZüöäßÄÖÜ]+([\.-_]?[a-zA-ZüöäßÄÖÜ]+)*@[a-zA-ZüöäßÄÖÜ]+([\.-]?[a-zA-ZüöäßÄÖÜ]+)*(\.\w{2,5})+$/).test(e.value);
						if (!ok)
						{
							tipo = "ko";
							cuantos--;
							e.setStyle('border', '1px solid red');
							if (e.value=='Datos obligatorios o incorrectos')
							{
								e.value = 'Datos obligatorios o incorrectos';
							}
						} else {
							cuantos++;
							e.setStyle('border', '1px solid #b0b0b0');
						}
					}
                    
					if (e.getAttribute('regexp')=="VAL_DNI")
					{
						el_nif = e.value;
						ok = nif_correcto(e.value);
						if(!ok && e.value!="" && e.value!="Datos obligatorios o incorrectos")
						{
							tipo = "ko";
							cuantos = 0;
							e.setStyle('border', '1px solid red');
							if (e.value=='Datos obligatorios o incorrectos')
							{
								e.value = 'Datos obligatorios o incorrectos';
							}
							ok = false;
						} else {
							tipo = "ok";
							if (cuantos>=total)
							{
								cuantos = total;
							}
							e.setStyle('border', '1px solid #b0b0b0');
							ok = true;
						}
					}
                    
				});
                
                //alert("ch: "+ok);
                
			} else {
				alert(quienx);
			}
			if (cuantos>=total)
			{
				ok = true;
			} else {
				ok = false;
			}
			break;
		case 2:
			if (String(url_actual).indexOf('donativo')==-1)
			{
			total = 2;
			coleccionSel.each(function(e){
				e.coordX = ((e.getCoordinates().left-e.getStyle('width').toInt())-70)+pixelesX;
				if ($('div_'+e.name))
				{
					$('div_'+e.name).set('html', '');
				}
				e.addEvent('blur', function(obj){
					if(this.value!='' && this.value!="Datos obligatorios o incorrectos")
					{
						this.setStyle('border', '1px solid #b0b0b0');
					}
				});
				if (e.value!="" && e.value!="Datos obligatorios o incorrectos")
				{
					cuantos++;
					tipo = "ok";
					e.setStyle('border', '1px solid #b0b0b0');
				} else {
					cuantos--;
					tipo = "ko";
					e.setStyle('border', '1px solid red');
					e.value = 'Datos obligatorios o incorrectos';
				}
			});
			} else {
				total = 1;
			}
			var contadorDos = 0;
			coleccionRad.each(function(e){
				contadorDos++;
				coleccion.each(function(e){
					e.setStyle('border', '1px solid #b0b0b0');
				});
				if (contadorDos>3)
				{
					if (e.checked==true)
					{
						coleccion.each(function(e){
							e.coordX = ((e.getCoordinates().left-e.getStyle('width').toInt())-170)+pixelesX;
							if (e.value>0 && e.value < 9999999)
							{
								cuantos++;
								tipo = "ok";
								e.setStyle('border', '1px solid #b0b0b0');
								if ($('div_'+e.name))
								{
									$('div_'+e.name).set('html', '');
								}
							} else {
								cuantos--;
								tipo = "ko";
								e.setStyle('border', '1px solid red');
							}
							/*if (e!=null)
							{
								if (!$('div_'+e.name))
								{
									var nuevoElemento = new Element("div", {
									   "id": "div_"+e.name
									});
									nuevoElemento.setStyles({
										"position": "absolute",
										"width": "50px",
										"height": "20px",
										"top": (e.getCoordinates().top-50)+'px',
										"left": (e.getCoordinates().left+160)+'px'
										});
									nuevoElemento.injectAfter(e);
									var elementoImg = new Element("img", {
									   "id": "img_"+e.name,
									   "src": 'http://www.accioncontraelhambre.org/images/formulario/icono_'+tipo+'.png'
									});
									elementoImg.injectInside(nuevoElemento);
								} else {
									if (!$('img_'+e.name))
									{
										var elementoImg = new Element("img", {
										   "id": "img_"+e.name,
										   "src": 'http://www.accioncontraelhambre.org/images/formulario/icono_'+tipo+'.png'
										});
										elementoImg.injectInside(nuevoElemento);
									}
									$('img_'+e.name).src = 'http://www.accioncontraelhambre.org/images/formulario/icono_'+tipo+'.png';
								}
							}*/
						});
					}
				} else {
					if (e.checked==true)
					{
						cuantos ++;
					}
				}
			});
			if (cuantos>=total)
			{
				ok = true;
			} else {
				ok = false;
			}
			break;
		case 3:
			total = 2;
			var contadorTres = 0;
			var entidad = "";
			var oficina = "";
			var digito = "";
			var cuenta = "";
			coleccion.each(function(e){
				e.coordX = ((e.getCoordinates().left-e.getStyle('width').toInt())-20)+pixelesX;
				if ($('div_'+e.name))
				{
					$('div_'+e.name).set('html', '');
				}
				e.addEvent('blur', function(obj){
					if(this.value!='')
					{
						this.setStyle('border', '1px solid #b0b0b0');
					}
				});
				e.addEvent('focus', function(obj){
					if (this.value=='Datos obligatorios o incorrectos')
					{
						this.value='';
					}
				});
				if (e.getAttribute('regexp')!="VAL_CC")
				{
					if (e.value!="" && e.value!="Datos obligatorios o incorrectos")
					{
						cuantos++;
						tipo = "ok";
						e.setStyle('border', '1px solid #b0b0b0');
					} else {
						cuantos--;
						tipo = "ko";
						e.setStyle('border', '1px solid red');
						e.value = 'Datos obligatorios o incorrectos';
					}
				}
				if (e.getAttribute('regexp')=="VAL_CC")
				{
					e.setStyle('border', '1px solid #b0b0b0');
					contadorTres++;
					//i_entidad, i_oficina, i_digito, i_cuenta
					switch (contadorTres)
					{
						case 1:
							entidad = e.value;
							cc_1 = e;
							break;
						case 2:
							oficina = e.value;
							cc_2 = e;
							break;
						case 3:
							digito = e.value;
							cc_3 = e;
							break;
						case 4:
							cuenta = e.value;
							cc_4 = e;
							break;
					}
					if (e.value=="")
					{
						e.setStyle('border', '1px solid red');
					}
					if (contadorTres>=4)
					{
						if (entidad!="" && oficina!="" && digito!="" && cuenta!="")
						{
							ok = validaLibreta(entidad, oficina, digito, cuenta);
							if (ok==false)
							{
								tipo = "ko";
								cuantos--;
								cc_1.setStyle('border', '1px solid red');
								cc_2.setStyle('border', '1px solid red');
								cc_3.setStyle('border', '1px solid red');
								cc_4.setStyle('border', '1px solid red');
							} else {
								tipo = "ok";
								cc_1.setStyle('border', '1px solid #b0b0b0');
								cc_2.setStyle('border', '1px solid #b0b0b0');
								cc_3.setStyle('border', '1px solid #b0b0b0');
								cc_4.setStyle('border', '1px solid #b0b0b0');
								cuantos+=4;
							}
						} else {
							tipo = "ko";
						}
					}
				}
			});
			if (cuantos>=total)
			{
				ok = true;
			} else {
				ok = false;
			}
			break;
	}
	window.onresize = function(){
		coleccion.each(function(objeto){
		if ($('div_'+objeto.name))
		{
			var el_div = $('div_'+objeto.name);
				el_div.setStyles({
					"top": (objeto.getCoordinates().top+20)+'px',
					"left": objeto.coordX+'px'
				});
		}
		});
	};
	if (ok)
	{
		var trig = $$(".formu_nav li a");
		contador = 0;
		trig.each(function(e){
			switch (contador)
			{
				case 0:
					primer_boton = e;
					break;
				case 1:
					sgundo_boton = e;
					break;
			}
			if (contador<=paso)
			{
				if (contador==paso)
				{
					if (paso>=3)
					{
						if (validate_form_socio(1))
						{
							if (validate_form_socio(2))
							{
								hazte_socio();
							} else {
								sgundo_boton.fireEvent('click');
								return;
							}
						} else {
							primer_boton.fireEvent('click');
							return;
						}
					}
					var lanzaElTPV = false;
					if (paso==2)
					{
						if (validate_form_socio(1))
						{
							if (String(url_actual).indexOf('donativo')!=-1)
							{
								lanzaTPV();
								lanzaElTPV = true;
							}
						} else {
							primer_boton.fireEvent('click');
							return;
						}
					}
					if (!lanzaElTPV)
					{
						e.fireEvent('click');
					}
				}
				e.setStyle('display', 'block');
			} else {
				if (e.getStyle('display')=='none')
				{
					e.setStyle('display', 'none');
				}
			}
			contador++;
		});
	}
	
	return ok;
}

var estadologin = false;
var microsite = false;
Shadowbox.init({
    language:   "es",
	players:    ["iframe", "img"],
	overlayColor:'#333333'
});


function open_window (type, id)
{
	switch (type)
	{


		case "politicas":
			seccion = "";
			tabla = "t_landing";
			pagina = "politicas.php";
			alto = 500;
			ancho = 800;
			added = "?action=memorias";
			break;	
            
            
		case "landing":
			seccion = "";
			tabla = "t_landing";
			pagina = "landing.php";
			alto = 599;
			ancho = 899;
			added = "?action=memorias";
			break;	
            
 		case "diadelagua":
			seccion = "";
			tabla = "t_landing";
			pagina = "acciones/diadelagua/listado.php";
			alto = 535;
			ancho = 885;
			added = "?action=memorias";
			break;	
            
            
	
		case "memorias":
			seccion = "Memorias";
			tabla = "t_memorias";
			pagina = "historico.php";
			alto = 337;
			ancho = 550;
			added = "?action=memorias";
			break;
		
		case "entrar_cooperante":
			seccion = "Cooperante autentificación";
			tabla = "t_cooperante";
			pagina = "cooperante_auth.php";
			alto = 245;
			ancho = 420;
			added = "?action="+type;
			break;
			
		case "registro_cooperante":
			seccion = "Registro Cooperante 2.0";
			tabla = "t_cooperante";
			pagina = "cooperante_auth.php";
			alto = 245;
			ancho = 420;
			added = "?action="+type;
			break;
			
		case -1:
		case -2:
		case -3:
			if (type==-1)
			{
				type = "datos_pais";
			}
			if (type==-2)
			{
				type = "que_hacemos";
			}
			if (type==-3)
			{
				type = "contexto_hum";
			}
			url = document.location.href;
			url_cortada = url.split('/');
			if (url_cortada[5]!=undefined)
			{
				//url_parametros = url_cortada[1].split('/');
				//alert("El ID es "+url_parametros[1]+" y el pais "+url_parametros[3]);
				alto = 500;
				ancho = 550;
				seccion = "";
				pagina = "box_content.php";
				added = "?action="+type+"&id="+url_cortada[5];
				break;
			}
			
		case -4:
			type = "informe_pais";
			url = document.location.href;
			url_cortada = url.split('/');
			added = "&from=other";
			if (id!="" && id!=undefined)
			{
				url_cortada[6] = id;
			}
			if (url_cortada[6]!=undefined)
			{
				//url_parametros = url_cortada[1].split('/');
				//alert("El ID es "+url_parametros[1]+" y el pais "+url_parametros[3]);
				alto = 550;
				ancho = 650;
				seccion = "";
				pagina = "box_content.php";
				added = "?action="+type+"&id="+url_cortada[6]+added;
			}
			break;
			
		case -5:
			type = "descarga_kit";
			if (id=="1")
			{
				alto = 440;
				ancho = 580;
			} 
			if (id=="2") {
				alto = 475;
				ancho = 460;
			}
			if (id=="3")
			{
				alto = 530;
				ancho = 580;
			} 
			seccion = "";
			pagina = "box_content.php";
			added = "?action="+type+"&id="+id;
			break;
			
		case -6:
			type = "publicaciones";
			url = document.location.href;
			url_cortada = url.split('/');
			added = "&from=other";
			if (id!="" && id!=undefined)
			{
				url_cortada[6] = id;
			}
			if (url_cortada[6]!=undefined)
			{
				//url_parametros = url_cortada[1].split('/');
				//alert("El ID es "+url_parametros[1]+" y el pais "+url_parametros[3]);
				alto = 550;
				ancho = 650;
				seccion = "";
				pagina = "box_content.php";
				added = "?action="+type+"&id="+url_cortada[6]+added;
			}
			break;
			
		case -7:
			type = "posicionamiento";
			url = document.location.href;
			url_cortada = url.split('/');
			added = "&from=other";
			if (id!="" && id!=undefined)
			{
				url_cortada[6] = id;
			}
			if (url_cortada[6]!=undefined)
			{
				//url_parametros = url_cortada[1].split('/');
				//alert("El ID es "+url_parametros[1]+" y el pais "+url_parametros[3]);
				alto = 550;
				ancho = 650;
				seccion = "";
				pagina = "box_content.php";
				added = "?action="+type+"&id="+url_cortada[6]+added;
			}
			break;
			
		case -8:
			type = "formacion";
			url = document.location.href;
			url_cortada = url.split('/');
			added = "&from=other";
			if (id!="" && id!=undefined)
			{
				url_cortada[6] = id;
			}
			if (url_cortada[6]!=undefined)
			{
				//url_parametros = url_cortada[1].split('/');
				//alert("El ID es "+url_parametros[1]+" y el pais "+url_parametros[3]);
				alto = 550;
				ancho = 650;
				seccion = "";
				pagina = "box_content.php";
				added = "?action="+type+"&id="+url_cortada[6]+added;
			}
			break;
			
		case -9:
			type = "documentos_ref_empresas";
			alto = 337;
			ancho = 550;
			seccion = "";
			pagina = "box_content.php";
			added = "?action="+type+"&id=0";
			break;
			
		case -10:
			type = "licitaciones";
			url = document.location.href;
			url_cortada = url.split('/');
			added = "&from=other";
			if (id!="" && id!=undefined)
			{
				url_cortada[6] = id;
			}
			if (url_cortada[6]!=undefined)
			{
				//url_parametros = url_cortada[1].split('/');
				//alert("El ID es "+url_parametros[1]+" y el pais "+url_parametros[3]);
				alto = 550;
				ancho = 650;
				seccion = "";
				pagina = "box_content.php";
				added = "?action="+type+"&id="+url_cortada[6]+added;
			}
			break;
			
		default:
			alto = 500;
			ancho = 550;
	}
	//content:    'http://www.accioncontraelhambre.org/ficha_pais.php#id_map/4/pais/filipinas',
	
	
	Shadowbox.open({
		language: "es",
        content:    'http://www.accioncontraelhambre.org/'+pagina+added,
        player:     "iframe",
        title:      seccion,
        width:      ancho,
		height: 	alto,
		options: {
				onClose: function()
				{
					if (estadologin)
					{
						setTimeout(function(){
							if (type=="entrar_cooperante" || type=="registro_cooperante")
							{
								if (type=="registro_cooperante")
								{
									alert("Recibirás un email en tu correo para activar la cuenta.");
								}
								document.location.href = "http://www.accioncontraelhambre.org/cooperante.php";
							}
						}, 300);
					}
					if (microsite)
					{
						alert("GRACIAS");
						parent.tpvStatus('OK');
						microsite = false;
					}
				}
		}
    });
	
	
	
	
	
	
	
	
	
	
	
	
}


function cierra_window(desde, estado)
{
	switch(desde)
	{
		case "cooperante":
			parent.estadologin = estado;
			parent.Shadowbox.close();
			break;
			
		case "tpv":
			var trig = parent.$$(".formu_nav li a");
			var trig_li = parent.$$(".formu_nav li");
			var contador = 1;
			parent.limpia_form();
			var raiz = parent;
			trig.each(function(e){
				if (contador>3)
				{
					e.fireEvent('click');
					e.setStyle('display', 'block');
				}
				contador++;
			});
			var contador = 1;
			trig_li.each(function(e){
				if (contador==3)
				{
					e.setStyle('display', 'none');
					e.destroy();
				}
				contador++;
			});
			var contador = 1;
			trig.each(function(e){
				if (contador<=3)
				{
					e.addEvent('click', function()
					{
						raiz.create_tabs("final");
					});
				}
				contador++;
			});
			parent.Shadowbox.close();
			break;
			
		case "tpv_5000":
			parent.Shadowbox.close();
			microsite = true;
			break;
	}
}


function limpia_form ()
{
	for (var i=1; i<=3; i++)
	{
		var coleccion = $$('#Tab'+i+' input');
		var coleccionSel = $$('#Tab'+i+' select');
		
		if (coleccionSel!=null)
		{
			coleccion.each(function(obj){
				obj.value = "";
			});
		}
		if (coleccionSel!=null)
		{
			coleccionSel.each(function(obj){
				obj.value = "";
			});
		}
	}
}

function search_criteria ()
{
	document.forms.searchform.action = 'http://www.accioncontraelhambre.org/buscador.php/search/'+$('q').value+'/page/0';
	document.forms.searchform.submit();
}


function error_socio_bbdd(numero)
{
	var pestanas = $$(".formu_nav li a");
	var contador = 1;
	pestanas.each(function(e){
		if (contador==numero)
		{
			e.fireEvent("click");
		}
		contador++;
	});
	//Ocultamos la últimas pestaña
	var trig = $$(".formu_nav li a");
	var lis = $$("ul.formu_nav li");
	contador = 1;
	lis.each(function(e){
		if (contador>3)
		{
			e.setStyle('background', 'none');
		}
		contador++;
	});
	contador = 1;
	trig.each(function(e){
		if (contador>3)
		{
			e.setStyle('display', 'none');
		}
		contador++;
	});
}



var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		//return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
		return dataString.substring(index+this.versionSearchString.length+1);
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

//Detectamos el navegador y OS para los pixeles en el eje X de los avisos
var navegador = BrowserDetect.browser;
var SO = BrowserDetect.OS;
var versionNav = BrowserDetect.version;
var versionFloat = parseFloat(versionNav);

var formulario_socio;
if(String(location.href).indexOf('hazte_socio')!=-1 ||String(location.href).indexOf('haz_donativo')!=-1)
{
	window.addEvent('domready', create_tabs);
	/*window.addEvent('domready', function(){
		/*formulario_socio = new FormCheck('form1', {
			display : {
				showErrors : 0,	
				closeTipsButton : 0,
				flashTips : 1
			}
	})*/
		/*formulario_socio = new FormCheck('form1', {
			display : {
					errorsLocation : 1,
					indicateErrors : 2,
					keepFocusOnError : 0,
					closeTipsButton : 0,
					showErrors : 1
			}
		});
	});*/
}

if(String(location.href).indexOf('cooperante_cuestionario')!=-1)
{
	window.addEvent('domready', create_cuestionario);
}

if(String(location.href).indexOf('panel')!=-1)
{
	window.addEvent('domready', function(){
		if (document.location.hash.indexOf('info_relacionada'!=-1))
		{
			var scroller = new Fx.Scroll(document.body);
			scroller.toBottom();
		}
	});
}


