// JavaScript Document

window.onload = function() {
			var menuTitle = document.getElementsByClassName('menutitle');
			var menuOpen = document.getElementsByClassName('expand');			
			if (typeof(lastclicked) != "undefined"){
				if (lastclicked>-1)
					menuOpen[lastclicked].style.display="block";
			}
}


function muestra1 (objeto,muestra,activa) {
	document.getElementById(objeto).style.display=muestra;
}

function otro(elemento){
	if(elemento.value=='otro'){
	 	document.getElementById('otroso').style.display='block';
	} else {
	 	document.getElementById('otroso').style.display='none';
	}
}

function comprueba(){
	bien=1;
	if (!document.getElementById('empresa').value) {document.getElementById('empresa').style.border='2px solid #F00';bien=0;} else {document.getElementById('empresa').style.border='1px solid #66';}
	if (!document.getElementById('cif').value) {document.getElementById('cif').style.border='2px solid #F00';bien=0;} else {document.getElementById('cif').style.border='1px solid #666';}
	if (!document.getElementById('contacto').value) {document.getElementById('contacto').style.border='2px solid #F00';bien=0;} else {document.getElementById('contacto').style.border='1px solid #666';}
	if (!document.getElementById('email').value) {document.getElementById('email').style.border='2px solid #F00';bien=0;} else {document.getElementById('email').style.border='1px solid #666';}
	if (bien==0) {
		alert('Los campos \n - Empresa\n - Cif\n - Persona de contacto\n - E-mail \nSon obligatorios');
		return false;
	} else {
		return true;
	}
}

function muestra (llamador,objeto) {
		//alert(document.getElementById(llamador.id).nextSibling.nextSibling.nodeName);
 		//alert(llamador.nextSibling.nextSibling.nodeName
		//llamador.nextSibling.nextSibling.disabled="true";
	
		if (!llamador.checked) {
      //target.style.listStyleImage = 'url(http://msdn.microsoft.com/msdn-online/shared/graphics/plus.gif)';
			 document.getElementById(objeto).style.display = 'none';
      objeto.expanded = false;
    }
    else {
      //target.style.listStyleImage = 'url(http://msdn.microsoft.com/msdn-online/shared/graphics/minus.gif)';
      document.getElementById(objeto).style.display = 'block';
      objeto.expanded = true;
    }
}

function alterna(id){
 if(document.getElementsByTagName){  
   var elemento = document.getElementById(id);  
   var filas = elemento.getElementsByTagName("div");  
	 alert(filas.length);
   for(i = 0; i < filas.length; i++){  
	         
	 //manipulamos las filas
     if(i % 2 == 0){
       filas[i].className = "par";
     }else{
       filas[i].className = "impar";
     }      
   }
 }
}

/*function mostrar_ocultar(id){
		if (document.getElementById(id).style.display=='none') document.getElementById(id).style.display='block';
		else document.getElementById(id).style.display='none';
}*/
	
function muestra_o(id) {
	var d = document.getElementById(id);
		for (var i = 1; i<=10; i++) {
			if (document.getElementById('doc'+i)) {document.getElementById('doc'+i).style.display='none';}
		}
	if (d) {d.style.display='block';}
}

var VentanaPopUp=0;

function ventana(URL,ancho, alto, scrll)
{
	izda=(screen.width-ancho)/2;
	arriba=(screen.height-alto)/2;
  if(VentanaPopUp)
  {
    if(!VentanaPopUp.closed) VentanaPopUp.close();
  }
  VentanaPopUp = open(URL, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scrll+',resizable=no,copyhistory=yes,width='+ancho+',height='+alto+',left='+izda+', top='+arriba+',screenX='+izda+',screenY='+arriba+'');
}


function aceptar_clausula(){
	var f = document.dp1; //f es el formulario
	if (f.chk.checked==true) //f.chk es el checkbox
		f.chkbutton.disabled=false;	//y f.chkbutton es el boton de Aceptar
	else 
		f.chkbutton.disabled=true;		
}