function setOver(obj){
	obj.className = obj.className + " hover";
	}
	
function clearOver(obj){
	obj.className = obj.className.replace(" hover", "");
	}
	
function show(obj){
	obj.className = obj.className.replace("hide", ""); 
}

function hide(obj){
	obj.className = obj.className + " hide"; 
}

function changeVisibility(obj, anim)
{
	anim = anim | false;
	if(obj.className.indexOf("hide") == -1 || $(obj).is(':visible'))
	{
		if(!anim) hide(obj)
		else $(obj).slideUp('normal');
	}
	else{
		if(!anim) show(obj)
		else $(obj).slideDown('normal');
	}
}
	
function showList(){
	//obj = document.getElementById(id);
	list = this.getElementsByTagName("ul");
	if( list.length != 0 ){
		list[0].className = list[0].className.replace("hide", ""); 	
	}
}

function hideList(){	
	list = this.getElementsByTagName("ul");
	if( list.length != 0 ){
		list[0].className = list[0].className + " hide";
	}
}

function setMenuProperties(){
	listElems = document.getElementById("main_nav");
	cleanWhitespace(listElems);
	for(i=0; i<listElems.childNodes.length; i++)
	{
		addEvent(listElems.childNodes[i], "mouseover", showList);
		addEvent(listElems.childNodes[i], "mouseout", hideList);
	}
}


/*
  * Function: INIT
  * Inicializamos todas las variables, menús,...
  */
function init(){
	setMenuProperties()
}

$(document).ready(function() {init();});



/* VALIDACIONES */
function valida(oForm, info){
	
	with (document.getElementById(oForm)){
		content.className = "campo";
		email.className = "campo";
		nombre.className = "campo";
		oDivInfo = document.getElementById(info);
		if(nombre.value == ""){
			oDivInfo.innerHTML = falta_nombre;
			$(oDivInfo).fadeIn('normal');
			oDivInfo.className = "campo error";
			nombre.className = "campo error";
			nombre.focus();
		}
		else if(email.value.indexOf('@') == -1){
			oDivInfo.innerHTML = falta_correo;
			$(oDivInfo).fadeIn('normal');
			oDivInfo.className = "campo error";
			email.className = "campo error";
			email.focus();
		}
		else if(content.value.length<1){ 
			oDivInfo.innerHTML = falta_texto;
			$(oDivInfo).fadeIn('normal');
			oDivInfo.className = "campo error";
			content.className = "campo error";
			content.focus();
		}
		else submit()
	}
}