/*function envia_solicitud()
{
  objF = MM_findObj("fData");
  var comentario = "";
  
  
  if(objF.url.value == "") comentario += "\n- Url.";    	

  if(objF.rs.value == "") comentario += "\n- Nombre o Razón Social.";    	
  if(objF.cif.value == "") comentario += "\n- CIF / NIF.";    	
  if(objF.domicilio.value == "") comentario += "\n- Domicilio.";    	
  if(objF.poblacion.value == "") comentario += "\n- Población.";    	
  if(objF.cp.value == "") comentario += "\n- Código Postal.";    	
  if(objF.cod_pais.value == "") comentario += "\n- País.";    	
  if(objF.cod_provincia.value == "") comentario += "\n- Provincia.";    	
  
  
  if((objF.email.value == "") || (objF.email.value.indexOf("@") < 1) || (objF.email.value.lastIndexOf(".") < 3)){
	comentario += "\n- Código (su email).";
  }
  if((objF.email_facturas.value == "") || (objF.email_facturas.value.indexOf("@") < 1) || (objF.email_facturas.value.lastIndexOf(".") < 3)){
	comentario += "\n- Email para informes y facturas.";
  }
  
  if(objF.clave_1.value == "") comentario += "\n- Los criterios son Obligatorios.";
  if(objF.clave_2.value == "") comentario += "\n- Los criterios son Obligatorios.";
  if(objF.clave_3.value == "") comentario += "\n- Los criterios son Obligatorios.";
  if(objF.titulo.value == "") comentario += "\n- El Título es Obligatorio.";
  if(objF.tfno1.value == "") comentario += "\n- El Primer Teléfono es Obligatorio.";
  if(objF.txt_codigo.value == "") comentario += "\n- Debe introducir el Código de Seguridad.";

  if(objF.rd_ccc[0].checked){
	if((objF.txt_nac_1.value == "") || (objF.txt_nac_2.value == "") || (objF.txt_nac_3.value == "") || (objF.txt_nac_4.value == "")
		|| (objF.txt_nac_1.value.length != 4) || (objF.txt_nac_2.value.length != 4) || (objF.txt_nac_3.value.length != 2) || (objF.txt_nac_4.value.length != 10)){
		comentario += "\n- La cuenta corriente no está rellenada correctamente.";
	}
  
  }
	
  if(comentario != ""){
		window.alert("Some registers is empty:"+comentario);
		return false;
	}else{
		document.getElementById('capa_accion').innerHTML='Enviando la solicitud. Espere, por favor ...';
		objF.submit(); 
		return true;
	}
  return false;
}*/
function validar(){
	objF = MM_findObj("fData");
	var comentario = "";
	
		//USUARIO OBLIGATORIO
	if((objF.email.value == "") || (objF.email.value.indexOf("@") < 1) || (objF.email.value.lastIndexOf(".") < 3)){
		comentario += "\n -L'email de l'utilisateur est obligatoire.";
	}
		
	//al menos un Grupo
	if((!objF.chk_grup1.checked) && (!objF.chk_grup2.checked) && (!objF.chk_grup3.checked) && (!objF.chk_grup4.checked)){
		comentario += "\n -Saisissez un groupe de moteurs de recherches au moins.";
	}
	//Su Web: Url obligatorio
	if(objF.url.value == ""){
		comentario += "\n -L'adresse URL est obligatoire.";
	}
	//Su Web: titulo obligatorio
	if(objF.titulo.value == ""){
		comentario += "\n -Le nom de votre site web est obligatoire.";
	}
	//Su Web: Palabras obligatorio
	if((objF.clave_1.value == "") || (objF.clave_2.value == "") || (objF.clave_3.value == "")){
		comentario += "\n -Les 3 mots clefs sont obligatoires.";
	}
	//Su Web: descripcion obligatorio
	if(objF.descripcion.value == ""){
		comentario += "\n -La description est obligatoire.";
	}
	//Su Web: clasificacion obligatorio
	if(objF.clasificacion.value == ""){
		comentario += "\n -La clasification est obligatoire.";
	}
	//Su Web: email para promocionar en los buscadores
	/*if(objF.txt_email_promo.value != ""){  
		if((objF.txt_email_promo.value.indexOf("@") < 1) || (objF.txt_email_promo.value.lastIndexOf(".") < 3)){
			comentario += "\n -Le format de l'e-mail du moteur de recherche n'est pas correct.";
		}
	}*/

		//Sus Datos: Nombre obligatorio
	if(objF.rs.value == ""){
		comentario += "\n -La raison sociale est obligatoire.";
	}
	//Sus Datos: cif/nif obligatorio
	if(objF.cif.value == ""){
		comentario += "\n -Le numero cif est obligatoire.";
	}
	//Sus Datos: Domicilio obligatorio
	if(objF.domicilio.value == ""){
		comentario += "\n -Le lieu de domicile est obligatoire.";
	}
	//Sus Datos: poblacion obligatorio
	if(objF.poblacion.value == ""){
		comentario += "\n -La population estobligatoire.";
	}
	//Sus Datos: cp obligatorio
	if(objF.cp.value == ""){
		comentario += "\n -Le code postal est obligatoire.";
	}
	//Sus Datos: pais obligatorio
	if(objF.cod_pais.value == 0){
		comentario +="\n -Le pays est obligatoire.";
	}
	//Sus Datos: la provincia es obligatoria
	if(objF.cod_provincia.value == 0){
		comentario +="\n -La provincie est obligatoire.";
	}
	//Sus Datos: email
	/*if((objF.txt_email.value == "") || (objF.txt_email.value.indexOf("@") < 1) || (objF.txt_email.value.lastIndexOf(".") < 3)){
		comentario += "\n -Le e-mail est obligatoire.";
	}*/
	
	//Sus Datos: telefono1 obligatorio
	if(objF.tfno1.value == ""){
		comentario += "\n -Le telephone fize est obligatoire.";
	}
	
	//datos bancarios
	//espaï¿½a
	if(objF.rd_ccc[0].checked){
		if((objF.txt_nac_1.value == "") || (objF.txt_nac_2.value == "") || (objF.txt_nac_3.value == "") || (objF.txt_nac_4.value == "")
			|| (objF.txt_nac_1.value.length != 4) || (objF.txt_nac_2.value.length != 4) || (objF.txt_nac_3.value.length != 2) || (objF.txt_nac_4.value.length != 10)){
			comentario += "\n -Le compte courant n'est pas enregistro correctement.";
		}
		/*objF.txt_ext_1.value = "";
		objF.txt_ext_2.value = "";*/
	}else{//extranjero
		/*if(objF.txt_ext_1.value == "" || objF.txt_ext_2.value == ""){	
			comentario += "\n -Un champs du compte internationnal est vide.";
		}*/
		objF.txt_nac_1.value = "";
		objF.txt_nac_2.value = "";
		objF.txt_nac_3.value = "";
		objF.txt_nac_4.value = "";
	}
	
	// Añadido Alberto 15/07/2010
  if(objF.rd_ccc[1].checked){
  	if (objF.cod_pais.value == "432")
  		comentario += "\n -Pour l'Espagne doit choisir de débit.";
  }
  // Fin añadido Alberto
	
	//codigo captcha obligatorio
	if(objF.txt_codigo.value.length == 0)
	{
		comentario += "\n -Code de sécurité.";
	}
		
	
	if(comentario != ""){
		window.alert("Vous avez oublier de remplir quelques champs obligatoires:"+comentario);
		return false;
	}else{
		objF.submit();
	}
	return false;
}
function carga_provincias(cod_pais)
{
	var variables = new Array();
	var TT = new TTajax();
	TT.msg = 'cargando provincias ...';
	TT.server = 'provincias.html';
	TT.Carga("post","capa_provincia",variables,"&g_id="+cod_pais);
	return;
}
function chgCobro(valor,activo){
	if(activo){
		obj=eval("MM_findObj('fData')");
		if (valor=='N'){
			//obj.txt_ext_1.disabled=true;
			//obj.txt_ext_2.disabled=true;
			obj.txt_nac_1.disabled=false;
			obj.txt_nac_2.disabled=false;
			obj.txt_nac_3.disabled=false;
			obj.txt_nac_4.disabled=false;
		}
		if (valor=='I'){
			//obj.txt_ext_1.disabled=false;
			//obj.txt_ext_2.disabled=false;
			obj.txt_nac_1.disabled=true;
			obj.txt_nac_2.disabled=true;
			obj.txt_nac_3.disabled=true;
			obj.txt_nac_4.disabled=true;
		}		
	}
}


function gestMarcados(indice){
	objF = MM_findObj("fData");
	if(indice==4){
		if(objF.chk_grup4.checked){
			objF.chk_grup1.checked = false;
			objF.chk_grup2.checked = false;
			
		}else if(objF.chk_grup1.checked){
			objF.chk_grup2.checked = false;
			objF.chk_grup4.checked = false;
		}else{
			objF.chk_grup2.checked = true;
		}
	}
	if(indice==1){
		if(objF.chk_grup1.checked){
			objF.chk_grup4.checked = false;
			objF.chk_grup2.checked = false;
			
		}else if(objF.chk_grup4.checked){
			objF.chk_grup1.checked = true;
			objF.chk_grup2.checked = false;
		}else{
			objF.chk_grup2.checked = true;
		}
	}
	if(indice==2){
		if(objF.chk_grup2.checked){
			objF.chk_grup4.checked = false;
			objF.chk_grup1.checked = false;
			
		}else if(objF.chk_grup4.checked){
			objF.chk_grup1.checked =false;
			objF.chk_grup2.checked = false;
		}else{
			objF.chk_grup1.checked = true;
		}
	}
}




function bloque_pago_original(valor)
{
	if( valor )
	{
		var clase = 'bloque_visible';
	}else{
		var clase = 'bloque_oculto';
	}
	document.getElementById('etiqueta_pago').className = clase;
	document.getElementById('forma_pago').className = clase;
	return;
}

function bloque_pago(valor)
{
	if( valor )
	{
		var clase = 'bloque_visible';
	}else{
		var clase = 'bloque_oculto';
	}
	document.getElementById('etiqueta_pago').className = clase;
	document.getElementById('forma_pago').className = clase;
	document.getElementById('cuota_alta_enl').className = clase;
	return;
}

function bloque_cuota(valor)
{
	if( valor )
	{
		var clase = 'bloque_visible';
	}else{
		var clase = 'bloque_oculto';
	}
	document.getElementById('cuota_alta_opt').className = clase;
	return;
}

function suma_terminos( formid, obj )
{
	var f = document.getElementById(formid);
	var num = f.elements.length;
	var suma = 0; 
	 
	for (var i=0; i <= num-1; i++) {
		elemento=f.elements[i];
		if(elemento.type=='text'){
			if( (elemento.value != '') && (elemento.name == obj) ){
				var valor = parseFloat(elemento.value)

				if( isNaN(valor) ) 
					elemento.value=''
				else 
					suma += valor
			}
		}
	}
	//return suma;
	return redondear(parseFloat(suma), 2);
}

function cuenta_terminos( formid, obj )
{
	var f = document.getElementById(formid);
	var num = f.elements.length;
	var cuenta = 0; 
	 
	for (var i=0; i <= num-1; i++) {
		elemento=f.elements[i];
		if(elemento.type=='text'){
			if( (elemento.value != '') && (elemento.name == obj) ){ cuenta++; }
		}
	}
	return(cuenta);
}

// Aï¿½adida por error en decimales al generar presupuestos. Rubï¿½n 20081127
function redondear(cantidad, decimales) 
{
	var cantidad = parseFloat(cantidad);
	var decimales = parseFloat(decimales);
	decimales = (!decimales ? 2 : decimales);
	return Math.round(cantidad * Math.pow(10, decimales)) / Math.pow(10, decimales);
}



function envia_clave()
{
  objF = MM_findObj("fData");
  
  if(objF.txt_email.value == ""){
  	window.alert("El email es obligatorio");
 	return false;
  }
  	document.getElementById('capa_accion').innerHTML='Enviando la solicitud. Espere, por favor ...';
	objF.submit(); 
	return true;
}


function cambia_clave()
{
  objF = MM_findObj("fData");
  var comentario = "";
  
  if(objF.txt_clave.value == "") comentario += "\n- Contraseña.";    	
  if(objF.txt_rep_clave.value == "") comentario += "\n- Rep.Contraseña.";
  
  
  if(comentario != ""){
		window.alert("Some registers is empty:"+comentario);
		return false;
	}else{
		document.getElementById('capa_accion').innerHTML='Enviando la solicitud. Espere, por favor ...';
		objF.submit(); 
		return true;
	}
  return false;
}
  
