
//coge una variable dada(por su número empezando desde 0 o su nombre)             
function cogerVariable(variable){ 
             

    var tipo = typeof variable; 
    var direccion = location.href; 
                 
    if (tipo == "string"){ 
        var posicion = direccion.indexOf("?"); 
        posicion = direccion.indexOf(variable,posicion) + variable.length; 
    } 
    else if (tipo == "number"){ 
        var posicion=0; 
        for (var contador = 0 ; contador < variable + 1 ; contador++){ 
            posicion = direccion.indexOf("=",++posicion); 
            if (posicion == -1)posicion=999; 
        } 
    } 
    if (direccion.charAt(posicion) == "="){ 
        var final = direccion.indexOf("&",posicion); 
        if (final == -1){final=direccion.length;}; 
        var Marce= unescape(direccion.substring(posicion + 1,final));
		return Marce
    }

} 


//Da la cantidad de elementos empezando desde 0 
function contarVariables(){ 
                 
    var direccion = self.location.href; 
    var posicion = direccion.indexOf("?"); 
                 
    for (var contador = -1 ; posicion != -1 ; ++contador){ 
        posicion = direccion.indexOf("=",++posicion); 
    } 
                 
    if (contador < 0)contador=0; 
                 
    return contador; 
} 

//da el nombre de una variable 
function nombreVariable(variable){ 

    var tipo = typeof variable; 
    var direccion = location.href; 
                 
    if (tipo == "string"){ 
        var posicion = direccion.indexOf("?"); 
        if ((posicion > 0) && (direccion.indexOf(variable,posicion) > -1)) 
            posicion = direccion.indexOf(variable,posicion); 
        else 
            posicion = 0; 
    } 
    else if (tipo == "number"){ 
        var posicion = 0; 
        posicion = direccion.indexOf("?"); 
        for (var contador = 0 ; ((contador < variable) && (posicion != -1)) ; contador++){ 
            posicion = direccion.indexOf("&", ++posicion); 
        } 
        posicion++; 
    } 
    if (posicion > 0){ 
        var final = direccion.indexOf("=",posicion); 
        //alert(posicion + " , " + final); 
        if (final == -1){final=direccion.length;}; 
        return direccion.substring(posicion,final); 
    } 
     
} 

  
function valEmail(txt){
     
    //expresion regular  
        var b=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/  
          
        //comentar la siguiente linea si no se desea que aparezca el alert()  
        //alert("Email " + (b.test(txt)?"":"no ") + "válido.")  

		if(b.test(txt) == false){alert("Email " + (b.test(txt)?"":"no ") + "valido.");};
      	
		
        //devuelve verdadero si validacion OK, y falso en caso contrario 
        return b.test(txt)  
}  



function cont(destino) {
	var c= destino + "?v1=";
	var rc= 0
	
	if (document.forms['form']['radio1'][2].checked) {rc= rc + 1;}	   
	if (document.forms['form']['radio2'][1].checked) {rc= rc + 1;}	
	if (document.forms['form']['radio3'][2].checked) {rc= rc + 1;}	
	if (document.forms['form']['radio4'][1].checked) {rc= rc + 1;}	
	if (document.forms['form']['radio5'][1].checked) {rc= rc + 1;}	 
	  

    if (document.forms['form']['radio1'][0].checked)
        {c= c + "true";}
	else
		{c= c + "false";}
    if (document.forms['form']['radio1'][1].checked)
        {c= c + "&v2=true";}
	else
		{c= c + "&v2=false";}
    if (document.forms['form']['radio1'][2].checked)
        {c= c + "&v3=true";}
	else
		{c= c + "&v3=false";}



    if (document.forms['form']['radio2'][0].checked)
        {c= c + "&v4=true";}
	else
		{c= c + "&v4=false";}
    if (document.forms['form']['radio2'][1].checked)
        {c= c + "&v5=true";}
	else
		{c= c + "&v5=false";}
    if (document.forms['form']['radio2'][2].checked)
        {c= c + "&v6=true";}
	else
		{c= c + "&v6=false";}


    if (document.forms['form']['radio3'][0].checked)
        {c= c + "&v7=true";}
	else
		{c= c + "&v7=false";}
    if (document.forms['form']['radio3'][1].checked)
        {c= c + "&v8=true";}
	else
		{c= c + "&v8=false";}
    if (document.forms['form']['radio3'][2].checked)
        {c= c + "&v9=true";}
	else
		{c= c + "&v9=false";}


    if (document.forms['form']['radio4'][0].checked)
        {c= c + "&v10=true";}
	else
		{c= c + "&v10=false";}
    if (document.forms['form']['radio4'][1].checked)
        {c= c + "&v11=true";}
	else
		{c= c + "&v11=false";}
    if (document.forms['form']['radio4'][2].checked)
        {c= c + "&v12=true";}
	else
		{c= c + "&v12=false";}


    if (document.forms['form']['radio5'][0].checked)
        {c= c + "&v13=true";}
	else
		{c= c + "&v13=false";}
    if (document.forms['form']['radio5'][1].checked)
        {c= c + "&v14=true";}
	else
		{c= c + "&v14=false";}
    if (document.forms['form']['radio5'][2].checked)
        {c= c + "&v15=true";}
	else
		{c= c + "&v15=false";}


	c= c + "&v16=" + String(rc) ;

	location.href = c;
		
}


function enviaasimismo(form) {
//form.ar_file.value= form.email.value;
//alert(form.recipient.value)
}


