function navegador(){
	var ievs=(/MSIE (\d+\.\d+);/.test(navigator.userAgent));
	var iev=new Number(RegExp.$1);
	if(iev==6){
		return false;
	}else{
		return true;
	}
}
function windowsresize(){
	if(navegador()){
		if (parseInt(navigator.appVersion)>3) {
			if (navigator.appName=="Netscape") {
				winW = window.innerWidth;
			}
			if(navigator.appName.indexOf("Microsoft")!=-1){
				winW=document.documentElement.clientWidth;
			}
		}
		if(winW>=1074){
			document.getElementById('anchoSecciones').className='gContenedorSecciones_1074';
			document.getElementById('anchoBanners').className='gContenedor_1074';
			document.getElementById('anchoAccesos').className='gContenedor_1074';
			document.getElementById('anchoBotonera').className='gContenedor_1074';
			document.getElementById('anchoSubBotonera').className='gContenedor_1074';
			document.getElementById('anchoPie').className='gContenedorPie_1074';
			document.getElementById('anchoPieEnd').className='gContenedor_1074';
		}else{
			document.getElementById('anchoSecciones').className='gContenedorSecciones_1002';
			document.getElementById('anchoBanners').className='gContenedor_1002';
			document.getElementById('anchoAccesos').className='gContenedor_1002';
			document.getElementById('anchoBotonera').className='gContenedor_1002';
			document.getElementById('anchoSubBotonera').className='gContenedor_1002';
			document.getElementById('anchoPie').className='gContenedorPie_1002';
			document.getElementById('anchoPieEnd').className='gContenedor_1002';
		}
	}
}
window.onresize = windowsresize;

function rollOn(obj){obj.className=obj.className.replace('_Off','_On');}
function rollOff(obj){obj.className=obj.className.replace('_On','_Off');}

function rollLatSolapasOn(id){
	rollOff(document.getElementById('botRecomendados'));
	rollOff(document.getElementById('botMasLeido'));
	rollOff(document.getElementById('botMasComentado'));
	
	document.getElementById('Recomendados').style.display='none';
	document.getElementById('MasLeido').style.display='none';
	document.getElementById('MasComentado').style.display='none';
	
	document.getElementById(id).style.display='block';
	rollOn(document.getElementById('bot'+id));
}

function rollSolapasIndexOn(id){
	rollOff(document.getElementById('botactualidad'));
	rollOff(document.getElementById('botimagenes'));
	rollOff(document.getElementById('botvideos'));
	
	document.getElementById('actualidad').style.display='none';
	document.getElementById('imagenes').style.display='none';
	document.getElementById('videos').style.display='none';
	
	document.getElementById(id).style.display='block';
	rollOn(document.getElementById('bot'+id));
}

function muestraComentario(idComent){
	if(document.getElementById(idComent).style.display=='block'){
		document.getElementById(idComent).style.display='none';
	}else{
		document.getElementById(idComent).style.display='block';
	}
}

function muestraComentarioOver(obj){
	if(obj.style.display=='block'){obj.style.display='none';}else{obj.style.display='block';}
}

function rollSolapasMiPaginaOn(id){
	rollOff(document.getElementById('botTodas'));
	rollOff(document.getElementById('botFavoritas'));
	rollOff(document.getElementById('botMisFotos'));
	
	document.getElementById('Todas').style.display='none';
	document.getElementById('Favoritas').style.display='none';
	document.getElementById('MisFotos').style.display='none';
	
	document.getElementById(id).style.display='block';
	rollOn(document.getElementById('bot'+id));
}

function rollSolapasMiPaginaSeguimientosOn(id){
	rollOff(document.getElementById('botMiembrosquesigo'));
	rollOff(document.getElementById('botMiembrosquemesiguen'));
	
	document.getElementById('Miembrosquesigo').style.display='none';
	document.getElementById('Miembrosquemesiguen').style.display='none';
	
	document.getElementById('Miembrosquesigo1').style.display='none';
	document.getElementById('Miembrosquemesiguen1').style.display='none';
	
	document.getElementById(id).style.display='block';
	document.getElementById(id+'1').style.display='block';
	
	rollOn(document.getElementById('bot'+id));
}

function abrir_foro(){
	document.getElementById('abrir').style.display="";
}
function validar_foro(){
	var ok=true;
	if ((document.comentario.titulo.value=="")&&ok){
		alert("Por favor, introduzca un título");
		ok=false;
	}
	if ((document.comentario.comentario.value=="")&&ok){ 
		alert("Por favor, introduczca el comentario");
		ok=false;
	}
	if ((document.comentario.seccion.value=="")&&ok){
		alert("Por favor, seleccione una categoría"); 
		ok=false;
	}
	if (ok){
		document.comentario.submit();
	}
}

function validar_galeria(){
	var ok=true;
	if ((document.form_galerias_imagenes.nombre.value=="")&&ok){
		alert("Por favor, introduzca un título");
		ok=false;
	}
	if ((document.form_galerias_imagenes.descripcion.value=="")&&ok){ 
		alert("Por favor, introduczca el comentario");
		ok=false;
	}
	if ((document.form_galerias_imagenes.seccion.value=="")&&ok){
		alert("Por favor, seleccione una categoría"); 
		ok=false;
	}
	if (ok){
		document.form_galerias_imagenes.submit();
	}
}
function validar_video(){
	var ok=true;
	if ((document.form_galerias_imagenes.titulo.value=="")&&ok){
		alert("Por favor, introduzca un título");
		ok=false;
	}
	if ((document.form_galerias_imagenes.comentario.value=="")&&ok){ 
		alert("Por favor, introduczca el comentario");
		ok=false;
	}
	if ((document.form_galerias_imagenes.cod_video.value=="")&&ok){ 
		alert("Por favor, introduczca código de video");
		ok=false;
	}
	if ((document.form_galerias_imagenes.seccion.value=="")&&ok){
		alert("Por favor, seleccione una categoría"); 
		ok=false;
	}
	if (ok){
		document.form_galerias_imagenes.submit();
	}
}
function validar_grupo(){
	var ok=true;
	if ((document.comentario.titulo.value=="")&&ok){
		alert("Por favor, introduzca un nombre");
		ok=false;
	}
	if ((document.comentario.comentario.value=="")&&ok){ 
		alert("Por favor, introduczca una descripcion");
		ok=false;
	}
	if ((document.comentario.seccion.value=="")&&ok){
		alert("Por favor, seleccione una categoría"); 
		ok=false;
	}
	if (ok){
		document.comentario.submit();
	}
}

function validar_anuncio(){
	var ok=true;
	isPrice=/^\d*(?:\,\d{0,2})?$/;
	if ((document.comentario.titulo.value=="")&&ok){
		alert("Por favor, introduzca un título");
		ok=false;
	}
	if ((document.comentario.comentario.value=="")&&ok){ 
		alert("Por favor, introduczca el comentario");
		ok=false;
	}
	if ((document.comentario.seccion.value=="")&&ok){
		alert("Por favor, seleccione una categoría"); 
		ok=false;
	}
	if ((document.comentario.subtipo.value=="")&&ok){
		alert("Por favor, seleccione un tipo de anuncio"); 
		ok=false;
	}
	if ((document.comentario.precio.value=="")&&ok){
		alert("Por favor, indique el precio del artículo"); 
		ok=false;
	}
	if (!(isPrice.test(document.comentario.precio.value))&&ok){
		alert("El precio del artículo debe ser una cifra con el formato XXXX,XX"); 
		ok=false;
	}
	if (ok){
		document.comentario.submit();
	}
}

function recargaProvincias(){
	if (document.getElementById('pais').options[document.getElementById('pais').selectedIndex].value=='1'){
		document.getElementById('provincia').disabled=false;
	}else{
		document.getElementById('provincia').selectedIndex=0;
		document.getElementById('provincia').disabled="true";
	}
}
function recarga_dias(mes,dia){
	if (dia >= 30){
		var form = document.formNuevo;
		form.dia.length = 0;
		
		var limite = 31;
		if (mes == "4" || mes == "6" || mes == "9" || mes == "11"){
			limite = 30;
		}
		if (mes == "2"){
			limite = 28;
		}
		
		var optionName = new Option("Día:", "", false, false)
		var length = form.dia.length;
		form.dia.options[length] = optionName;
		
		for (i = 1; i <= limite; i++){
			var optionName = new Option(i, i, false, false)
			var length = form.dia.length;
			form.dia.options[length] = optionName;
		}
	}
}

function validaComentario(){
	var ok=true;
	if ((document.frm_enviaComent.texto.value=="")&&ok){
		alert("Por favor, introduzca su comentario");
		ok=false;
	}
	if (ok){
		document.frm_enviaComent.submit();
	}
}

function checkAll(obj){
	if (obj.value == 1){
		for (i=0;i<document.frmAcciones.elements.length;i++)
      if(document.frmAcciones.elements[i].type == "checkbox")
         document.frmAcciones.elements[i].checked=1 
	}
	if (obj.value == 0){
		for (i=0;i<document.frmAcciones.elements.length;i++)
      if(document.frmAcciones.elements[i].type == "checkbox")
         document.frmAcciones.elements[i].checked=0 
	}
}

function buzonMarcarLeido(){
	document.frmAcciones.accion.value = "marcar";
	document.frmAcciones.submit();
}

function buzonMarcarNoLeido(){
	document.frmAcciones.accion.value = "desmarcar";
	document.frmAcciones.submit();
}

function buzonBorrar(){
	if (confirm("¿Desea eliminar los mensajes selecionados?")){
		document.frmAcciones.accion.value = "borrar";
		document.frmAcciones.submit();
	}
}
function eliminarFoto(){
	document.formCuenta.eliminar_foto.value="si";
	document.formCuenta.submit();
}

function limpiar_mensaje(form){
	//form.nombre.value='';
	form.asunto.value='';
	form.texto.value='';
}

function validar_mensaje(form){
	if (form.texto.value == ""){
		alert("No puede enviar vacío el campo mensaje");
	}
	else{
		form.submit();
	}
}

function eliminarContenido(form){
	if (confirm("¿Desea eliminar este contenido?")){
		form.accion.value = "borrar";
		form.submit();
	}
}

function abrirRespuesta(){
	document.getElementById('respuesta').style.display="";
	
}
