/****
	Muestra o oculta un span o div con ID.
	Solo para IE. Respeta el texto. Tablas completas.
*****/



/**************************************************************************
JAVASCRIPT BARRA ESTADO
***************************************************************************/


var txtStatus='Bienvenido al portal web Albamar';
var timeEspera=200;  // tiempo que ha de esperar entre carácter y carácter
var recarga=false;      // si ha de reiniciarse cuando termina (true/false)

function correStatus(posStatus){
  if (posStatus < txtStatus.length){
    posStatus+=1
    window.status=txtStatus.substring(0,posStatus)}
   else  {if (!recarga) return true; else posStatus=0}
   setTimeout("correStatus("+posStatus+")",timeEspera)}
  
correStatus(0)
  




<!--  

   var i = 0; 

   var TextNumber = 0;

   var TextInput = new Object();

   var HelpText="";                              

   var Text = "";  

   var Speed=400

   var WaitSpace="           "                 


TextInput[0] = "Bienvenido a la web de Punzano Hijos";  

TextInput[1] = "Tu portal inmobiliario";

TextInput[2] = "Gracias por visitarnos";

TextInput[3] = "www.punzano-hijos.es";


TotalTextInput = 2; // (0, 1, 2, 3, 4)


for (var addWait = 0; addWait <= TotalTextInput; addWait++) 

   { TextInput[addWait]+=WaitSpace; }

	

var TimerId

var TimerSet=false;


function startBanner (form)  

   {

   if (!TimerSet)

      {

      TimerSet=true;

      banner();

      }

   }


function banner() 

   {

   Text=rollMessage();

   TimerId = setTimeout("banner()", Speed);

   window.status=Text;

   }


function rollMessage () 

   {

   Wait_yn=false;

   i++;

   var CheckSpace = HelpText.substring(i-1, i);

   CheckSpace = "" + CheckSpace;

   if (CheckSpace == " ") 

      {i++;}

   if (i >= HelpText.length+1) 

      {

      i=0; 

      if (TextNumber < TotalTextInput) 

         {TextNumber++;} 

      else 

         {TextNumber = 0;} 

      initBanner();

      }

   Text = HelpText.substring(0, i);

   return (Text);

   }


function initBanner() 

   {

   Text = TextInput[TextNumber];

   HelpText = Text;

   startBanner ();


   }










var ns6=document.getElementById&&!document.all?1:0
var head="display:''"
var elemento=''
var elemento2=''



function expandit_b(curobj){

	folder=ns6?curobj.nextSibling.nextSibling.style:document.all[curobj.sourceIndex+2].style
		
	if (folder.display=="none")
		folder.display=""
	else
		folder.display="none"
}

// Función que expande los elementos del menú cuando estamos en el HOME
function expandir(id){
		
	elemento2 = document.getElementById(""+id+"").style;
	
	if (elemento2.display=="none"){
		cierratodos();
		elemento2.display="";}
	else
		elemento2.display="none";
}


// Función que expande los elementos del menú cuando estamos en un PRODUCTO
function expandit(id,fijo){
if (fijo==0){
	expandithome(id);
}else{
	cierratodos();
		
	folder = document.getElementById(""+id+"").style;
	folderopen=document.getElementById(""+fijo+"").style;
	
	if (folder.display=="none"){
		folder.display="";}
	else{
		folder.display="none";}
		
		folderopen.display="";
		
}		
}

function cierratodos(){
	id='empresa';
	elemento = document.getElementById(""+id+"").style;
	elemento.display="none";
	id='promociones';
	elemento = document.getElementById(""+id+"").style;
	elemento.display="none";
	
	
}



//función que comprueba que los campos obligatorios se rellenen
	function verificar(f) {
	 	
	 	var cam=f.elements;
	 	
		//Filtro para comprobar que TODAS las casillas están rellenadas
		for(i=1;i<=4;i++){
			//alert(cam[i].value);
			if(cam[i].value=="" || cam[i].value==null || esblanca(cam[i].value)){
				alert("Debe de rellenar todos los campos obligatorios");
				return false;
				}			
			}
		
		/*
		// Validación de las casillas de texto
		var er_texto=/[a-zA-Z0-9]+/;
		var texto;		
		for(i=0;i<4;i++)
			{
			texto=cam[i].value.search(er_texto);
			if(texto==-1){
						 alert("¡¡ERROR!!.\nLa casilla "+i+" no es correcta")
						 return false;
						 }
			}
		

		// Validacion del DNI
		var er_DNI=/[0-9]{1,9}/;
		var DNI=cam[4].value.search(er_DNI);
		if(DNI==-1){
				   alert("¡¡ERROR!!.\nEl DNI no es correcto");
				   return false;
				   }
		*/		
		   			 
		// Validación de la casilla de email
		var er_correo=/[a-z][a-z0-9]*\@([a-z]*\.)+[a-z]+/;
		var correo=cam[4].value.search(er_correo);	
		if(correo==-1){
					  alert("El formato de la dirección de correo no es correcto\nFormato: nombre@direccion.dominio");
					  return false;
					  }
					  
		// Validacion de las casillas de los teléfonos
		var er_telef=/[0-9]*/;
		var telef1=cam[5].value.search(er_telef);
		
		if(telef1==-1 ){
			alert("El teléfono  solo puede contener caracteres numéricos");
			return false;
			}
			
		/*
		var telef2=cam[7].value.search(er_telef);
		if(telef2==-1 ){
			alert("¡¡ERROR!!.\nEl valor del teléfono 2 no es válido!\nDeben de ser 9 némeros");
			return false;
			}
		//alert("telef1 ="+telef1+"   telef2 ="+telef2);					
					  
		//Validación de las casillas de la contraseña
		var er_contrasenya=/[a-zA-Z][0-9]|[0-9][a-zA-Z]|[a-zA-Z0-9]{3,}/;
		var contrasenya=cam[8].value.search(er_contrasenya);
		if(contrasenya==-1){
						   alert("¡¡ERROR!!.\nEl formato de la contraseña no es correcto\nDeben de ser números o letras (al menos 1 número y una letra)");
						   return false;
						   }
						   
		if(cam[8].value!=cam[9].value)
			{
			alert("¡¡ERROR!!.\nLa verificación de la contraseña debe de\ncoincidir con la contraseña"); 
			return false;
			}
			
		//alert("A continuación se enviarán los datos");
		*/return true;
		}
	
	function esblanca(s) { // Devuelve true si el string es blanco
		for (var i=0; i<s.length; i++) {
			var c= s.charAt(i);
			if ((c!= ' ') && (c!= '\n') && (c!='')) return false;
		}
		
		return true; 
	}


//función que comprueba que los campos obligatorios se rellenen
function verificar_es_numero(f) {
	 	
	 	var cam=f.elements;
	 	
		//Filtro para comprobar que TODAS las casillas están rellenadas
		for(i=0;i<=1;i++){
			if(cam[i].value=="" || cam[i].value==null || esblanca(cam[i].value)){
				alert("Debe de rellenar todos los campos");
				return false;
				}			
			}
		

		var er_numero=/\W|[A-Za-z]/;
		var numero=cam[0].value.search(er_numero);
		if(numero!=-1){
				   alert("¡¡ERROR!!.\nNo es un numero");
				   return false;
				   }
		return true;
		}

// Función que muestra Alquiler/Compra cuando se selecciona garaje o local comercial
function mostrarAlquilerCompra(id,tipo){
		
	elemento2 = document.getElementById(""+id+"").style;
	opcionElegida=document.getElementById(""+tipo+"").selectedIndex;		


	if (opcionElegida==0){
		elemento2.display="none";}
	else
		elemento2.display="";
}

function pathDefecto(nombre){
	var nodeList = document.getElementById("altaPromocion");
		
	nodeList["path_logo"].value="imagenes/administrador/Promociones/"+nombre+"/presentacion/logo_peq.jpg";
	nodeList["path_fachada"].value="imagenes/administrador/Promociones/"+nombre+"/presentacion/fachada_peq.jpg";
	nodeList["path_logo_grande"].value="imagenes/administrador/Promociones/"+nombre+"/presentacion/logo_grande.jpg";
	nodeList["path_fachada_grande"].value="imagenes/administrador/Promociones/"+nombre+"/presentacion/fachada_grande.jpg";
	nodeList["plano_situacion"].value="imagenes/administrador/Promociones/"+nombre+"/situacion/situacion.jpg";
	nodeList["plano_situacion_flash"].value="imagenes/administrador/Promociones/"+nombre+"/situacion/situacion.swf";
	nodeList["memoria_calidades"].value="imagenes/administrador/Promociones/"+nombre+"/memoriaCalidades/memoria.pdf";
	nodeList["planos_promocion"].value="imagenes/administrador/Promociones/"+nombre+"/planos/";
	nodeList["fotos_promocion"].value="imagenes/administrador/Promociones/"+nombre+"/fotos/";
	nodeList["planos_garajes_libres"].value="imagenes/administrador/Promociones/"+nombre+"/planos_garaje/";
	nodeList["planos_locales_libres"].value="imagenes/administrador/Promociones/"+nombre+"/planos_locales/";
	


}








function insertarFilasFotos(nomTabla,numero) {
	  
	numero= prompt("Introduce el numero de Fotos (filas) a añadir", 0);

	//cogemos el numero de lineas actual de la tabla
	tbody = document.getElementById(nomTabla).firstChild;
	filasTabla = tbody.childNodes.length

	valor=0;
	//ver que no hayan repetidas
	for (i=1;i<tbody.childNodes.length;i++)
		{
		if (valor<=tbody.childNodes[i].firstChild.firstChild.firstChild.value)
			valor=tbody.childNodes[i].firstChild.firstChild.firstChild.value;
		}
	valor++;
	
	for (i=0;i<numero;i++)
	{
	nuevoDiv0 = document.createElement("div");
	nuevoDiv0.innerHTML = "<input type='text' size='3' name='numeroFoto[]' value="+(valor+i)+">";
	nuevoDiv1 = document.createElement("div");
	nuevoDiv1.innerHTML = "<input type='file' size='30' name='fotoElegida[]'>";
	nuevoDiv2 = document.createElement("div");
	nuevoDiv2.innerHTML = "<input type='text' size='70' name='descripcionFoto[]'>";
	
	
	   //crea la fila en memoria
	   //primero crea las celdas
	   celda0 = document.createElement("td");
	   celda1 = document.createElement("td");
	   celda2 = document.createElement("td");
	
		celda0.align="center";
		celda1.align="center";
		celda2.align="center";
		
	//celda1.appendChild(document.createTextNode(nuevoDiv));
	   celda0.appendChild(nuevoDiv0);
	   celda1.appendChild(nuevoDiv1);
	   celda2.appendChild(nuevoDiv2);
	   
	   //luego crea la fila
	   fila = document.createElement("tr");
	   fila.appendChild(celda0);
	   fila.appendChild(celda1);
	   fila.appendChild(celda2);
	   	   
      	   //ahora lo mete todo en el documento 
	   tabla = document.getElementById(nomTabla);
	   //cuidado!! las filas de la tabla no están dentro de table, sino
	   //dentro de un nodo que se llama tbody, que es hijo de table
	   tabla.firstChild.appendChild(fila);
	}

}
  
	
function ordenacion()
{
tbody = document.getElementById('tablaGarajes').firstChild;
kTAM=tbody.childNodes.length; //longitud del vector
for (i=2;i<kTAM;i++)
	{
	for (j=kTAM-1;j>=i;j--)
		{
		var num=0;
		var num2=0;
		num=tbody.childNodes[j].childNodes[0].firstChild.firstChild.value+0;
		num2=tbody.childNodes[j-1].childNodes[0].firstChild.firstChild.value+0;
		if (num<=num2)
			{
			//alert(tbody.childNodes[j].childNodes[0].firstChild.firstChild.value+"-"+tbody.childNodes[j-1].childNodes[0].firstChild.firstChild.value);
			aux0=tbody.childNodes[j-1].childNodes[0].firstChild.firstChild.value;
			aux1=tbody.childNodes[j-1].childNodes[1].firstChild.firstChild.value;
			aux2=tbody.childNodes[j-1].childNodes[2].firstChild.firstChild.value;
			aux3=tbody.childNodes[j-1].childNodes[3].firstChild.firstChild.value;
			aux4=tbody.childNodes[j-1].childNodes[4].firstChild.firstChild.value;
			aux5=tbody.childNodes[j-1].childNodes[5].firstChild.firstChild.value;
				
			tbody.childNodes[j-1].childNodes[0].firstChild.firstChild.value=tbody.childNodes[j].childNodes[0].firstChild.firstChild.value;
			tbody.childNodes[j-1].childNodes[1].firstChild.firstChild.value=tbody.childNodes[j].childNodes[1].firstChild.firstChild.value;
			tbody.childNodes[j-1].childNodes[2].firstChild.firstChild.value=tbody.childNodes[j].childNodes[2].firstChild.firstChild.value;
			tbody.childNodes[j-1].childNodes[3].firstChild.firstChild.value=tbody.childNodes[j].childNodes[3].firstChild.firstChild.value;
			tbody.childNodes[j-1].childNodes[4].firstChild.firstChild.value=tbody.childNodes[j].childNodes[4].firstChild.firstChild.value;
			tbody.childNodes[j-1].childNodes[5].firstChild.firstChild.value=tbody.childNodes[j].childNodes[5].firstChild.firstChild.value;
			
			tbody.childNodes[j].childNodes[0].firstChild.firstChild.value=aux0;
			tbody.childNodes[j].childNodes[1].firstChild.firstChild.value=aux1;
			tbody.childNodes[j].childNodes[2].firstChild.firstChild.value=aux2;
			tbody.childNodes[j].childNodes[3].firstChild.firstChild.value=aux3;
			tbody.childNodes[j].childNodes[4].firstChild.firstChild.value=aux4;
			tbody.childNodes[j].childNodes[5].firstChild.firstChild.value=aux5;
			
			}
		}
	}
}



function noRepeticion()
{
	//ordenacion();	

	//cogemos el numero de lineas actual de la tabla
	tbody = document.getElementById('tablaGarajes').firstChild;
	//ver que no hayan repetidas
for (i=1;i<tbody.childNodes.length;i++)
		{
		valor=tbody.childNodes[i].firstChild.firstChild.firstChild.value;
		for (j=i+1;j<tbody.childNodes.length;j++)
			{
			valor2=tbody.childNodes[j].firstChild.firstChild.firstChild.value;
			if (valor==valor2)
				{
				alert("No pueden haber garajes con identificador repetidos");		
				return false;
			
				}
			}
		}
tbody = document.getElementById('tablaLocales').firstChild;
	//ver que no hayan repetidas
for (i=1;i<tbody.childNodes.length;i++)
		{
		valor=tbody.childNodes[i].firstChild.firstChild.firstChild.value;
		for (j=i+1;j<tbody.childNodes.length;j++)
			{
			valor2=tbody.childNodes[j].firstChild.firstChild.firstChild.value;
			if (valor==valor2)
				{
				alert("No pueden haber garajes con identificador repetidos");		
				return false;
			
				}
			}
		}
	return true;	
}



function borrarFila(nomTabla) {
	   var numFila, tbody, filasTabla;
	   
	   numFila = prompt("¿Qué fila quieres borrar? (empezando en 0 - encabezado)", 0);
	   //como antes: las filas de la tabla están dentro del nodo TBODY
	   tbody = document.getElementById(nomTabla).firstChild;
	   filasTabla = tbody.childNodes.length
	   if (numFila>filasTabla)
	      alert("No hay tantas filas");

	  else
		if (numFila==0)
	     		 alert("!!no puedes borrar la cabecera!!");	
	
		else {
		      tbody.removeChild(tbody.childNodes[numFila]);
	   } 
	}



function verFoto(pagina,titulo) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=640,height=480,screenX=0,screenY=0,top=0,left=0,fullscreen=no,titlebar=yes";
url='fotoGrande.php?imagen='+pagina+'&titulo='+titulo;
window.open(url,titulo,opciones);
}


function verTexto(texto,idioma) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=375,height=450,screenX=0,screenY=0,top=150,left=300,fullscreen=no,titlebar=yes";
url='verTexto.php?texto='+texto+'&language='+idioma;
window.open(url,"",opciones);
}

function verFotos(texto,idioma) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=500,height=500,screenX=0,screenY=0,top=150,left=150,fullscreen=no,titlebar=yes";
url='verPopUp.php?fotos='+texto+'&language='+idioma;
window.open(url,"",opciones);
}

function verMapa(texto,idioma) {
var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=375,height=450,screenX=0,screenY=0,top=150,left=300,fullscreen=no,titlebar=yes";
url='verPopUp.php?fotos='+texto+'&language='+idioma;
window.open(url,"",opciones);
}



/************************************************
Funciones para efecto imagen
************************************************/


function makevisible(cur,which){
if (which==0)
cur.filters.alpha.opacity=100
else
cur.filters.alpha.opacity=20
}


function high(which2){
theobject=which2
highlighting=setInterval("highlightit(theobject)",50)
}
function low(which2){
clearInterval(highlighting)
which2.filters.alpha.opacity=70
}



function highlightit(cur2){
if (cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=5
else if (window.highlighting)
clearInterval(highlighting)
}
/***********************************************/
