// <![CDATA[
$(document).ready(function(){
	
	$("#ulShowSubmenu").css("display","none");
	$(function(){
		$("li[class=menu]").mouseover(function(evt){
			$("#ulShowSubmenu").html('');
			$("#ulShowSubmenu").css("display","none");
			var submenu =$(this).find("ul[class=submenu]");
			if(submenu.html()!=null){
				if($("#ulShowSubmenu")!=null && $("#ulShowSubmenu").html()=='' ){
					$("#ulShowSubmenu").append(submenu.html());
				}	
			}
			$("#ulShowSubmenu li.submenu").css('background','none');
			$("#ulShowSubmenu").css("display","block");
		});
		
		$("#ulShowSubmenu").mouseover(function(evt){
			$("#ulShowSubmenu").css("display","block");
		});
		
		$("#ulShowSubmenu").mouseout(function(evt){
			$("#ulShowSubmenu").css("display","none");
		});

				
	});
	
	$(".form-row input, .form-row textarea").focusin(function(){
		$(this).parent(".inner  , li").animate({ backgroundColor: '#EEEEEE' }, 300);
	});
	$(".form-row input, .form-row textarea").focusout(function(){
		$(this).parent(".inner , li").animate({ backgroundColor: '#fff' }, 300);
	});	
});

function alertMessage(value){
		alert(value);	
}

function externalLinks() {
	if (!document.getElementsByTagName) return;
	
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
			anchor.target = "_blank";
			if(!anchor.title.match(/(Se abre en nueva ventana)/)){
				anchor.title += " (Se abre en nueva ventana)";
			}
		}
	}
}

function comprobarId() {
	var user=document.getElementById("usu");
	var password=document.getElementById("pass");
	var res = true; 
	if (user.value.length < 1) {
	 	 alert("Debe rellenar el campo usuario");
	 	 res=false;
	 } else {
	 	if (password.value.length < 1) {
	 		 alert("Debe rellenar el campo clave");
	 		 res=false;
	 	}
	 } 
	 return res;
}

function displayNewsDetail(valor) {
	var detalle = document.getElementById("newsDetail");
	var detalle2 = document.getElementById("newsDetail2");
	if (valor) {
		detalle.className = "visible";
		detalle2.className = "oculto";
	}
	else {
		detalle.className = "oculto";
		detalle2.className = "visible";
	}		
}

 
function clean(inForm){	
	$(':input','#'+inForm+'')
	 .not(':button, :submit, :reset, :hidden')
	 .val('')	 
	 .removeAttr('checked')	 
	 .removeAttr('selected');
	$("label").removeClass('checked');
}


//]]>
