//
// Scripts especificos de la pagina de almocafre
//
function menuover(objeto){
	if(objeto.id.substr(5,1)!="<?php echo $ap1; ?>"){
		document.getElementById("menu"+objeto.id.substr(5,1)).src="_imagenes/cab_menu_d_"+objeto.id.substr(5,1)+".gif";
	}
}
function menuout(objeto){
	if(objeto.id.substr(5,1)!="<?php echo $ap1; ?>"){
		document.getElementById("menu"+objeto.id.substr(5,1)).src="_imagenes/cab_menu_c_"+objeto.id.substr(5,1)+".gif";
	}
}
function mdover(objeto){
	objeto.parentElement.className='opmenuderover';
}
function mdout(objeto){
	objeto.parentElement.className='opmenuder';
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }

   
//
//------------------------------------------
function agregar(titulo,url){
   if ((navigator.appName=="Microsoft Internet Explorer") && 
         (parseInt(navigator.appVersion)>=4)) {
      window.external.AddFavorite(url,titulo);
   } else { 
      if(navigator.appName == "Netscape") 
         alert("Presione Crtl+D para agregar este sitio en sus Bookmarks"); 
   }
} 

function cambiarImagen(destino,imagen)
{
		
	e = document.getElementById(destino);

    e.src = imagen;
	
}

//
//	AGL 2003-10-03
//	FUNCION QUE CAMBIA EL ESTILO DE UN OBJETO DE LA PAGINA
//
function cambiarEstilo(Id, Estilo)
{
	e = document.getElementById(Id)
	e.className = Estilo;
	
	}
    

function cambiaver(id)
{
   
    var o = document.getElementById(id);

    if (o.style.display == 'block')
        {
            o.style.display = 'none';
        }
    else
        {
            o.style.display = 'block';
        }
           
}
	
function DoWindow(url,titulo,Ancho,Alto, Scroll) {

	//window.open(url);
	
	//return window.showModalDialog(url,titulo,"dialogheight:" + Alto +" px;dialogwidth:" + Ancho + " px;center:yes;edge:sunken;help:no;resizable:no;scroll:" + Scroll + ";status:no");
	AbreVentana(url,titulo,Ancho,Alto,0,0)	
//	AbreVentanaSeleccion(url,titulo)
}


//
//	ABRE UNA VENTANA PARA SELECCIONAR UN VALOR
//
function AbreVentanaSeleccion(url,creador)
{
	var win_opt="toolbar=0,location=0,directories=0,status=0,";
		win_opt += "menubar=0,scrollbars=1,resizable=0,copyhistory=0,";
		win_opt += "width="+ 500 +",Height="+650 + ",top=" + 0 + ",left=" + 0;
		
	newWindow = window.open("","",win_opt);
	newWindow.creator=creador;
	newWindow.document.location = url;


}

//
//	Antonio Gómez 2009-09-08.
//
//	Funcion que abre una vetana en popup con la url especificada, y en la posicion
//	determinada por los parametros.
//
function AbreVentana(url,Title,Width,Height,top, left)
{
	
	var htmlpage=" ";
	var win_opt="toolbar=0,location=0,directories=0,status=0,";
	win_opt += "menubar=0,scrollbars=0,resizable=0,copyhistory=0,";
	win_opt += "width="+ Width +",Height="+ Height + ",top=" + top + ",left=" + left;
			
	newWindow = window.open("","",win_opt);
	newWindow.creator=self;
	newWindow.document.title = Title;
	
	newWindow.document.location = url;
	
	return;			
	
}		

	function ponebrs(str)
	{
		
		while(str.indexOf('\n') != -1)
		{
			str = str.replace('\n','<br>');
		}
		
		return str;
		
	};

//
//  AGomez 2009-08-03
//
//  Carga una pagina web completa dentro de un div de forma dinamica.
//
//  Recibe como parametros la url de la pagina a cargar y el identificador del
//  div donde se cargará. Este div tiene que estar previante declarado en la página.
//
function CargaenDiv(url,div)
{
    if(window.XMLHttpRequest) {
        var req = new XMLHttpRequest();
      }
      else if(window.ActiveXObject) {
        var req = new ActiveXObject("Microsoft.XMLHTTP");
      }

    req.open("GET", url, false);
    req.send(null);

    var page = req.responseText;

    document.getElementById(div).innerHTML = page;
}

function navegar(url){
 	
	window.document.location = url;
	
 }
