function fValidarDatosOpcion (strOpcion,intBloque){
	strTitulo = document.frmCajitas.txtTitulo.value;
	if (strTitulo=="") {alert(fM("IntroduzcaTitulo"));return;}
	strLead=document.frmCajitas.txtLead.value;
	if (strLead=="") {alert(fM("IntroduzcaLead"));return;}
	strCaducidad=document.frmCajitas.cboCaducidad.value;
	if (strCaducidad=="") {alert(fM("IntroduzcaCaducidad"));return;}
	else{if(!fValidarDia(strCaducidad)){return;}}
	//VALIDAMOS QUE LAS POSICIONES DE LOS BLOQUE SEAN TODAS DISTINTAS
	intCuantos = document.frmCajitas.Cuantos.value;
	sw=0;
	for (i=1;i<=intCuantos;i++){
		for (j=1;j<=intCuantos;j++){
			if ((i!=j) && (eval('document.frmCajitas.cboOrden'+i+'.value') == eval('document.frmCajitas.cboOrden'+j+'.value'))){sw=1;}
		}
	}
	if (sw==1){alert(fM("OrdenBloquesDistintios"));return;}
	
	//VALIDAMOS QUE LOS CAMPOS DEL 1ER ESTAN BIEN RELLENADOS
	intPrimero = 0
	for (i=1;i<=intCuantos;i++){
		if(eval('document.frmCajitas.cboOrden'+i+'.value') == 1){intPrimero = i; i=intCuantos;}
	}
	if (intPrimero == 0){alert(fM("DebeHaberBloque1"));return;}
	if (eval('document.frmCajitas.hdnTipo'+intPrimero+'.value')!="1" && eval('document.frmCajitas.hdnTipo'+intPrimero+'.value')!="2"){
		strTitulo = eval('document.frmCajitas.txtTitulo'+intPrimero+'.value');
		strTexto = eval('document.frmCajitas.txtTexto'+intPrimero+'.value');
		strFoto = eval('document.frmCajitas.txtImagen'+intPrimero+'.value');
		strPie = eval('document.frmCajitas.txtPie'+intPrimero+'.value');
		strFoto2 = eval('document.frmCajitas.Imagen'+intPrimero+'.value');
		if(strPie!="" && strFoto=="" && strFoto2==""){alert(fM("Bloque")+" 1: "+fM("PieDeFotoSinFoto"));return;}
		if (strTitulo == "" && strTexto == "" && strFoto == "" && strFoto2 == ""){alert(fM("PrimerBloqueObligatorio"));return;}
	}
	
	//VALIDAMOS QUE TODOS LOS DEMÁS BLOQUES ESTEN BIEN RELLENADOS
	for (i=1;i<=intCuantos;i++){
		if (eval('document.frmCajitas.hdnTipo'+i+'.value')!="1" && eval('document.frmCajitas.hdnTipo'+i+'.value')!="2"){
			strTitulo = eval('document.frmCajitas.txtTitulo'+i+'.value');
			strTexto = eval('document.frmCajitas.txtTexto'+i+'.value');
			strFoto = eval('document.frmCajitas.txtImagen'+i+'.value');
			strPie = eval('document.frmCajitas.txtPie'+i+'.value');
			strFoto2 = eval('document.frmCajitas.Imagen'+i+'.value');
			intOrden = eval('document.frmCajitas.cboOrden'+i+'.value');
			if(strPie!="" && strFoto=="" && strFoto2==""){alert(fM("Bloque")+ " " + intOrden + " : "+fM("PieDeFotoSinFoto"));return;}
			if(strFoto!="" || strFoto2!=""){
				strWai = eval('document.frmCajitas.txtWai'+i+'.value');
				strWai2 = eval('document.frmCajitas.txtDWai'+i+'.value');
				if(strWai == "" || strWai2 == ""){
					alert(fM("Bloque")+ " " + intOrden + " : "+fM("IntroduzcaWaiFoto"));return;
				}
			}
			if (strTitulo == "" && strTexto == "" && strFoto == "" && strFoto2 == ""){alert(fM("Bloque")+ " " + intOrden + " : "+fM("DebeRellenarAlgunCampoBloque"));return;}
		}else{if (eval('document.frmCajitas.hdnTipo'+i+'.value')=="1"){
			intOrden = eval('document.frmCajitas.cboOrden'+i+'.value');
			intImagenes = eval('document.frmCajitas.hdnImagenes'+i+'.value');
			for (x=1;x<=intImagenes;x++){
				strWai = eval('document.frmCajitas.txtWai'+i+x+'.value');
				strWai2 = eval('document.frmCajitas.txtDWai'+i+x+'.value');
				if(strWai == "" || strWai2 == ""){
					alert(fM("Bloque")+ " " + intOrden + " / " + fM("Imagen") + " " + x + " : "+fM("IntroduzcaWaiFoto"));return;
				}
			}
		}}
	}
	if(strOpcion=="a"){document.frmCajitas.Anhadir.value=1;}
	else{if(strOpcion=="i"){document.frmCajitas.Anhadir.value=2;}
	else{if(strOpcion=="ii"){
		document.frmCajitas.Anhadir.value=4;
		document.frmCajitas.Donde.value=intBloque;
	}
	else{if(strOpcion=="t"){document.frmCajitas.Anhadir.value=3;}}}}
	document.frmCajitas.submit();
}
//******************************************
function fVerAlineaciones (intBloque){
	strTexto = eval('document.frmCajitas.txtTexto'+intBloque+'.value');
	strFoto = eval('document.frmCajitas.txtImagen'+intBloque+'.value');
	strFoto2 = eval('document.frmCajitas.Imagen'+intBloque+'.value');
	strCapa1 = 'divIzquierda'+intBloque;
	strCapa2 = 'divDerecha'+intBloque;
	strCapa3 = 'divCentro'+intBloque;
	
	MM_showHideLayers (strCapa1,'','hidden');
	MM_showHideLayers (strCapa2,'','hidden');
	MM_showHideLayers (strCapa3,'','hidden');
	if (strFoto != "" || strFoto2 != ""){
		MM_showHideLayers (strCapa1,'','show');
		MM_showHideLayers (strCapa2,'','show');
		if (strTexto == ""){
			MM_showHideLayers (strCapa3,'','show');
		}
	}
}
//******************************************
function fCambiarColumnas (){
	intColumnas = document.frmDato.cboColumnas.value;

	I11.style .backgroundColor = '#E8ECF6';
	I12.style .backgroundColor = '#E8ECF6';
	I13.style .backgroundColor = '#E8ECF6';
	I14.style .backgroundColor = '#E8ECF6';
	I15.style .backgroundColor = '#E8ECF6';
	I21.style .backgroundColor = '#E8ECF6';
	I22.style .backgroundColor = '#E8ECF6';
	I23.style .backgroundColor = '#E8ECF6';
	I24.style .backgroundColor = '#E8ECF6';
	I25.style .backgroundColor = '#E8ECF6';
	
	i=1
	while (i<=intColumnas){
		eval("I1"+i+".style .backgroundColor = '#FC9C38'");
		eval("I2"+i+".style .backgroundColor = '#FC9C38'");
		i++;
	}
}
//******************************************
function fValidarDatosColumnas (){
	if(document.frmDato.txtCuantas.value==""){alert(fM("IntroduzcaCuantasImagenes"));return;}
	document.frmDato.submit();
}
//******************************************
function fValidarDatosTabla (){document.frmDato.submit();}
//****************************************
function fAseguraBorrarNoticia(){
	intCuantos=document.frmLista.Cuantos.value;
	i=0;
	sw=0;
	strNoticias="";
	if (intCuantos=="1"){
		if (document.frmLista.Noticia.checked){
			sw=1;
			strNoticias = document.frmLista.Noticia.value;
		}
	}else{
		while (i<intCuantos){
			if (document.frmLista.Noticia[i].checked){
				if (sw==0){
					strNoticias = document.frmLista.Noticia[i].value;
				}else{
					strNoticias = strNoticias + "," + document.frmLista.Noticia[i].value;
				}
				sw=1;
			}
			i++;
		}
	}
	document.frmLista.hdnNoticias.value = strNoticias;
	if (sw=="1"){
		if (confirm(fM("SeguroBorrarNoticiasIdioma"))){document.frmLista.submit();}
		else{return;}
	}else{alert(fM("SeleccioneNoticiasBorrar"));return;}
}
//****************************************
function fAsegurarBorrarUnArt(intCodigo,strCodIdioma){if (confirm(fM("SeguroBorrarNoticia"))){location.href='index.php?pg=7&CodIdioma='+strCodIdioma+'&CodNoticia='+intCodigo}}
//****************************************
function fAseguraBorrarImagen(intCodigo,intNoticia){if (confirm(fM("SeguroBorrarImagen"))){location.href='index.php?pg=8&codigo='+intCodigo+'&Noticia='+intNoticia;}}
//****************************************
function fValidarBuscar (){
	strFecha = document.frmBuscar.txtFecha.value;
	if (strFecha!=""){if(!fValidarDia(strFecha)){return;}}
	document.frmBuscar.submit();
}
//****************************************
function fLimpiarBuscador(strIdioma){
	document.frmBuscar.txtTitulo.value="";
	document.frmBuscar.txtFirma.value="";
	document.frmBuscar.txtLead.value="";
	document.frmBuscar.txtFecha.value="";
	document.frmBuscar.cboIdioma.value=strIdioma;
	return;
}
//**************************************
function fAsegurarBorrarImagenBloque (intCodBloque,intModelo,strIdioma,intCodImagen){
	if(confirm(fM("SeguroBorrarImagen"))){
		if (intCodImagen=="0"){location.href="index.php?pg=17&CodBloque="+intCodBloque+"&CodNoticia="+intModelo+"&CodIdioma="+strIdioma;}
		else{location.href="index.php?pg=24&CodImagen="+intCodImagen+"&Bloque="+intCodBloque+"&CodNoticia="+intModelo+"&CodIdioma="+strIdioma;}
	}else{return;}
}
//**************************************
function fAsegurarBorrarBloque (intBloque,intCodBloque,intCodNoticia,strCodIdioma,intTipo){
	intOrden = eval('document.frmCajitas.cboOrden'+intBloque+'.value');
	if (intOrden==1){strMensaje = fM("SeguroBorrarBloque1");}else{strMensaje = fM("SeguroBorrarBloque");}
	if(confirm(strMensaje)){
		location.href = "index.php?pg=16&Tipo="+intTipo+"&CodNoticia="+intCodNoticia+"&CodBloque="+intCodBloque+"&CodIdioma="+strCodIdioma;
	}else{return;}
}
//**************************************
function fValidarBusqueda (){
	strDesde = document.frmArchivo.txtDesde.value;
	if (strDesde!=""){if(!fValidarDia(strDesde)){return;}}
	else{alert(fM("MinimoFechaDesde"));return;}
	
	strHasta = document.frmArchivo.txtHasta.value;
	if (strHasta!=""){if(!fValidarDia(strDesde)){return;}}
	
	if(strDesde!="" && strHasta!=""){if(!fValidarFechas(strDesde,strHasta)){return;}}
	
	document.frmArchivo.submit();
}

	


