function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// Para mostrar/ocultar capas
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

//cambia las propiedades del boton
function cambiaBotonOver(id){
	id.style.color = "#59A4FB";	
}
function cambiaBoton(id){
	id.style.color =  "#033773";
}
function cambiaBotonGris(id){
	id.style.color =  "#ACACAC";
}
//cambia las propiedades del boton formato tabla
function cambiaBotonOver_t(id){
	id.style.border = "2px";
	id.style.borderColor = "#59A4FB";
	id.style.borderStyle = "ridge";
	id.style.color = "#59A4FB";	
}
function cambiaBotonDown(id){
	id.style.border = "1px";
	id.style.borderColor = "#59A4FB";
	id.style.borderStyle = "ridge";
	id.style.color = "#59A4FB";	
}
function cambiaBoton_t(id){
	id.style.border = "2px";
	id.style.borderColor = "#033773";
	id.style.borderStyle = "ridge";
	id.style.color =  "#033773";
}

function hover(tab){
//	tab.style.backgroundColor = '#FFFFFF';
	tab.style.color = '#FFFFFF';
	tab.style.background = 'url(../images/TAB_ON_prop.gif)';
}
function activo(tab,num){
	if (currentPanel != num){
		hover(tab);
	}
}
function setState(tab){
	//document.getElementById('tab'+tabNum).style.color = '#FFFFFF';
	tab.style.color = '#FFFFFF';
	tab.style.background = 'url(../images/TAB_OFF.gif)';
}
function desactivo(tab,num){
	if (currentPanel != num){
		setState(tab);
	}
}
function hover2(tab){
	tab.style.color = '#FFFFFF';
	tab.style.background = 'url(../images/TAB_ON_prop.gif)';
}
function setState2(tab){
	tab.style.color = '#595959';
	tab.style.background = 'url(../images/TAB_OFF.gif)';
}
function activo2(tab,num){
	if (currentPanel != num){
		hover2(tab);
	}
}
function desactivo2(tab,num){
	if (currentPanel != num){
		setState2(tab);
	}
}
function ocultaTodo(){
	switch(currentPanel) 
	{ 
		case 1: {
				document.getElementById('tab1').style.background = "url(../images/TAB_ON_prop.gif)";
				document.getElementById('tab2').style.background = "url(../images/TAB_OFF.gif)";
				document.getElementById('tab3').style.background = "url(../images/TAB_OFF.gif)";
				document.getElementById('tab4').style.background = "url(../images/TAB_OFF.gif)";
				break; 
			}
		
		case 2: {
				document.getElementById('tab1').style.background = "url(../images/TAB_OFF.gif)";
				document.getElementById('tab2').style.background = "url(../images/TAB_ON_prop.gif)";
				document.getElementById('tab3').style.background = "url(../images/TAB_OFF.gif)";
				document.getElementById('tab4').style.background = "url(../images/TAB_OFF.gif)";
				break;
			}
		
		case 3: {
				document.getElementById('tab1').style.background = "url(../images/TAB_OFF.gif)";
				document.getElementById('tab2').style.background = "url(../images/TAB_OFF.gif)";
				document.getElementById('tab3').style.background = "url(../images/TAB_ON_prop.gif)";
				document.getElementById('tab4').style.background = "url(../images/TAB_OFF.gif)";
				break;
			}
		case 4: {
				document.getElementById('tab1').style.background = "url(../images/TAB_OFF.gif)";
				document.getElementById('tab2').style.background = "url(../images/TAB_OFF.gif)";
				document.getElementById('tab3').style.background = "url(../images/TAB_OFF.gif)";
				document.getElementById('tab4').style.background = "url(../images/TAB_ON_prop.gif)";
				break;
			}
	}
}
function SwitchMenu(obj1,obj2){
	if(document.getElementById){
		var el = document.getElementById(obj2);
		var ar = document.getElementsByTagName("span");
		if(el.style.display != "block"){
			/*for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") 
				ar[i].style.display = "none";
			}*/
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
		var el2 = document.getElementById(obj1);
		el2.style.display = "none";
		if (obj1.search("_abajo")==-1){
			var el3 = document.getElementById(obj1+"_abajo");
			el3.style.display = "block";
		}else{
			var el3 = document.getElementById(obj1.replace("_abajo",""));
			el3.style.display = "block";
		}
	}
}
function SwitchSubmenu(obj2){
	i=0;
	if(document.getElementById){
		while (document.getElementById(obj2+i)!=undefined){	
			var el = document.getElementById(obj2+i);
			if(el.style.display != "block"){
				el.style.display = "block";
			}else{
				el.style.display = "none";
			}
			i++;
		}
	}
}
function tiposCampo(tipo,campoF){
	var todoBien = true;
	switch (tipo) {
		case "a":{
			//alfanumérico
			break;
		}
		case "n":{
			//número entero
			if (!fEsEntero(campoF)){
				todoBien = false;				
			}
			break;
		}
		case "r":{
			//número real
			if (!fEsReal(campoF)){
				todoBien = false;				
			}
			break;
		}
		case "f":{
			//fecha
			if (!fEsFecha(campoF)){
				todoBien = false;				
			}
			break;				
		}
		case "s":{
			//texto - sólo letras
			if (!validaLetras(campoF)){
				todoBien = false;				
			}
			break;			
		}
		case "e":{
			//email
			if (!fValidarEmail(campoF)){
				todoBien = false;				
			}
			break;
		}
		case "t":{
			//teléfono
			if (!fEsTelefonoValido(campoF)){
				todoBien = false;				
			}
			break;
		}
		case "m":{
			//matrícula
			break;
		}
		case "d":{
			//dni - cif - nif -...
			if (!fEsDNI(campoF)){
				todoBien = false;				
			}
			break;
		}
		case "c":{
			//código postal, número entero mayor-igual de 5 posiciones.
			if (fEsEntero(campoF)){
				if (campoF.value.length<5){
					todoBien = false;
				}
			}else{
				todoBien = false;
			}
			break;
		}
		case "l":{
			//listas-combos.
			break;
		}
	}	
	return todoBien;
}