function validar() {	
	
	var vad = true;	
	var color_invad = '#FF0000';
	var color_obli = '#CAE8CC';
	
	getElement('i001').style.background=color_obli;
	getElement('i001').style.color='#000000';
	getElement('i002').style.background=color_obli;
	getElement('i002').style.color='#000000';
	getElement('i003').style.background=color_obli;
	getElement('i003').style.color='#000000';
	getElement('i004').style.background=color_obli;
	getElement('i004').style.color='#000000';
	getElement('i005').style.background=color_obli;
	getElement('i005').style.color='#000000';
	getElement('i008').style.background=color_obli;
	getElement('i008').style.color='#000000';
	getElement('i009').style.background=color_obli;
	getElement('i009').style.color='#000000';
	getElement('i010').style.background=color_obli;
	getElement('i010').style.color='#000000';
	getElement('i011').style.background=color_obli;
	getElement('i011').style.color='#000000';
	getElement('i012').style.background=color_obli;
	getElement('i012').style.color='#000000';
	getElement('i013p1').style.background=color_obli;
	getElement('i013p1').style.color='#000000';
	getElement('i013a1').style.background=color_obli;
	getElement('i013a1').style.color='#000000';
	getElement('i013t1').style.background=color_obli;
	getElement('i013t1').style.color='#000000';
	getElement('i0151').style.background=color_obli;
	getElement('i0151').style.color='#000000';
	getElement('i027').style.background=color_obli;
	getElement('i027').style.color='#000000';
	getElement('i028').style.background=color_obli;
	getElement('i028').style.color='#000000';
	getElement('i029').style.background=color_obli;
	getElement('i029').style.color='#000000';
	
	if(getElement('i001').value==''){//Valida el nombre
		//adv();
		getElement('i001').style.background=color_invad;
		getElement('i001').style.color='#FFFFFF';
		//getElement('i001').focus();
		vad = false;
	}
	
	if(getElement('i002').value==''){//Valida la sigla
		//adv();
		getElement('i002').style.background=color_invad;
		getElement('i002').style.color='#FFFFFF';
		//getElement('i002').focus();
		vad = false;
	}
	
	if(getElement('i003').selectedIndex==0){//Valida definicion legal
		//adv();
		getElement('i003').style.background=color_invad;
		getElement('i003').style.color='#FFFFFF';
		//getElement('i003').focus();
		vad = false;
	}
	
	if(getElement('i004').selectedIndex==0){//Valida Sector
		//adv();
		getElement('i004').style.background=color_invad;
		getElement('i004').style.color='#FFFFFF';
		//getElement('i004').focus();
		vad = false;
	}
	
	if(getElement('i005').value==''){//Valida la dependencia institucional
		//adv();
		getElement('i005').style.background=color_invad;
		getElement('i005').style.color='#FFFFFF';
		//getElement('i005').focus();
		vad = false;
	}
	
	if(getElement('i008').value==''){//
		//adv();
		getElement('i008').style.background=color_invad;
		getElement('i008').style.color='#FFFFFF';
		//getElement('i005').focus();
		vad = false;
	}
	
	if(getElement('i009').value==''){//
		//adv();
		//adv();
		getElement('i009').style.background=color_invad;
		getElement('i009').style.color='#FFFFFF';
		//getElement('i005').focus();
		vad = false;
	}
	
	if(getElement('i010').value==''){//
		//adv();
		getElement('i010').style.background=color_invad;
		getElement('i010').style.color='#FFFFFF';
		//getElement('i005').focus();
		vad = false;
	}
	
	if(getElement('i011').selectedIndex==0){//Valida pais
		//adv();
		getElement('i011').style.background=color_invad;
		getElement('i011').style.color='#FFFFFF';
		//getElement('i005').focus();
		vad = false;
	}
	
	if(getElement('i012').value==''){//
		//adv();
		getElement('i012').style.background=color_invad;
		getElement('i012').style.color='#FFFFFF';
		//getElement('i005').focus();
		vad = false;
	}
	
	if(getElement('i013p1').value==''){//
		//adv();
		getElement('i013p1').style.background=color_invad;
		getElement('i013p1').style.color='#FFFFFF';
		//getElement('i005').focus();
		vad = false;
	}
	
	if(getElement('i013a1').value==''){//
		//adv();
		getElement('i013a1').style.background=color_invad;
		getElement('i013a1').style.color='#FFFFFF';
		//getElement('i005').focus();
		vad = false;
	}
	
	if(getElement('i013t1').value==''){//
		//adv();
		getElement('i013t1').style.background=color_invad;
		getElement('i013t1').style.color='#FFFFFF';
		//getElement('i005').focus();
		vad = false;
	}
	
	if(getElement('i0151').value==''){//
		//adv();
		getElement('i0151').style.background=color_invad;
		getElement('i0151').style.color='#FFFFFF';
		//getElement('i0151').focus();
		vad = false;
	}
	
	if(getElement('i0161').value==''){//
		//adv();
		getElement('i0161').style.background=color_invad;
		getElement('i0161').style.color='#FFFFFF';
		//getElement('i0151').focus();
		vad = false;
	}
	
	if(getElement('i027').value==''){//
		//adv();
		getElement('i027').style.background=color_invad;
		getElement('i027').style.color='#FFFFFF';
		//getElement('i0151').focus();
		vad = false;
	}
	
	if(getElement('i028').value==''){//
		//adv();
		getElement('i028').style.background=color_invad;
		getElement('i028').style.color='#FFFFFF';
		//getElement('i0151').focus();
		vad = false;
	}
	
	if(getElement('i029').value==''){//
		//adv();
		getElement('i029').style.background=color_invad;
		getElement('i029').style.color='#FFFFFF';
		//getElement('i0151').focus();
		vad = false;
	}
	
	if (!vad) {
		alert("Ha dejado vacío uno o varios campos obligatorios, estos campos ahora están pintados de rojo.");
		window.location.href='#';
	}
	return (vad);
}
function adv(){
	getElement('adv').style.visibility='visible';
	return;
}