var lista = new Array('0.png', '1.png', '2.png' , '3.png');

var contador = 0;
var tiempo = 0;
var tempor = null;
var base=null;
var letra_old;
function cambio(sen)
{
   contador+= sen;
   document.getElementById("carrusel").src = base+"images/"+lista[contador];
   document.getElementById("comentarios").innerHTML = comentarios[contador];

}

function reset()
{
contador = 0;
fin = false;
document.getElementById("carrusel").src = base+"images/"+lista[0];
document.getElementById("comentarios").innerHTML = comentarios[0];
}

function automat(base_aux,seg)
{
	
tiempo = parseInt(seg);
base=base_aux;
reset();

if (isNaN(tiempo) || tiempo <= 0)
    alert("Error en el tiempo")
else 
    tempor = setTimeout("pasar()", tiempo);
}

function parar()
{
clearTimeout(tempor);
}

function pasar()
{
cambio(1);
if (contador < lista.length-1){
    tempor = setTimeout("pasar()", tiempo);
	
}else{
	tempor = setTimeout("reset()", tiempo);
	tempor = setTimeout("pasar()", tiempo*2);
	}
}

/*
function muestra_ajax(o,u,metodo,sincapas,muestrafinal,capaPrioritaria){
	cposcura=document.createElement('div');
	cposcura.id='negra';
	cpmensaje=document.createElement('div');
	cpmensaje.id='pop';
	cposcura.onclick=destruye_ajax;
	if(sincapas){
		if(capaPrioritaria){
			cpmensaje=capaPrioritaria;
		}
		else{
			cpmensaje=o;
		}
	}
	
	
	var xmlhttpa=_creaXML();
	pgsol=u;
	if(metodo){
		xmlhttpa.open(metodo,pgsol,true);
		valores='video='+document.getElementById("name_video").value;
		var i=0;
		for(i=0;i<o.elements.length;i++){
			if(o.elements[i].name){
				valores+='&'+o.elements[i].name+'='+o.elements[i].value;
			}
		}
				
	}
	else{
		xmlhttpa.open("get",pgsol,true);
	}
	xmlhttpa.onreadystatechange=function(){
		if(xmlhttpa.readyState==4){
			txtres=xmlhttpa.responseText;
			cpmensaje.innerHTML=txtres;
			if(muestrafinal && txtres && txtres.indexOf('centradito')==-1){
				muestrafinal.style.display='';
			}
		}
	}
	
	if(metodo){
		xmlhttpa.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlhttpa.send(valores);
	}
	else{
		xmlhttpa.setRequestHeader('Accept','message/x-jl-formresult');
		xmlhttpa.send(null);	
				
	}
	if(!sincapas){
		cpmensaje.style.top='0px';
		//o.appendChild(cpmensaje);
		cpmensaje.style.left=parseInt((document.documentElement.clientWidth/2)-237.5)+'px';
		cpmensaje.style.top=document.documentElement.scrollTop+parseInt(document.documentElement.clientHeight/4)+'px';
		document.body.appendChild(cposcura);
		document.body.appendChild(cpmensaje);
		
		
		
	}
	return false;
}*/
function _creaXML(){
	var xmlhttp=false;
	if (window.XMLHttpRequest)  {// code for all new browsers
  		xmlhttp=new XMLHttpRequest();
  	} else if (window.ActiveXObject) {// code for IE5 and IE6
  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
	return xmlhttp;
}

function _Llamada_Ajax(url,IdForm,divResp)
{ 
 
 var id=IdForm;
   var txt=$(id).serialize();
     $.post(url, txt, function(data){
          $(divResp).html(data);
    }); 
	
}
function destruye_ajax(){
	document.getElementById('negra').parentNode.removeChild(document.getElementById('negra'));
	document.getElementById('pop').parentNode.removeChild(document.getElementById('pop'));
}

function destruye_ajax_2(){
	document.getElementById('negra').parentNode.removeChild(document.getElementById('negra'));
	document.getElementById('pop').parentNode.removeChild(document.getElementById('pop'));
}

function muestra_ajax(o,url,metodo,sincapas,muestrafinal,capaPrioritaria,titulo){
	cposcura=document.createElement('div');
	cposcura.id='negra';
	cpmensaje=document.createElement('div');
	cpmensaje.id='pop';
	//cposcura.onclick=destruye_ajax;
	
	csuperior=document.createElement('div');
	csuperior.id='form_superior';
	
	cinterior=document.createElement('div');
	cinterior.id='form_interior';
	
	cinterior_contenido=document.createElement('div');
	cinterior_contenido.id='form_interior_contenido';
	
	cinferior=document.createElement('div');
	cinferior.id='form_inferior';
	
	ccerrar=document.createElement('div');
	ccerrar.id='boton_cerrar';
	
	ctexto=document.createElement('div');
	ctexto.id='titulo_pop';
	//ctexto.innerHTML="Recordar mis claves de acceso";
	ctexto.innerHTML = titulo;
	clink=document.createElement('a');
	clink.onclick=destruye_ajax;
	clink.style.cursor = 'pointer';
	cimagen=document.createElement('div');
	cimagen.id="imagen_popup";
	
	clink.appendChild(cimagen);
	
	ccerrar.appendChild(clink);
	
	csuperior.appendChild(ctexto);
	csuperior.appendChild(ccerrar);
	
	/*csuperior.innerHTML="superior";
	cinterior.innerHTML="<p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p>";
	cinferior.innerHTML="inferior";*/
	/*if(sincapas){
		if(capaPrioritaria){
			cpmensaje=capaPrioritaria;
		}
		else{
			cpmensaje=o;
		}
	}
	*/
	
	var xmlhttpa=_creaXML();
	pgsol=url;
	if(metodo){
		xmlhttpa.open(metodo,pgsol,true);
		valores='video='+document.getElementById("name_video").value;
		var i=0;
	/*	for(i=0;i<o.elements.length;i++){
			if(o.elements[i].name){
				valores+='&'+o.elements[i].name+'='+o.elements[i].value;
			}
		}*/
				
	}
	else{
		xmlhttpa.open("get",pgsol,true);
	}
	xmlhttpa.onreadystatechange=function(){
		cloader=document.createElement('div');
	    cloader.id='form_loader';
		cloader.style.height="100px";
		cinterior_contenido.appendChild(cloader);
		
		if(xmlhttpa.readyState==4){
			txtres=xmlhttpa.responseText;
			cinterior_contenido.removeChild(cloader);
			cinterior_contenido.innerHTML=txtres; 
			if(muestrafinal && txtres && txtres.indexOf('centradito')==-1){
				muestrafinal.style.display='';
			}
		}
	}
	
	if(metodo){
		xmlhttpa.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlhttpa.send(valores);
	}
	else{
		xmlhttpa.setRequestHeader('Accept','message/x-jl-formresult');
		xmlhttpa.send(null);	
				
	}
	//if(!sincapas){
		
		cpmensaje.style.top='0px';
		//o.appendChild(cpmensaje);
		cpmensaje.style.left=parseInt((document.documentElement.clientWidth/2)-300.5)+'px';
		cpmensaje.style.top=document.documentElement.scrollTop+parseInt(document.documentElement.clientHeight/4)+'px';
		//cpmensaje.innerHTML="hola";
		document.body.appendChild(cposcura);
		document.body.appendChild(cpmensaje);
		cinterior.appendChild(cinterior_contenido);
		cpmensaje.appendChild(csuperior);
		cpmensaje.appendChild(cinterior);
		cpmensaje.appendChild(cinferior);
		
		
		
	//}
	return false;
}

function msg_noLogin(o,url,metodo,sincapas,muestrafinal,capaPrioritaria){
	dc_track('1016317', 'dmpd001', 'dmpd004');
	cposcura=document.createElement('div');
	cposcura.id='negra';
	cpmensaje=document.createElement('div');
	cpmensaje.id='pop';
	//cposcura.onclick=destruye_ajax;
	
	csuperior=document.createElement('div');
	csuperior.id='form_superior_reg';
	
	cinterior=document.createElement('div');
	cinterior.id='form_interior_reg';
	
	cinterior_contenido=document.createElement('div');
	cinterior_contenido.id='form_interior_reg_contenido';
	
	cinferior=document.createElement('div');
	cinferior.id='form_inferior_reg';
	
	ccerrar=document.createElement('div');
	ccerrar.id='boton_cerrar';
	
	ctexto=document.createElement('div');
	ctexto.id='titulo_pop_reg';
	ctexto.innerHTML="Atención";
	clink=document.createElement('a');
	clink.onclick=destruye_ajax;
	clink.style.cursor = 'pointer';
	cimagen=document.createElement('div');
	cimagen.id="imagen_popup";
	
	clink.appendChild(cimagen);
	
	ccerrar.appendChild(clink);
	
	csuperior.appendChild(ctexto);
	csuperior.appendChild(ccerrar);
	
	/*csuperior.innerHTML="superior";
	cinterior.innerHTML="<p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p>";
	cinferior.innerHTML="inferior";*/
	/*if(sincapas){
		if(capaPrioritaria){
			cpmensaje=capaPrioritaria;
		}
		else{
			cpmensaje=o;
		}
	}
	*/
	
	var xmlhttpa=_creaXML();
	pgsol=url;
	if(metodo){
		xmlhttpa.open(metodo,pgsol,true);
		valores='video='+document.getElementById("name_video").value;
		var i=0;
	/*	for(i=0;i<o.elements.length;i++){
			if(o.elements[i].name){
				valores+='&'+o.elements[i].name+'='+o.elements[i].value;
			}
		}*/
				
	}
	else{
		xmlhttpa.open("get",pgsol,true);
	}
	xmlhttpa.onreadystatechange=function(){
		cloader=document.createElement('div');
	    cloader.id='form_loader';
		cloader.style.height="100px";
		cinterior_contenido.appendChild(cloader);
		
		if(xmlhttpa.readyState==4){
			txtres=xmlhttpa.responseText;
			cinterior_contenido.removeChild(cloader);
			cinterior_contenido.innerHTML=txtres; 
		//	$("#contenido_formulario input[type=text],#contenido_formulario input[type=password]").click(function () {
		//	   $(this).val("");
		//	});  
		var texto_interior="";
			$("#contenido_formulario input[type=text],#contenido_formulario input[type=password]").focus(function(){
				 
				  if ( ($(this).attr("name")!="miembro_hogar_nombrehijo1")&&($(this).attr("name")!="miembro_hogar_nombrehijo2")&&($(this).attr("name")!="miembro_hogar_nombrehijo3") ){
				 texto_interior=$(this).val();	  
						
				  $(this).val("");
				  }
				  
			}).blur(function(){
			
			 if ( ($(this).attr("name")!="miembro_hogar_nombrehijo1")&&($(this).attr("name")!="miembro_hogar_nombrehijo2")&&($(this).attr("name")!="miembro_hogar_nombrehijo3") ){
				if($(this).val()==""){
				   $(this).val(texto_interior);
				   texto_interior="";	
				
				}
			 }
		   });
			if(muestrafinal && txtres && txtres.indexOf('centradito')==-1){
				muestrafinal.style.display='';
			}
		}
	}
	
	if(metodo){
		xmlhttpa.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlhttpa.send(valores);
	}
	else{
		xmlhttpa.setRequestHeader('Accept','message/x-jl-formresult');
		xmlhttpa.send(null);	
				
	}
	//if(!sincapas){
		
		cpmensaje.style.top='0px';
		//o.appendChild(cpmensaje);
		cpmensaje.style.left=parseInt((document.documentElement.clientWidth/2)-500.5)+'px';
		cpmensaje.style.top=document.documentElement.scrollTop+parseInt(document.documentElement.clientHeight/4)+'px';
		//cpmensaje.innerHTML="hola";
		document.body.appendChild(cposcura);
		document.body.appendChild(cpmensaje);
		cinterior.appendChild(cinterior_contenido);
		cpmensaje.appendChild(csuperior);
		cpmensaje.appendChild(cinterior);
		cpmensaje.appendChild(cinferior);
		
      
		
		
	//}
	return false;
}


function muestra_ajax2(o,url,metodo,sincapas,muestrafinal,capaPrioritaria){
	dc_track('1016317', 'dmpd001', 'dmpd004');
	cposcura=document.createElement('div');
	cposcura.id='negra';
	cpmensaje=document.createElement('div');
	cpmensaje.id='pop';
	//cposcura.onclick=destruye_ajax;
	
	csuperior=document.createElement('div');
	csuperior.id='form_superior_reg';
	
	cinterior=document.createElement('div');
	cinterior.id='form_interior_reg';
	
	cinterior_contenido=document.createElement('div');
	cinterior_contenido.id='form_interior_reg_contenido';
	
	cinferior=document.createElement('div');
	cinferior.id='form_inferior_reg';
	
	ccerrar=document.createElement('div');
	ccerrar.id='boton_cerrar';
	
	ctexto=document.createElement('div');
	ctexto.id='titulo_pop_reg';
	ctexto.innerHTML="Club Padres te da la bienvenida";
	clink=document.createElement('a');
	clink.onclick=destruye_ajax;
	clink.style.cursor = 'pointer';
	cimagen=document.createElement('div');
	cimagen.id="imagen_popup";
	
	clink.appendChild(cimagen);
	
	ccerrar.appendChild(clink);
	
	csuperior.appendChild(ctexto);
	csuperior.appendChild(ccerrar);
	
	/*csuperior.innerHTML="superior";
	cinterior.innerHTML="<p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p><p>centro</p>";
	cinferior.innerHTML="inferior";*/
	/*if(sincapas){
		if(capaPrioritaria){
			cpmensaje=capaPrioritaria;
		}
		else{
			cpmensaje=o;
		}
	}
	*/
	
	var xmlhttpa=_creaXML();
	pgsol=url;
	if(metodo){
		xmlhttpa.open(metodo,pgsol,true);
		valores='video='+document.getElementById("name_video").value;
		var i=0;
	/*	for(i=0;i<o.elements.length;i++){
			if(o.elements[i].name){
				valores+='&'+o.elements[i].name+'='+o.elements[i].value;
			}
		}*/
				
	}
	else{
		xmlhttpa.open("get",pgsol,true);
	}
	xmlhttpa.onreadystatechange=function(){
		cloader=document.createElement('div');
	    cloader.id='form_loader';
		cloader.style.height="100px";
		cinterior_contenido.appendChild(cloader);
		
		if(xmlhttpa.readyState==4){
			txtres=xmlhttpa.responseText;
			cinterior_contenido.removeChild(cloader);
			cinterior_contenido.innerHTML=txtres; 
		//	$("#contenido_formulario input[type=text],#contenido_formulario input[type=password]").click(function () {
		//	   $(this).val("");
		//	});  
		var texto_interior="";
			$("#contenido_formulario input[type=text],#contenido_formulario input[type=password]").focus(function(){
				 
				  if ( ($(this).attr("name")!="miembro_hogar_nombrehijo1")&&($(this).attr("name")!="miembro_hogar_nombrehijo2")&&($(this).attr("name")!="miembro_hogar_nombrehijo3") ){
				 texto_interior=$(this).val();	  
						
				  $(this).val("");
				  }
				  
			}).blur(function(){
			
			 if ( ($(this).attr("name")!="miembro_hogar_nombrehijo1")&&($(this).attr("name")!="miembro_hogar_nombrehijo2")&&($(this).attr("name")!="miembro_hogar_nombrehijo3") ){
				if($(this).val()==""){
				   $(this).val(texto_interior);
				   texto_interior="";	
				
				}
			 }
		   });
			if(muestrafinal && txtres && txtres.indexOf('centradito')==-1){
				muestrafinal.style.display='';
			}
		}
	}
	
	if(metodo){
		xmlhttpa.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlhttpa.send(valores);
	}
	else{
		xmlhttpa.setRequestHeader('Accept','message/x-jl-formresult');
		xmlhttpa.send(null);	
				
	}
	//if(!sincapas){
		
		cpmensaje.style.top='0px';
		//o.appendChild(cpmensaje);
		cpmensaje.style.left=parseInt((document.documentElement.clientWidth/2)-500.5)+'px';
		cpmensaje.style.top=document.documentElement.scrollTop+parseInt(document.documentElement.clientHeight/4)+'px';
		//cpmensaje.innerHTML="hola";
		document.body.appendChild(cposcura);
		document.body.appendChild(cpmensaje);
		cinterior.appendChild(cinterior_contenido);
		cpmensaje.appendChild(csuperior);
		cpmensaje.appendChild(cinterior);
		cpmensaje.appendChild(cinferior);
		
      
		
		
	//}
	return false;
}

function serialize(form) {
  if (!form || !form.elements) return;
 
  var serial = [], i, j, first;
  var add = function (name, value) {
    serial.push(encodeURIComponent(name) + '=' + encodeURIComponent(value));
  }
 
  var elems = form.elements;
  for (i = 0; i < elems.length; i += 1, first = false) {
    if (elems[i].name.length > 0) { /* no incluye los elementos sin nombre */
      switch (elems[i].type) {
        case 'select-one': first = true;
        case 'select-multiple':
          for (j = 0; j < elems[i].options.length; j += 1)
            if (elems[i].options[j].selected) {
              add(elems[i].name, elems[i].options[j].value);
              if (first) break; /* detiene la búsqueda para  select-one */
            }
          break;
        case 'checkbox':
        case 'radio': if (!elems[i].checked) break; /* sino continúa */
        default: add(elems[i].name, elems[i].value); break;
      }
    }
  }
 
  return serial.join('&');
}

function Inside_box(url)
{
	if(typeof(cinterior_contenido)=='undefined'){cinterior_contenido=document.getElementById("form_interior_contenido")}
	var txt=serialize(document.formulario_ajax);
	var xmlhttpa=_creaXML();
	pgsol=url;
	/*if(metodo){
		xmlhttpa.open(metodo,pgsol,true);
		valores='video='+document.getElementById("name_video").value;
		var i=0;
		for(i=0;i<o.elements.length;i++){
			if(o.elements[i].name){
				valores+='&'+o.elements[i].name+'='+o.elements[i].value;
			}
		}
				
	}
	else{*/
	xmlhttpa.open("post",pgsol,true);
	//}
	xmlhttpa.onreadystatechange=function(){
		cloader=document.createElement('div');
	    cloader.id='form_loader';
		cloader.style.height="100px";
		cinterior_contenido.appendChild(cloader);
		
		if(xmlhttpa.readyState==4){
			txtres=xmlhttpa.responseText;
			cinterior_contenido.removeChild(cloader);
			
			document.getElementById("form_interior_contenido").innerHTML=txtres; 
			//if(muestrafinal && txtres && txtres.indexOf('centradito')==-1){
			//	muestrafinal.style.display='';
			//}
		}
	}
	
	//if(metodo){
		xmlhttpa.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlhttpa.send(txt);
	//}
	//else{
	//	xmlhttpa.setRequestHeader('Accept','message/x-jl-formresult');
	//	xmlhttpa.send(null);	
				
	//}
}
function Inside_box3(url)
{
	var txt=serialize(document.formulario_ajax);
	var xmlhttpa=_creaXML();
	pgsol=url;
	/*if(metodo){
		xmlhttpa.open(metodo,pgsol,true);
		valores='video='+document.getElementById("name_video").value;
		var i=0;
		for(i=0;i<o.elements.length;i++){
			if(o.elements[i].name){
				valores+='&'+o.elements[i].name+'='+o.elements[i].value;
			}
		}
				
	}
	else{*/
	xmlhttpa.open("post",pgsol,true);
	//}
	xmlhttpa.onreadystatechange=function(){
		
		if(xmlhttpa.readyState==4){
			txtres=xmlhttpa.responseText;
					
			document.getElementById("form_interior_contenido").innerHTML=txtres; 
			//if(muestrafinal && txtres && txtres.indexOf('centradito')==-1){
			//	muestrafinal.style.display='';
			//}
		}
	}
	
	//if(metodo){
		xmlhttpa.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlhttpa.send(txt);
	//}
	//else{
	//	xmlhttpa.setRequestHeader('Accept','message/x-jl-formresult');
	//	xmlhttpa.send(null);	
				
	//}
}

function Inside_box2(url)
{
	
/*	var indice1 = document.formulario_ajax.day_fecha_nacimiento.selectedIndex 
    var valor1 = document.formulario_ajax.day_fecha_nacimiento.options[indice1].value 
	var indice2 = document.formulario_ajax.month_fecha_nacimiento.selectedIndex 
    var valor2 = document.formulario_ajax.month_fecha_nacimiento.options[indice2].value 
	var indice3 = document.formulario_ajax.year_fecha_nacimiento.selectedIndex 
    var valor3 = document.formulario_ajax.year_fecha_nacimiento.options[indice3].value 
	
	var total_meses=calcular_edad(valor1+ "/" + valor2 + "/" + valor3);
	if(total_meses <168)
	{
	
	
	}*/

	var txt=serialize(document.formulario_ajax);
	var xmlhttpa=_creaXML();
	pgsol=url;
	/*if(metodo){
		xmlhttpa.open(metodo,pgsol,true);
		valores='video='+document.getElementById("name_video").value;
		var i=0;
		for(i=0;i<o.elements.length;i++){
			if(o.elements[i].name){
				valores+='&'+o.elements[i].name+'='+o.elements[i].value;
			}
		}
				
	}
	else{*/
	
	xmlhttpa.open("post",pgsol,true);
	//}
	xmlhttpa.onreadystatechange=function(){
		cloader=document.createElement('div');
	    cloader.id='form_loader';
		cloader.style.height="100px";
		cinterior_contenido.appendChild(cloader);
		if(xmlhttpa.readyState==4){

			txtres=xmlhttpa.responseText;
			cinterior_contenido.removeChild(cloader);
			
			document.getElementById("form_interior_reg_contenido").innerHTML=txtres; 
			encscript=txtres.split('<script type="text/javascript" charset="utf-8">');
			jsstring=encscript[1].split('</script>')[0];
			eval(jsstring);
		}
	}
	
	//if(metodo){
		xmlhttpa.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		txt=txt.replace('tel%C3%A9fono%20fijo', "");
		txt=txt.replace('m%C3%B3vil', "");
		txt=txt.replace('teléfono fijo', "");
		txt=txt.replace('móvil', "");
		txt=txt.replace('=piso', "=");
		txt=txt.replace('=puerta', "=");
		txt=txt.replace('Más datos',"");
		
		xmlhttpa.send(txt);
	//		
	//}
	//else{
	//	xmlhttpa.setRequestHeader('Accept','message/x-jl-formresult');
	//	xmlhttpa.send(null);	
				
	//}
}
var cont=1;
function add(id)
{
if(document.getElementById("hijos").rows.length<3){

var table = document.getElementById("hijos");

var row = table.getElementsByTagName("TBODY")[0].cloneNode(true);

table.appendChild(row);
cont++;

for(i=0;i<row.getElementsByTagName("input").length;i++)
{
	row.getElementsByTagName("input")[0].setAttribute("name","miembro_hogar_nombrehijo"+id);
	row.getElementsByTagName("input")[1].setAttribute("name","miembro_hogar_sexohijo"+id);
	row.getElementsByTagName("input")[2].setAttribute("name","miembro_hogar_sexohijo"+id);
	
	row.getElementsByTagName("input")[0].setAttribute("value","");
	//row.getElementsByTagName("input")[1].name="miembro_hogar_sexohijo"+id;
	//row.getElementsByTagName('input')[1].value="-1";
	//row.getElementsByTagName("input")[2].name="miembro_hogar_sexohijo"+id;
	//row.getElementsByTagName('input')[2].value="-1";
	
	row.getElementsByTagName("input")[1].setAttribute("id","miembro_hogar_sexohijo"+id);
	row.getElementsByTagName("input")[2].setAttribute("id","miembro_hogar_sexohijo"+id);
	i=i+2;
}

for(i=0;i<row.getElementsByTagName("select").length;i++)
{
	row.getElementsByTagName("select")[0].setAttribute("name","day_miembro_hogar_fecha_nac_hijo_"+id);
	row.getElementsByTagName("select")[1].setAttribute("name","month_miembro_hogar_fecha_nac_hijo_"+id);
	row.getElementsByTagName("select")[2].setAttribute("name","year_miembro_hogar_fecha_nac_hijo_"+id);
	i=i+2;
}



 }else
 {
	// alert("no puedes añadir mas hijos");
 }

}

function add_new(id)
{
if(document.getElementById("hijos").rows.length<3){

var table = document.getElementById("hijos");

var row = table.getElementsByTagName("TBODY")[0].cloneNode(true);

table.appendChild(row);


for(i=0;i<row.getElementsByTagName("input").length;i++)
{
	row.getElementsByTagName("input")[0].setAttribute("name","miembro_hogar_nombrehijo"+id);
	row.getElementsByTagName("input")[1].setAttribute("name","miembro_hogar_sexohijo"+id);
	row.getElementsByTagName("input")[2].setAttribute("name","miembro_hogar_sexohijo"+id);
	
	//row.getElementsByTagName("input")[1].name="miembro_hogar_sexohijo"+id;
	//row.getElementsByTagName("input")[2].name="miembro_hogar_sexohijo"+id;
	
	row.getElementsByTagName("input")[0].setAttribute("value","");


	row.getElementsByTagName("input")[1].setAttribute("id","miembro_hogar_sexohijo"+id);
	row.getElementsByTagName("input")[2].setAttribute("id","miembro_hogar_sexohijo"+id);
	
	
	i=i+2;
}

for(i=0;i<row.getElementsByTagName("select").length;i++)
{
	fechaAc=new Date();
	row.getElementsByTagName("select")[0].setAttribute("name","day_miembro_hogar_fecha_nac_hijo_"+id);
	row.getElementsByTagName("select")[1].setAttribute("name","month_miembro_hogar_fecha_nac_hijo_"+id);
	row.getElementsByTagName("select")[2].setAttribute("name","year_miembro_hogar_fecha_nac_hijo_"+id);
	row.getElementsByTagName("select")[2].options.length=4;
	row.getElementsByTagName("select")[2].options[0].value=row.getElementsByTagName("select")[2].options[0].text='aaaa';
	row.getElementsByTagName("select")[2].options[0].value=row.getElementsByTagName("select")[2].options[0].selected='selected';
	row.getElementsByTagName("select")[2].options[1].value=row.getElementsByTagName("select")[2].options[1].text=fechaAc.getFullYear();
	row.getElementsByTagName("select")[2].options[2].value=row.getElementsByTagName("select")[2].options[2].text=fechaAc.getFullYear()-1;
	row.getElementsByTagName("select")[2].options[3].value=row.getElementsByTagName("select")[2].options[3].text=fechaAc.getFullYear()-2;
	
	i=i+2;
}



 }else
 {
	
 }

}
function borrar_hijos()
{

}
function cambiar_hijos(hijos)
{   
	if(hijos == 1)
	{
		$("#tr_hijos1").css("display", "block");
		$("#tr_hijos2").css("display", "none");
		$("#tr_hijos3").css("display", "none");
	}
	else if(hijos == 2)
	{
		$("#tr_hijos1").css("display", "block");
		$("#tr_hijos2").css("display", "block");
		$("#tr_hijos3").css("display", "none");		
	}
	else
	{
		$("#tr_hijos1").css("display", "block");
		$("#tr_hijos2").css("display", "block");
		$("#tr_hijos3").css("display", "block");		
	}
}

function cambiar_hijos_new()
{   
  
	var table = document.getElementById("hijos");
		

	if(document.getElementById("hijos").rows.length==2){

	
	table.removeChild(table.getElementsByTagName("TBODY")[1]);

	}
	if(document.getElementById("hijos").rows.length==3){

	table.removeChild(table.getElementsByTagName("TBODY")[2]);
	table.removeChild(table.getElementsByTagName("TBODY")[1]);
	
	}

	/*if((document.getElementById("Hijos_en_hogar").selectedIndex==1)&&(document.getElementById("hijos").rows.length==1))
	{
		add_new(2)
	}
	if((document.getElementById("Hijos_en_hogar").selectedIndex==2)&&(document.getElementById("hijos").rows.length==1))
	{
		add_new(2)
		add_new(3)
	}
	if((document.getElementById("Hijos_en_hogar").selectedIndex==2)&&(document.getElementById("hijos").rows.length==2))
	{
		add_new(3)
				
	}*/
	if(document.getElementById("Hijos_en_hogar").selectedIndex==1)
	{
		add_new(2);
	}
	if(document.getElementById("Hijos_en_hogar").selectedIndex==2)
	{
		add_new(2);
		add_new(3);
	}
	
	
	
	
}

function menu(obj)
{
	obj.style.marginTop="0px";
	obj_div=document.getElementById(div_asociado);
	obj_div.style.visibility="visible";
	old_obj=obj_div;
	old_a=obj;
}

function submenu(obj)
{
	if(typeof(old_obj)!="undefined")
	{
		old_obj.style.visibility="hidden";
		old_a.style.marginTop="";
	}
	obj.style.marginTop="0px";
	div_asociado=obj.className.replace("a","submenu");
	
	obj_div=document.getElementById(div_asociado);

	obj_div.style.visibility="visible";
	old_obj=obj_div;
	old_a=obj;
}

function submenu2(obj)
{

	if(typeof(ultimo_menu)!="undefined")
	{
		if(typeof(old_obj)!="undefined")
		{
			old_obj.style.visibility="hidden";
			old_a.style.marginTop="";
		}
	
		obj.style.marginTop="0px";
		div_asociado=obj.className.replace("a","submenu");
		obj_div=document.getElementById(div_asociado);
		obj_div.style.visibility="visible";
		old_obj=obj_div;
		old_a=obj;
	}
}

function submenu3(obj)
{
	//sessvars.username = '';
	div_asociado=obj;
	div_asociado2 = div_asociado.replace('submenu', 'a');
	var div_ultimo = document.getElementById(ultimo_menu.className);
	if(div_asociado2 != div_ultimo.className)
		div_ultimo.style.marginTop = '';
	
	obj_div=document.getElementById(div_asociado2);
	obj_div.style.visibility="visible";
	obj_div.style.marginTop="0px";
//	old_obj=obj_div;
//	old_a=obj;
}


function submenu_gran(obj)
{
	if(typeof(old_obj)!="undefined")
	{
		old_obj.style.visibility="hidden";
		old_a.style.marginTop="10px";
	}
	obj.style.marginTop="0px";
	div_asociado=obj.className.replace("a","submenu");
	obj_div=document.getElementById(div_asociado);
	obj_div.style.visibility="visible";
	old_obj=obj_div;
	old_a=obj;
}


function popupPDF(pdf) {
var htm = "<html><head><title>popupPDF</title>";
htm += "</head><body>";
htm += "<iframe width='100%' height='100%' src='" + pdf +"'></iframe>";
htm += "</body></html>";
var win = window.open("","popupPDF","");
win.document.write(htm);
win.close;
}

function change_image(url)
{
	document.getElementById("imagen_grande").src=url;
}

function rotar_derecha()
{
	
	var tamany=document.getElementById("carrusel_ul").style.width;
	tamany=parseInt(tamany.replace("px",""));
	var anterior=document.getElementById("carrusel_ul").style.left;
	anterior=parseInt(anterior.replace("px",""));
	
	if(tamany+anterior > 680){
	anterior=anterior-90;
	document.getElementById("carrusel_ul").style.left=anterior+ "px";
	}
}

function rotar_izquierda()
{ 
	var anterior=document.getElementById("carrusel_ul").style.left;
	anterior=parseInt(anterior.replace("px",""));
	if(anterior<0){
	anterior=anterior+90;
	document.getElementById("carrusel_ul").style.left=anterior+ "px";
	}
}


function change_year(year,number){
	document.getElementById("titulo_any").innerHTML=year;
	document.getElementById("carrusel_ul").style.left="0px";
	var valores="";
	for(i=0;i<imagenes[number].length;i++){
			valores+="<li><img id=\"imagen_mini\" onclick=\"javascript:change_image('"+imagenes[number][i]+"')\" src=\""+imagenes[number][i]+"\"/></li>";
		
	}
	document.getElementById("carrusel_ul").innerHTML=valores;
	document.getElementById("carrusel_ul").style.width=imagenes[number].length*100+"px";
}

function borrar(div)
{
	document.getElementById(div).value="";
}

function modificar_edad(url,indice,flag)
{
	var edad=1;
	var flag_aux=0;
	flag_aux=flag;
	if(indice==""){
		var indice=document.getElementById("numero_de_hijos").selectedIndex;
		var nombre=document.getElementById("numero_de_hijos").options[0].text ;
		//var edad=0;
		
	}
	else
	{
		var nombre=document.getElementById("numero_de_hijos").options[indice].text ;
	
	}
	if((age_kids[indice]>6) && (age_kids[indice]<=9))
	{
		edad=1;
		document.getElementById("dental").style.display="block";
		
	}
	if((age_kids[indice]>9) && (age_kids[indice]<=12))
	{
		edad=2;
		document.getElementById("dental").style.display="block";
		
	}
	if((age_kids[indice]>12) && (age_kids[indice]<=24))
	{
		edad=3;
		document.getElementById("dental").style.display="block";
		
	}
	if(age_kids[indice]>24)
	{
		edad=3;
		if (flag_aux!=1){
		mensage_24(url,mensaje_edad[indice][4]);
		flag_aux=1;
		}
		document.getElementById("dental").style.display="block";
	}

	document.getElementById("mensaje_logeado").innerHTML= mensaje_edad[indice][edad];
 	 var s_img=document.createElement('img');
 	  s_img.setAttribute("src",url+"images/edades.php?e="+edad+"&n="+nombre+"&i="+indice+"&m="+age_kids[indice]+"&f="+flag_aux);
	  devolver_path(url);
	 
}

function modificar_edad_2(url)
{
	var indice=document.getElementById("numero_de_hijos").selectedIndex;
	var nombre=document.getElementById("numero_de_hijos").options[indice].text ;
	var edad=0;
	var flag_aux=0;
	if(age_kids[indice]<=6)
	{
		edad=0;
		flag_aux=0;
		document.getElementById("dental").style.display="none";
		
	}
	if((age_kids[indice]>6) && (age_kids[indice]<=9))
	{
		edad=1;
		flag_aux=0;
		document.getElementById("dental").style.display="block";
		
	}
	if((age_kids[indice]>9) && (age_kids[indice]<=12))
	{
		edad=2;
		flag_aux=0;
		document.getElementById("dental").style.display="block";
		
	}
	if((age_kids[indice]>12) && (age_kids[indice]<=24))
	{
		edad=3;
		flag_aux=0;
		document.getElementById("dental").style.display="block";
	}
	if(age_kids[indice]>24)
	{
		edad=3;
		mensage_24(url,mensaje_edad[indice][4]);
		flag_aux=1;
		document.getElementById("dental").style.display="block";
		
	}
	document.getElementById("mensaje_logeado").innerHTML= mensaje_edad[indice][edad];
 	 var s_img=document.createElement('img');
 	 s_img.setAttribute("src",url+"images/edades.php?e="+edad+"&n="+nombre+"&i="+indice+"&m="+age_kids[indice]+"&f="+flag_aux);
	 devolver_path(url);
	 
}


/*
function cabeceras(){
	if(typeof(section)!='undefined'){
		contenedora=document.createElement("div");
		contenedora.className="cabeceras";
		contenedora.id="cabeceras";
		contenedora.onmouseover = function () {comprobar();};
		var i=0;
		switch (section){
			case 'miprimerdanone':
			for(i=0;i<2;i++){
				hija=document.createElement("div");
				hija.className="icra"+i;
				contenedora.appendChild(hija);
			}
			break;
			case 'promociones':
			for(i=2;i<4;i++){
				hija=document.createElement("div");
				hija.className="icra"+i;
				contenedora.appendChild(hija);
			}
			break;
			case 'paramibebe':
			for(i=4;i<6;i++){
				hija=document.createElement("div");
				hija.className="icra"+i;
				contenedora.appendChild(hija);
			}
			break;
			case 'parami':
			for(i=6;i<8;i++){
				hija=document.createElement("div");
				hija.className="icra"+i;
				contenedora.appendChild(hija);
			}
			break;
			case 'foro':
			for(i=8;i<10;i++){
				hija=document.createElement("div");
				hija.className="icra"+i;
				contenedora.appendChild(hija);
			}
			break;
			default:
			for(i=0;i<10;i++){
				hija=document.createElement("div");
				hija.className="icra"+i;
				contenedora.appendChild(hija);
			}
			break;
		}
		document.getElementById("header").parentNode.insertBefore(contenedora,document.getElementById("header"));
		if(section=="home"){
			document.getElementById("cabeceras").getElementsByTagName("div")[0].style.opacity=1;
			document.getElementById("cabeceras").getElementsByTagName("div")[0].style.filter='alpha(opacity=100)';
			setTimeout("fade()",5000);
		}
		else{
			muestraAleatoria();
		}
	}
}


function muestraAleatoria(){
	var j=Math.round(Math.random());
	document.getElementById("cabeceras").getElementsByTagName("div")[j].style.opacity=1;
	document.getElementById("cabeceras").getElementsByTagName("div")[j].style.filter='alpha(opacity=100)';
}
opac=100;
ncap=0;
function fade(){
	document.getElementById("cabeceras").getElementsByTagName("div")[ncap].style.opacity=(opac/100);
	document.getElementById("cabeceras").getElementsByTagName("div")[ncap].style.filter='alpha(opacity='+opac+')';
	if(opac>0){
		opac=opac-1;
		timeview=setTimeout("fade()",10);
	}
	else{
		ncap++;
		if(ncap>9){ncap=0}
		clearTimeout(timeview);
		fadeout();
	}
}

function fadeout(){
	document.getElementById("cabeceras").getElementsByTagName("div")[ncap].style.opacity=(opac/100);
	document.getElementById("cabeceras").getElementsByTagName("div")[ncap].style.filter='alpha(opacity='+opac+')';
	if(opac<100){
		opac=opac+1;
		timeview2=setTimeout("fadeout()",10);
	}
	else{
		clearTimeout(timeview2);
		setTimeout("fade()",5000);
	}
}
*/

function calcular_edad(data) 
{ 


   //$fecha_actual = $fecha_control; 
    
  // if(!strlen($fecha_actual)) 
   //{ 
    //  fecha_actual = date('d/m/Y'); 
	  
	 var fecha_act = new Date();
	 fecha_actual=fecha_act.getDate() + "/" + (fecha_act.getMonth() +1) + "/" + fecha_act.getFullYear();

   //} 
 	if (data==""){data=fecha_actual;}
   // separamos en partes las fechas  
   array_nacimiento = data.split('/');  
   array_actual = fecha_actual.split('/');  
 
   anos =  array_actual[2] - array_nacimiento[2]; // calculamos años  
   meses = array_actual[1] - array_nacimiento[1]; // calculamos meses  
   dias =  array_actual[0] - array_nacimiento[0]; // calculamos días  
 

   //ajuste de posible negativo en $días  
   if (dias < 0)  
   {  
      meses=meses-1;  
 
      alert(array_actual[1]);//ahora hay que sumar a $dias los dias que tiene el mes anterior de la fecha actual  
      switch (array_actual[1]) {  
         case "1":  
            dias_mes_anterior=31; 
            break;  
         case "2":      
            dias_mes_anterior=31; 
            break;  
         case "3":   
            if (bisiesto(array_actual[2]))  
            {  
               dias_mes_anterior=29; 
               break;  
            }  
            else  
            {  
               dias_mes_anterior=28; 
               break;  
            }  
         case "4": 
            dias_mes_anterior=31; 
            break;  
         case "5": 
            dias_mes_anterior=30; 
            break;  
         case "6": 
            dias_mes_anterior=31; 
            break;  
         case "7": 
            dias_mes_anterior=30; 
            break;  
         case "8": 
            dias_mes_anterior=31; 
            break;  
         case "9": 
            dias_mes_anterior=31; 
            break;  
         case "10": 
            dias_mes_anterior=30; 
            break;  
         case "11": 
            dias_mes_anterior=31; 
            break;  
         case "12": 
            dias_mes_anterior=30; 
            break;  
      }  
 
      dias=dias + dias_mes_anterior; 
 
      if (dias < 0) 
      { 
         meses=meses-1; 
         if(dias == -1) 
         { 
            dias = 30; 
         } 
         if(dias == -2) 
         { 
            dias = 29; 
         } 
      } 
   } 
 
   //ajuste de posible negativo en $meses  
   if (meses < 0)  
   {  
      anos=anos-1;  
      meses=meses + 12;  
   } 
 
   tiempo[0] = anos; 
   tiempo[1] = meses; 
   tiempo[2] = dias; 
  total=(anos*12)+meses;
   //return $tiempo; 
  // if(total>24){total=24;}
   return total; 
   
} 
 
function bisiesto(anio_actual){  
   var bisiesto=false;  
   //probamos si el mes de febrero del año actual tiene 29 días  
     if (checkdate(2,29,anio_actual))  
     {  
      bisiesto=true;  
   }  
   return bisiesto;  
} 

function checkDate(month, day, year) {
	var monthLength = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
	if (!day || !month || !year) {
	return false;
	}
	// check for bisestile year
	if (year/4 == parseInt(year/4)) {
	monthLength[1] = 29;
	}
	if (month < 1 || month > 12) {
	return false;
	}
	if (day > monthLength[month-1]) {
	return false;
	}
	return true;
}

function scroll_up()
{
   var altura=$("#list_nombres").css("top");
   altu= altura.replace("px","");
   altu= altu-(-23);

   if (altu >0){
   }else{
   $("#list_nombres").css("top",altu+"px");
   }
   timer=setTimeout("scroll_up()", 400);
}

function scroll_down()
{
   var altura=$("#list_nombres").css("top");
   var maximo=($('#list_nombres').css("height")).replace("px","");
   altu= altura.replace("px","");
   altu= altu-23;
   
	if (altu < -maximo){
   }else{
   $("#list_nombres").css("top",altu+"px");
   }
   timer=setTimeout("scroll_down()", 400);
}

function borrar_activacion()
{
	clearTimeout(timer);
}


if(window.addEventListener){
	window.addEventListener("load",function(){
		var myDate=new Date();
		myDate.setFullYear(2011,0,7);
		var today = new Date();
		if (myDate>today)
		{
			if(typeof(section)!='undefined')
			{
				//var header = document.getElementById('header');
				//header.className = "fondo_cabecera_navidad";
				
				//contenedora=document.createElement("div");
				//contenedora.className="cabeceras";
				//contenedora.id="cabeceras";
				//contenedora.onmouseover = function () {comprobar();};	
				//hija=document.createElement("div");
				//hija.className="icraNavidad";
				//contenedora.appendChild(hija);
					
				//document.getElementById("header").parentNode.insertBefore(contenedora,document.getElementById("header"));
				//document.getElementById("cabeceras").getElementsByTagName("div")[0].style.opacity=1;
				//document.getElementById("cabeceras").getElementsByTagName("div")[0].style.filter='alpha(opacity=100)';
			}
		}
		else
		{
			//cabeceras();
		}


		if($("#ajax-external").length > 0){
		$("#ajax-external").load( $("#ajax-external").attr("rel") ,{ajax:true});	
		}
		if($(".enlace_ajax").length > 0){
		$(".enlace_ajax").click(function(){Inside_box(this.href);return false;});
		}
		if($("#lineadesarrollo").length > 0){
			flineadesarrollo();
		}
	},false)
}
else if(window.attachEvent){
	window.attachEvent("onload",function(){

		var myDate=new Date();
		myDate.setFullYear(2011,0,7);
		var today = new Date();
		if (myDate>today)
		{
			if(typeof(section)!='undefined')
			{
				//var header = document.getElementById('header');
				//header.className = "fondo_cabecera_navidad";
				
				//contenedora=document.createElement("div");
				//contenedora.className="cabeceras";
				//contenedora.id="cabeceras";
				//contenedora.onmouseover = function () {comprobar();};	
				//hija=document.createElement("div");
				//hija.className="icraNavidad";
				//contenedora.appendChild(hija);
					
				//document.getElementById("header").parentNode.insertBefore(contenedora,document.getElementById("header"));
				//document.getElementById("cabeceras").getElementsByTagName("div")[0].style.opacity=1;
				//document.getElementById("cabeceras").getElementsByTagName("div")[0].style.filter='alpha(opacity=100)';
			}
		}
		else
		{
			//cabeceras();
		}

		if($("#ajax-external").length > 0){
		$("#ajax-external").load( $("#ajax-external").attr("rel") ,{ajax:true});	
		}
		if($(".enlace_ajax").length > 0){
		$(".enlace_ajax").click(function(){Inside_box(this.href);return false;});
		}
		if($("#lineadesarrollo").length > 0){
			flineadesarrollo();
		}
	});
}

function flineadesarrollo(){
	//$("#lineadesarrollo li").click(function(){muestraldes(this)});
	
	$("#lineadesarrollo li").bind("click", function(){muestraldes(this)});
}

function muestraldes(o){
	if(typeof(old_o)!='undefined'){
		old_o.removeAttribute("id");
		old_div.style.display="none";
	}
	o.setAttribute("id","marcado");
	clase=o.className;
	document.getElementById("asociado_"+clase).style.display="block";
	old_o=o;
	old_div=document.getElementById("asociado_"+clase);
}

function mensage_24(url,data){
	cposcura=document.createElement('div');
	cposcura.id='negra';
	cpmensaje=document.createElement('div');
	cpmensaje.id='pop';
	//cposcura.onclick=destruye_ajax;
	
	csuperior=document.createElement('div');
	csuperior.id='form_superior';
	
	cinterior=document.createElement('div');
	cinterior.id='form_interior';
	
	cinterior_contenido=document.createElement('div');
	cinterior_contenido.id='form_interior_contenido';
	
	cinferior=document.createElement('div');
	cinferior.id='form_inferior';
	
	ccerrar=document.createElement('div');
	ccerrar.id='boton_cerrar';
	
	ctexto=document.createElement('div');
	ctexto.id='titulo_pop';
	ctexto.innerHTML="Mayor de 24 Meses";
	clink=document.createElement('a');
	clink.onclick=destruye_ajax;
	clink.style.cursor = 'pointer';
	cimagen=document.createElement('div');
	cimagen.id="imagen_popup";
	
	clink.appendChild(cimagen);
	
	ccerrar.appendChild(clink);
	
	csuperior.appendChild(ctexto);
	csuperior.appendChild(ccerrar);
	
		
	cpmensaje.style.top='0px';
	//o.appendChild(cpmensaje);
	cpmensaje.style.left=parseInt((document.documentElement.clientWidth/2)-300.5)+'px';
	cpmensaje.style.top=document.documentElement.scrollTop+parseInt(document.documentElement.clientHeight/4)+'px';
	//cpmensaje.innerHTML=data;
	document.body.appendChild(cposcura);
	document.body.appendChild(cpmensaje);
	//cinterior_contenido.appendChild(cpmensaje);
	cinterior.appendChild(cinterior_contenido);
	cpmensaje.appendChild(csuperior);
	cpmensaje.appendChild(cinterior);
	cpmensaje.appendChild(cinferior);
	document.getElementById("form_interior_contenido").innerHTML=" <div id='mensage_info_correcto' style='margin-left:30px; width:500px;'><img src='"+url+"images/alerta.jpg' style='float:left;margin-right:14px;padding-bottom:30px;' /><div>"+data+"</div></div><img src='"+url+"images/aceptar.jpg' onclick='destruye_ajax();' style='cursor:pointer;margin-left:400px;' />"; 
		
		
		
	//}
	return false;
}
function subir_imagen(url,data){
	cposcura=document.createElement('div');
	cposcura.id='negra';
	cpmensaje=document.createElement('div');
	cpmensaje.id='pop';
	//cposcura.onclick=destruye_ajax;
	
	csuperior=document.createElement('div');
	csuperior.id='form_superior';
	
	cinterior=document.createElement('div');
	cinterior.id='form_interior';
	
	cinterior_contenido=document.createElement('div');
	cinterior_contenido.id='form_interior_contenido';
	
	cinferior=document.createElement('div');
	cinferior.id='form_inferior';
	
	ccerrar=document.createElement('div');
	ccerrar.id='boton_cerrar';
	
	ctexto=document.createElement('div');
	ctexto.id='titulo_pop';
	ctexto.innerHTML="Pon aquí la imagen de tu hijo";
	clink=document.createElement('a');
	clink.onclick=destruye_ajax;
	clink.style.cursor = 'pointer';
	cimagen=document.createElement('div');
	cimagen.id="imagen_popup";
	
	clink.appendChild(cimagen);
	
	ccerrar.appendChild(clink);
	
	csuperior.appendChild(ctexto);
	csuperior.appendChild(ccerrar);
	
		
	cpmensaje.style.top='0px';
	//o.appendChild(cpmensaje);
	cpmensaje.style.left=parseInt((document.documentElement.clientWidth/2)-300.5)+'px';
	cpmensaje.style.top=document.documentElement.scrollTop+parseInt(document.documentElement.clientHeight/4)+'px';
	//cpmensaje.innerHTML=data;
	document.body.appendChild(cposcura);
	document.body.appendChild(cpmensaje);
	//cinterior_contenido.appendChild(cpmensaje);
	cinterior.appendChild(cinterior_contenido);
	cpmensaje.appendChild(csuperior);
	cpmensaje.appendChild(cinterior);
	cpmensaje.appendChild(cinferior);

	document.getElementById("form_interior_contenido").innerHTML='<form class="add_image" name="imagen" action="'+url+'index.php/cuenta/upload/es" method="POST" enctype="multipart/form-data"><div style="margin-bottom:15px;">No se permiten imagenes de mas de 200 KB</div><label for="file">Foto del hijo: </label><div class="ex_anterior"><input type="text" id="encondido"/><img src="'+url+'images/examinar_imagen.jpg" style="vertical-align: bottom;" /></div><div class="capa_oculta"><input type="file" name="file" onchange="cambio_value()" id="file" class="file" /></div><img src="'+url+'images/guardar_imagen.jpg" style="cursor:pointer;display:block;margin-left:425px;margin-top:10px;" onclick="document.imagen.submit();"/></form>';
		
		
	//}
	return false;
}

function cambio_value()
{
document.getElementById("encondido").value=document.getElementById("file").value;
}


function c_letra(url,letra)
{ 
	
	if(letra_old!=null)
	{
	document.getElementById("let_"+letra_old).removeAttribute("style");
	}
	if(document.getElementById("MUJER").checked){
		sexo_s=document.getElementById("MUJER").value;
		}
	if(document.getElementById("HOMBRE").checked){
		sexo_s=document.getElementById("HOMBRE").value;
		}
	document.getElementById("Bnombre").value="";	
	newImage = "url("+url+"images/fondo_letra_color.jpg)";
     document.getElementById("let_"+letra).style.backgroundImage = newImage;
	// hacer llamada ajax
	   $.ajax({
			type: "POST",
			url: url+"index.php/paramibebe/nombres_letra",
			data: "letra="+letra+"&sexo="+sexo_s,
			beforeSend: function(){
            document.getElementById("contenido_nombres").innerHTML='<p class="loader"></p>';
			
        	},
			success: function(datos){
		   datos=allTrim(datos);

				if(datos.length>20){
					document.getElementById("titulo_nombres").style.display="block";
		  			 document.getElementById("contenido_nombres").innerHTML=datos;
					
				}else{
					document.getElementById("titulo_nombres").style.display="none";
				 document.getElementById("contenido_nombres").innerHTML="<p class='no_resultados'>No se encuentra ningún resultado<p>";
				}
		  }
	});
	letra_old=letra;   
}

function select_sexo(url,sexo_s)
{ 
	
	if(letra_old!=null)
	{
		if(document.getElementById("Bnombre").value==""){
	   $.ajax({
			type: "POST",
			url: url+"index.php/paramibebe/nombres_letra",
			data: "letra="+letra_old+"&sexo="+sexo_s,
			beforeSend: function(){
            document.getElementById("contenido_nombres").innerHTML='<p class="loader"></p>';
			
        	},
			success: function(datos){
		   datos=allTrim(datos);

				if(datos.length>20){
					document.getElementById("titulo_nombres").style.display="block";
		  			 document.getElementById("contenido_nombres").innerHTML=datos;
					
				}else{
					document.getElementById("titulo_nombres").style.display="none";
				 document.getElementById("contenido_nombres").innerHTML="<p class='no_resultados'>No se encuentra ningún resultado<p>";
				}
		  }
	});
		}
	}
	
}



function delay(milisegundos)
{
for(i=0;i<=milisegundos;i++)
{
setTimeout('return 0',1);

}
}

function dc_track(s, t, c)
{

		var axel = Math.random() + "";

		var a = axel * 10000000000000;

		var img = new Image();

	   

		img.onload = function () {};

		img.src = "http://ad-emea.doubleclick.net/activity;src=" + s + ";type=" + t + ";cat=" + c + ";ord=1;num="+ a + "?";
		
	 
      return true;

}

function dc_track_delay(s, t, c)
{

		var axel = Math.random() + "";

		var a = axel * 10000000000000;

		var img = new Image();

	   

		img.onload = function () {};

		img.src = "http://ad-emea.doubleclick.net/activity;src=" + s + ";type=" + t + ";cat=" + c + ";ord=1;num="+ a + "?";
		delay(4000);
	 
      return true;

}

//$("#asdasd").submit(function(e){
//							 e.preventDefault();
//							 delay(2000);
//							 });
							 
function find_name(url)
{ 
	 
	/*for (i=0;i<document.sexo_nombres.sexo.length;i++){ 
      	 if (document.sexo_nombres.sexo[i].checked) 
			 sexo=document.sexo_nombres.sexo[i].value;
   	} */
	if(document.getElementById("MUJER").checked){
		sexo_s=document.getElementById("MUJER").value;
		}
	if(document.getElementById("HOMBRE").checked){
		sexo_s=document.getElementById("HOMBRE").value;
		}
		
	texto_buscar=document.getElementById("Bnombre").value;
	if(texto_buscar!=""){
   $.ajax({
			type: "POST",
			url: url+"index.php/paramibebe/buscar_nombres",
			data: "nombre="+texto_buscar+"&sexo="+sexo_s,
			beforeSend: function(){
            document.getElementById("contenido_nombres").innerHTML='<p class="loader"></p>';
			
        	},
			success: function(datos){
				datos=allTrim(datos);
				if(datos.length>20){
					document.getElementById("titulo_nombres").style.display="block";
		  			 document.getElementById("contenido_nombres").innerHTML=datos;
					
				}else{
					document.getElementById("titulo_nombres").style.display="none";
				 document.getElementById("contenido_nombres").innerHTML="<p class='no_resultados'>No se encuentra ningún resultado<p>";
				}
		  }
	});
	}
}

function setcookie(nombre, valor, duracionMin, ruta)
{
    var cadena = nombre + "=" + encodeURIComponent(valor);
    if (duracionMin != 0)
    {
        var fecha = new Date();
        var duracionMili = duracionMin * 60*1000*60*24*365;
        fecha.setTime(fecha.getTime() + duracionMili);
        cadena += "; expires=" + fecha.toGMTString();
    }
    if (ruta != "")
    {
        cadena += "; path=" + ruta;
    }
    document.cookie = cadena;
}
function getcookies()
{
    var obj = new Object();
    var lineas = document.cookie.split(";");
    for (var i=0; i<lineas.length; i++)
    {
        var partes = lineas[i].split("=");
        var nombre = partes[0];
        var valor = decodeURIComponent(partes[1]).replace("'", "\\'");
	if (nombre.length > 0)
		eval("obj." + nombre + "='" + valor + "'");
    }
    return obj;
}
function add_name(base,valor,logeado)
{ 
	var name="";
	if (document.all) { // IE; 
		name=document.getElementById("name"+valor).innerText; 
	} 
	else{ 
		name=document.getElementById("name"+valor).textContent;
	} 
	var myTable = document.getElementById('favoritos');
	var existe=false;
	for(i=0;i<myTable.rows.length;i++)
	{
		var rows = myTable.getElementsByTagName("tr");   
		for(j = 1; j < rows.length; j++){           
	 		var colums = rows[j].getElementsByTagName("td"); 
			 //if(colums.length)
			 //if(colums[0].childNodes.length)alert(colums[0].childNodes[0].nodeValue);
			// alert(colums[0].childNodes[0].nodeValue)
			    if(colums[0].childNodes[0].nodeValue==name)
				{
					existe=true;
				}	  
			 
		 } 
	}
	numero_cols=rows.length;
	if(existe==false){
		var oRow = myTable.insertRow(-1);
		var oCell = oRow.insertCell(-1);
		oCell.innerHTML = name;
		var oCell1 = oRow.insertCell(-1);
		oCell1.className="right";
		var imagen=document.createElement('img');
		imagen.src=base+"images/boton_menos.jpg"
		imagen.id=name;
		oCell1.appendChild(imagen);
		var onC='borrar_fila("'+base+'","'+name+'","'+logeado+'")';
		document.getElementById(name).onclick=new Function(onC); 
		oCell1.appendChild(imagen);
		
		if (logeado=="TRUE"){
			guardar_names(base);
		}else
		{
			guardar_cookie();
		}
		
		
	
	}
		
}
function guardar_cookie()
{
	nombres="";
	var myTable = document.getElementById('favoritos');
	var rows = myTable.getElementsByTagName("tr");   
		for(j = 1; j < rows.length; j++){  
		
	 		var colums = rows[j].getElementsByTagName("td"); 
			nombres+=colums[0].childNodes[0].nodeValue+"#";
		 } 
	var distancia= nombres.length;
	setcookie("nombres", nombres.substring(0, distancia-1), 2, "/");
	
}

function borrar_fila(url,name,logeado)
{
 
  var myTable = document.getElementById('favoritos');
  
  for(i=0;i<myTable.rows.length;i++)
	{
		var rows = myTable.getElementsByTagName("tr");   
		for(j = 1; j < rows.length; j++){           
	 		var colums = rows[j].getElementsByTagName("td"); 
			    if(colums[0].childNodes[0].nodeValue==name)
				{
					
					 myTable.deleteRow(j);
				}	  
			 
		 } 
	}
	if(logeado=="TRUE"){
		 guardar_names(url)
	}else
	{
		guardar_cookie();
	}
  
}
function resaltar(valor)
{
	document.getElementById(valor).style.backgroundColor="white";
}
function no_resaltar(valor)
{
	document.getElementById(valor).style.backgroundColor="#fff2d3";
}
function get_cookies_array() {

    var cookies = { };

    if (document.cookie && document.cookie != '') {
        var split = document.cookie.split(';');
        for (var i = 0; i < split.length; i++) {
            var name_value = split[i].split("=");
            name_value[0] = name_value[0].replace(/^ /, '');
            cookies[decodeURIComponent(name_value[0])] = decodeURIComponent(name_value[1]);
        }
    }

    return cookies;
   
}

function guardar_names(url)
{ 
	nombres="";
	var myTable = document.getElementById('favoritos');
	var rows = myTable.getElementsByTagName("tr");   
		for(j = 1; j < rows.length; j++){  
		
	 		var colums = rows[j].getElementsByTagName("td"); 
			nombres+=colums[0].childNodes[0].nodeValue+"#";
		 } 
	var distancia= nombres.length;
	nombres= nombres.substring(0, distancia-1);
	
   $.ajax({
			type: "POST",
			url: url+"index.php/paramibebe/add_names_literalCid",
			data: "names="+nombres
		});
}

 function lTrim(sStr){
     while (sStr.charAt(0) == " ")
      sStr = sStr.substr(1, sStr.length - 1);
     return sStr;
    }
 
    function rTrim(sStr){
     while (sStr.charAt(sStr.length - 1) == " ")
      sStr = sStr.substr(0, sStr.length - 1);
     return sStr;
    }
 
    function allTrim(sStr){
     return rTrim(lTrim(sStr));
    }

function send_message()
{
	nombres="";
	var myTable = document.getElementById('favoritos');
	var rows = myTable.getElementsByTagName("tr");   
		for(j = 1; j < rows.length; j++){  
		
	 		var colums = rows[j].getElementsByTagName("td"); 
			nombres+=colums[0].childNodes[0].nodeValue+"#";
		 } 
	var distancia= nombres.length;
	nombres= nombres.substring(0, distancia-1);
	
	nombres=nombres.replace(new RegExp("#","gi"),"\n");
	nombres="Estos son los nombres que he elegido para mi bebé pero quiero que me des tu opinión. ¿A ti cuál te gusta más?\n\n"+nombres;
	nombres=escape(nombres);

	var mailto_link = 'mailto:?subject=Listado de nombres elegidos&body='+nombres;
	win = window.open(mailto_link,'emailWindow'); 
	if (win && win.open &&!win.closed) win.close(); 

}
function sel_alt(url){
	if(document.getElementById('curva_sel').selectedIndex=="1"){
		document.getElementById('img_curvas_peso').className="img_curvas_altura";
		document.getElementById('alt_pes').innerHTML="Altura";	
		document.getElementById('n_unidad').innerHTML="Cm";
		
		modidato=document.getElementById('modidatos').href;
		longitud=modidato.length-1;
		modidato1=modidato.substr(0,longitud);
		document.getElementById('modidatos').href=modidato1+"a";
		
		dibujar(url,"altura");
		devolver_pesos(url,'A');
		
	}else{
		document.getElementById('img_curvas_peso').className="img_curvas_peso";
		document.getElementById('alt_pes').innerHTML="Peso";	
		document.getElementById('n_unidad').innerHTML="Kg";	

		modidato=document.getElementById('modidatos').href;
		longitud=modidato.length-1;
		
		modidato1=modidato.substr(0,longitud);
		
		document.getElementById('modidatos').href=modidato1+"p";

		dibujar(url,"peso");
		devolver_pesos(url,'P');
		
	}

}

function introducir_datos(url)
{ 
 	var contenido="";
	var error="";
	enviar=0;
	curva="";
	document.getElementById('error').style.display="none";
	if(	document.getElementById('curva_sel').selectedIndex=="1"){contenido+="medida=A"+document.getElementById('medida').value;
	curva="altura";
	}
	if(	document.getElementById('curva_sel').selectedIndex=="0"){contenido+="medida=P"+document.getElementById('medida').value;
	curva="peso";
	}
	
	contenido+="&";
		
	contenido+="fecha="+document.fecha.year_data_hijo.options[document.fecha.year_data_hijo.selectedIndex].value+"-"+document.fecha.month_data_hijo.options[document.fecha.month_data_hijo.selectedIndex].value+"-"+document.fecha.day_data_hijo.options[document.fecha.day_data_hijo.selectedIndex].value;
	if((document.getElementById('medida').value=="")&&(document.getElementById('curva_sel').selectedIndex=="1")){
	 error+="Debes introducir la altura de tu hijo<br/>";	
	 
	 document.getElementById('error').style.display="block";
	 enviar=1;
	}
	if((document.getElementById('medida').value=="")&&(document.getElementById('curva_sel').selectedIndex=="0")){
	  error+="Debes introducir el peso de tu hijo<br/>";	
	  document.getElementById('error').style.display="block";
	 
	 enviar=1;
	}
    if(document.fecha.day_data_hijo.options[document.fecha.day_data_hijo.selectedIndex].value==""){
	  error+="Debes introducir el dia<br/>";	
	  document.getElementById('error').style.display="block";
	 
	 enviar=1;
	}
	if(document.fecha.month_data_hijo.options[document.fecha.month_data_hijo.selectedIndex].value==""){
	  error+="Debes introducir el mes<br/>";	
	  document.getElementById('error').style.display="block";
	 
	 enviar=1;
	}
	if(document.fecha.year_data_hijo.options[document.fecha.year_data_hijo.selectedIndex].value==""){
	  error+="Debes introducir el año<br/>";	
	  document.getElementById('error').style.display="block";
	 
	 enviar=1;
	}
	if(isNaN(document.getElementById('medida').value))
	{	enviar=1;
		 error+="Debes introducir un numero correcto<br/>";	
		  document.getElementById('error').style.display="block";
	}
   if(enviar==1){
		document.getElementById('error').innerHTML=error;
	}else {

   $.ajax({
			type: "POST",
			url: url+"index.php/paramibebe/add_weight_literalCid",
			data: contenido,
			success: function(datos){
				dibujar(url,curva);
				if(curva=="peso"){
					devolver_pesos(url,'P');
				}else{
					devolver_pesos(url,'A');
				}
		  }
	});
   }
	
}

function dibujar(url,curva) {
 
    var puntos = [];
	
	document.getElementById('placeholder').innerHTML="<img style='margin-left:100px;margin-top:100px;'src='"+url+"/images/ajax-loader.gif'/>";
	if(curva=="peso"){
		 options = {xaxis: {min: 0,max: 24},yaxis: {min: 2,max: 18},grid: {show: false}};
	
	$.ajax({
			type: "POST",
			url: url+"index.php/paramibebe/get_weight_literalCid",
			data: "inicial=P",
			success: function(datos){
				aux=datos.split("<>");
				datos=aux[1];
				temp=datos.split(";");
				x=temp[0].split(",");
				y=temp[1].split(",");
				puntos.push([0,2]);
				for(i=0;i<x.length;i++){
					 var zero=0;
					 var mayor=24;
					 var sum1=zero+parseFloat(x[i]);
					// var sum2=mayor-parseFloat(y[i]);
					 var sum2=parseFloat(y[i]);
					//if ((sum2 >=0)&&(sum2<=24)){
					if (sum2 >=0){
			 		puntos.push([sum2,sum1]);
					}
				}
				
			
			
				 $.plot($("#placeholder"), [
				{
				 data: puntos,
				// label:'Qubic interpolation',
				 lines: { show: true }
				}
				], options);  
				 	
		  }
	});
	
	}
	else
	{	 
		 options = {xaxis: {min: 0,max: 24},yaxis: {min: 50,max: 90},grid: {show: false}};	
		 $.ajax({
			type: "POST",
			url: url+"index.php/paramibebe/get_weight_literalCid",
			data:  "inicial=A",
			success: function(datos){
				aux=datos.split("<>");
				datos=aux[1];
				temp=datos.split(";");
				x=temp[0].split(",");
				y=temp[1].split(",");
				puntos.push([0,50]);
				for(i=0;i<x.length;i++){
					  var zero=0;
					 var mayor=24;
					 var sum1=zero+parseFloat(x[i]);
					// var sum2=mayor-parseFloat(y[i]);
					 var sum2=parseFloat(y[i]);
				//	 if ((sum2 >=0)&&(sum2<=24)){
					if (sum2 >=0){
			 		puntos.push([sum2,sum1]);
					 }
					
				}
					
				 $.plot($("#placeholder"), [
				{
				 data: puntos,
				// label:'Qubic interpolation',
				 lines: { show: true }
				}
				], options);  
		  }
	});
	
	}
	

	 
}

function devolver_pesos(url,inicial)
{
	$.ajax({
			type: "POST",
			url: url+"index.php/paramibebe/get_all_weight_literalCid",
			data: "inicial="+inicial,
			success: function(datos){
				
				document.getElementById('favoritos').innerHTML=datos;
		  }
	});	
}

function devolver_path(url)
{
	 document.getElementById('foto_hijo').src=url+"images/pon_foto.jpg";
	
	$.ajax({
			type: "POST",
			url: url+"index.php/cuenta/devolver_path",
			data: "",
			success: function(datos){
				if(datos!=""){
				 document.getElementById('foto_hijo').src=url+datos+"?"+Math.round(Math.random()*1000000);
				}else{
				
				 document.getElementById('foto_hijo').src=url+"images/pon_foto.jpg";
				 }
				
		  }
	});	
}

function borrar_fila_curvas(url,fecha,inicial)
{
 
  var myTable = document.getElementById('favoritos1');
  
  for(i=0;i<myTable.rows.length;i++)
	{
		var rows = myTable.getElementsByTagName("tr");   
		for(j = 1; j < rows.length; j++){           
	 		var colums = rows[j].getElementsByTagName("td"); 
			    if(colums[1].childNodes[0].nodeValue==fecha)
				{
					
					 myTable.deleteRow(j);
					  $.ajax({
							type: "POST",
							url: url+"index.php/paramibebe/del_weight_literalCid",
							data: "inicial="+inicial+"&fecha="+fecha,
							success: function(datos){
								
								if(inicial=="P"){
									dibujar(url,"peso");
								}else{
									dibujar(url,"altura"); 
								}
						  }
					});
				}	  
			 
		 } 
	}

}

function modificar_fila_curvas(url,fecha,inicial,obj)
{

 fila=obj.parentNode.parentNode;
 fila.parentNode.removeChild(fila);
  $.ajax({
							type: "POST",
							url: url+"index.php/paramibebe/del_weight_literalCid",
							data: "inicial="+inicial+"&fecha="+fecha,
							success: function(datos){
								
							}
					});


}

var pagina_receta=0;
function mas_recetas_drc(url,idioma)
{ 
	pagina_receta=pagina_receta+1;
	if(pagina_receta>3){pagina_receta=3;}else{
   $.ajax({
			type: "POST",
			url: url+"index.php/paramibebe/mas_recetas/"+idioma,
			data: "pagina="+pagina_receta,
			beforeSend: function(){
            document.getElementById("content_recetas").innerHTML='<p class="loader_receta"></p>';
			
        	},
			success: function(datos){
			
			document.getElementById("content_recetas").innerHTML=datos;
				
		  }
	});
	}
}
function mas_recetas_izq(url,idioma)
{ 
	pagina_receta=pagina_receta-1; 
	if(pagina_receta<0){pagina_receta=0;}else{
   $.ajax({
			type: "POST",
			url: url+"index.php/paramibebe/mas_recetas/"+idioma,
			data: "pagina="+pagina_receta,
			beforeSend: function(){
            document.getElementById("content_recetas").innerHTML='<p class="loader_receta"></p>';
			
        	},
			success: function(datos){
			
			document.getElementById("content_recetas").innerHTML=datos;
				
		  }
	});
	}
}

function ganadores(url,idioma)
{ 
	
   $.ajax({
			type: "POST",
			url: url+"index.php/cuenta/todos/"+idioma,
			data: "",
			success: function(datos){
			
			
			document.getElementById("todos").innerHTML='<div id="negra"></div><div id="pop" style="top: 268px; left: 331px;"><div id="form_superior"><div id="titulo_pop">TODOS LOS GANADORES</div><div id="boton_cerrar"><a style="cursor: pointer;" onclick="destruye_ajax();" ><div id="imagen_popup"></div></a></div></div><div id="form_interior"><div id="form_interior_contenido"> <div style="color:#213E86;font-size:14px;margin-left:30px; list-style:none;overflow:auto; height:290px;">'+datos+'</div><div style="margin-left: 420px; margin-top: 15px;"><a onclick="destruye_ajax();" href="javascript:void(0);"><img src="'+url+'images/aceptar.jpg"></a></div></div></div><div id="form_inferior"></div></div>';

				
		  }
	});
	
}


  function coordenadas(ev,capa){ 
 	
   document.getElementById("tooltip").style.display="block";
   document.getElementById("tooltip").className=capa;
 }
  	
  function moviment1(ev){
	  mx=window.event?event.clientX:ev.pageX;
	  my=window.event?event.clientY:ev.pageY;
	  document.getElementById("tooltip").style.top=(my+20)+"px";
 	  document.getElementById("tooltip").style.left=(mx-70)+"px";
	 
 }	

	var coords = [0,0];
		function moviment(e){
		var x, y;
		if (self.pageYOffset) // all except Explorers
		{
		x = self.pageXOffset; // not used in event code
		y = self.pageYOffset; // not used in event code
		}
		else if(document.documentElement
		&& document.documentElement.scrollTop) // Explorer 6 Strict
		{
		x = document.documentElement.scrollLeft;
		y = document.documentElement.scrollTop;
		}
		else if (document.body) // all other Explorers
		{
		x = document.body.scrollLeft;
		y = document.body.scrollTop;
		}
		coords[0] = (document.all) ? x + event.clientX : e.pageX;
		coords[1] = (document.all) ? y + event.clientY : e.pageY;
//		document.getElementById("tooltip").style.top=(coords[1]+20)+"px";
// 	    document.getElementById("tooltip").style.left=(coords[0]-70)+"px";
		}
		if (!document.all) document.captureEvents(Event.MOUSEMOVE);
	
		
 document.onmousemove = function(event){moviment(event)};
  
 
 function ocult_coord(){ 
   	  
	document.getElementById("tooltip").style.display="none";
	  	
 }
 
function dragdrop(){
	var aThumb = document.getElementById("scroll");
	var scrolldiv=document.getElementById("ganadores");
	Drag.init(aThumb, null, 0, 0, 0, 200);
	aThumb.onDrag = function(x, y) {
	 scrolldiv.style.top=((y * (-5.0))) +"px";
	}

}

function dragdrop_imaginarium(){
	var aThumb = document.getElementById("scroll_imaginarium");
	var scrolldiv=document.getElementById("ganadores_imaginarium");
	Drag.init(aThumb, null, 0, 0, 0, 0);
	aThumb.onDrag = function(x, y) {
	scrolldiv.style.top=((y * (-5.0))) +"px";
	}

}

function get_ganadores(url,idioma)
{ 
		var left=parseInt((document.documentElement.clientWidth/2)-300)+'px';
		var top=document.documentElement.scrollTop+parseInt(document.documentElement.clientHeight/4)+'px';
	
   $.ajax({
			type: "POST",
			url: url+"index.php/clubpadres/ganadores_triciclo/"+idioma,
			data: "",
			success: function(datos){
			
			
			document.getElementById("todos").innerHTML='<div onclick="destruye_ajax();" id="negra"></div><div id="pop" style="top:'+top+'; left: '+left+';"><div id="form_superior"><div id="titulo_pop">GANADORES DEL TRICICLO</div><div id="boton_cerrar"><a style="cursor: pointer;" onclick="destruye_ajax();" ><div id="imagen_popup"></div></a></div></div><div id="form_interior"><div id="form_interior_contenido"> '+datos+'</div></div><div id="form_inferior"></div></div>';
			dragdrop();
				
		  }
	});
	
}

function get_ganadores_imaginarium(url,idioma)
{ 
    var left=parseInt((document.documentElement.clientWidth/2)-300)+'px';
    var top=document.documentElement.scrollTop+parseInt(document.documentElement.clientHeight/4)+'px';

    $.ajax({

        type: "POST",
        url: url+"index.php/clubpadres/ganadores_imaginarium/"+idioma,
        data: "",
        success: function(datos){
            document.getElementById("todos").innerHTML='<div onclick="destruye_ajax();" id="negra"></div><div id="pop" style="top:'+top+'; left: '+left+';"><div id="form_superior"><div id="titulo_pop">GANADORES NAVIDAD 2011</div><div id="boton_cerrar"><a style="cursor: pointer;" onclick="destruye_ajax();" ><div id="imagen_popup"></div></a></div></div><div id="form_interior"><div id="form_interior_contenido"> '+datos+'</div></div><div id="form_inferior"></div></div>';
            dragdrop_imaginarium();
            $("#todos").addClass("popup_imaginarium");
        }
    });
	
}


function contacto_danone(url,idioma)
{ 
		var left=parseInt((document.documentElement.clientWidth/2)-300)+'px';
		var top=document.documentElement.scrollTop+parseInt(document.documentElement.clientHeight/4)-50+'px';
	
   $.ajax({
			type: "POST",
			url: url+"index.php/clubpadres/contacto_danone/"+idioma,
			data: "",
			success: function(datos){
			
			
			document.getElementById("todos").innerHTML='<div onclick="destruye_ajax();" id="negra"></div><div id="pop" style="top:'+top+'; left: '+left+';"><div id="form_superior"><div id="titulo_pop">CLUBPADRES.COM TE ESCUCHA</div><div id="boton_cerrar"><a style="cursor: pointer;" onclick="destruye_ajax();" ><div id="imagen_popup"></div></a></div></div><div id="form_interior"><div id="form_interior_contenido"> '+datos+'</div></div><div id="form_inferior"></div></div>';
			
				
		  }
	});
	
}

function comprov_attrib(o){
	if(o.options.selectedIndex==7){
		icampo=document.createElement('input');
		icampo.setAttribute('name',o.name);
		icampo.className=o.className;
		o.parentNode.replaceChild(icampo,o);
	}
}


function _Llamada_Ajax_new(url,IdForm,divResp)
{ 
 
 var id=IdForm;
   var txt=$(id).serialize();
  
	  $.ajax({
			type: "POST",
			url: url,
			data: txt,
			success: function(datos){
			document.getElementById(divResp).innerHTML=datos;
			
			  }
			  
	});
	
}



function prueba_datos(url,IdForm,divResp)
{ 
 
 var id=IdForm;
   var txt=$(form_cuenta_datos_personales).serialize();
   alert(txt);
	  $.ajax({
			type: "POST",
			url: url,
			data: txt,
			success: function(datos){
			document.getElementById(divResp).innerHTML=datos;
			
			  }
			  
	});
	
}

function comprobar()
{
	/*
	var menu1=document.getElementById("a1");
	var menu2=document.getElementById("a2");
	var menu3=document.getElementById("a3");
	var menu5=document.getElementById("a5");
	var submenu1=document.getElementById("submenu1");
	var submenu2=document.getElementById("submenu2");
	var submenu3=document.getElementById("submenu3");
	var submenu5=document.getElementById("submenu5");

	submenu1.style.visibility="hidden";
	submenu2.style.visibility="hidden";
	submenu3.style.visibility="hidden";
	submenu5.style.visibility="hidden";
	menu1.style.marginTop="10px";
	menu2.style.marginTop="10px";
	menu3.style.marginTop="10px";
	menu5.style.marginTop="10px";
	
	submenu1.style.zIndex = '0';
	submenu2.style.zIndex = '0';
	submenu3.style.zIndex = '0';
	submenu5.style.zIndex = '0';
	
	try
	{
		old_obj = activo;
		
		switch(sub_activo)
		{
			case "submenu1": 
				submenu1.style.visibility="visible";
				menu1.style.marginTop="0px";
				break;
			case "submenu2":
				submenu2.style.visibility="visible";
				menu2.style.marginTop="0px";
				break;
			case "submenu3": 
				submenu3.style.visibility="visible";
				menu3.style.marginTop="0px";
			break;
			case "submenu5": 
				submenu5.style.visibility="visible";
				menu5.style.marginTop="0px";
			break;
			default:  break;
		}
	}
	catch(err){return}
	
	*/
}

/*Funciones para el tratamiento de cookies*/
function SetCookie (name, value) {  
	var expires= new Date(); 
	expires.setYear(2032);
	document.cookie = name + "=" + escape (value) + 
	"; expires=" + expires.toGMTString() +
	"; path=/";
}


function GetCookie (name) {  
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) {    
		var j = i + alen;    
		if (document.cookie.substring(i, j) == arg)      
			return getCookieVal (j);    
		i = document.cookie.indexOf(" ", i) + 1;
		if (!i) break;   
	}  
	return null;
}

function getCookieVal (offset) {  
	var endstr = document.cookie.indexOf (";", offset);  
	if (endstr == -1)    
	endstr = document.cookie.length;  
	return unescape(document.cookie.substring(offset, endstr));
}

function abrirVideoMoo(rutavideo){

	//reportaAnalytics('/home/video_explicativo','Vida+Ligera|Home-Video explicativo');
//	document.getElementById("opaca").style.display='block';
//	document.getElementById("opaca").style.zIndex='7';
	
	var blanca = new Element('div', 
		{
		'id':'videoFontvella',
		'class':'error',
		'style':'z-index:10',
		'html':'<div id="#sTint" class="interior"><div id="mediaspace"></div></div>'
		
		} 
	);
	
	var volver_button = new Element('img', 
		{
		'id':'volver_button',
		'src':'http://clubfvpre.housings.nexica.net/test/img/img_volver.gif'
		} 
	);
	
	blanca.inject($('body'),'top');

	var obj = new Swiff('http://localhost:8888/clubpadres/reproductor/player.swf', {
	    id: 'videovideo',
	    width: 480,
	    height: 405,
	    container: "mediaspace",
		params: {
	        wmode: 'transparent',
	        bgcolor: '#FFFFFF'
	    },
	    vars: {file: rutavideo,autostart:true}
	});
	
	volver_button.inject($("videoFontvella"));
	
	$('volver_button').addEvents({
	    'click': function(){
			document.getElementById("opaca").style.display='none';
			document.getElementById("opaca").style.zIndex='7';
			$("videoFontvella").destroy();

	    }
	});
	
}

function ajax_codigo_plus(url,IdForm,divResp)
{ 
 
 var txt=$(IdForm).serialize();
   	  $.ajax({
			type: "POST",
			url: url,
			data: txt,
			success: function(datos){
				
			$("#errores").html(datos);
			$(".message").css("margin-left","0px");
			$(".message h6").css("position","relative");
			
			  }
			  
	});
	
}

function bases_navidad() {
	$('#form_interior_contenido').addClass('navidad_bases');
}	
