// JavaScript Document

function alterProces(num){
	document.getElementById('tdProcess1').className='procesOff';
	document.getElementById('tdProcess2').className='procesOff';
	document.getElementById('tdProcess3').className='procesOff';
	document.getElementById('tdProcess4').className='procesOff';

	document.getElementById('divProcess1').className='divProcesOff';
	document.getElementById('divProcess2').className='divProcesOff';
	document.getElementById('divProcess3').className='divProcesOff';
	document.getElementById('divProcess4').className='divProcesOff';
	
	document.getElementById('tdProcess'+num).className='procesOn';
	document.getElementById('divProcess'+num).className='divProcesOn';
	
	//document.getElementById('proceso').value=num;
}

function continuarAltaSeccion(){
	document.forms.altaSeccion.submit();
}

function continuarAltaSeccionImagenes(){
	var strImg='';
	for(i=0;i<imagenes.length;i++){
		if(i==imagenes.length-1){
			strImg+=imagenes[i];
		}else{
			strImg+=imagenes[i]+'#';
		}
	}
	document.getElementById('imagenes').value=strImg;
	document.forms.altaSeccion.submit();
}
function anteriorAltaSeccion(){
	document.getElementById('accion').value=-1;
	document.forms.altaSeccion.submit();
}

function bajaCotenido(idC){
	var conf=confirm('Esta seguro que desea dar de baja este contenido?');
	if(conf==1){
		document.forms.formGestion.idcontenido.value=idC;
		document.forms.formGestion.action="eliminar_seccion.php";
		document.forms.formGestion.submit();
	}
}


function ordenar(idC,orden,num){
	document.forms.formGestion.idcontenido.value=idC;
	document.forms.formGestion.orden.value=orden;
	document.forms.formGestion.action="ordenar_seccion.php";
	document.forms.formGestion.submit();
}

function modificaCotenido(idC){
	document.forms.formGestion.idcontenido.value=idC;
	document.forms.formGestion.action="alta_seccion_datos.php?mod=1&id="+idC;
	document.forms.formGestion.submit();
}

function validaFormContacto(){
	if(document.forms.form1.nombre.value==''){
		alert('El campo nombre es obligatorio.');
		return false;
	}
	if(document.forms.form1.telefono.value==''){
		alert('El campo telefono es obligatorio.');
		return false;
	}
	if(document.forms.form1.email.value==''){
		alert('El campo email es obligatorio.');
		return false;
	}
	document.forms.form1.submit();
}

function modificarDatosUsuario(){
	if(document.forms.guardar.usuario.value==''){
		alert('El campo usuario es obligatorio.');
		return false;
	}
	if(document.forms.guardar.nuevo_password.value!=''){
		if(document.forms.guardar.password.value==''){
			alert('El campo password no puede estar vacio.');
			return false;
		}else{
			if(document.forms.guardar.nuevo_password.value!=document.forms.guardar.conf_password.value){
				alert('Confirmación de password incorrecta.');
				return false;	
			}
		}
	}
	if(document.forms.guardar.email.value==''){
		alert('El campo correo electronico es obligatorio.');
		return false;
	}
	document.forms.guardar.submit();
}

function cargarSeccion(idContenido){
	document.getElementById('idcontenido').value=idContenido;
	document.forms.cargar.submit();
}

function irContacto(){
	document.forms.cargar.action="contacto.php";
	document.forms.cargar.submit();
}

function cargarIdioma(lang){
	if(document.getElementById('idioma')!=null){
		document.getElementById('idioma').value=lang;
	}
	if(document.getElementById('idcontenido')!=null){
		document.getElementById('idcontenido').value=-1;
	}
	document.forms.cargar.submit();
}

function cambiaEstado(idC,obj){
	document.forms.formGestion.idcontenido.value=idC;
	if(obj.checked){
		document.forms.formGestion.estado.value=1;
	}else{
		document.forms.formGestion.estado.value=0;
	}
	
	document.forms.formGestion.action="cambio_estado.php";
	document.forms.formGestion.submit();
}



