var lang = idiomaXbasic;

function menuleftOver(id) {
	document.getElementById("menuleft"+id).style.backgroundColor = "#ffffff";
	document.getElementById("menuleft"+id).style.cursor = "pointer";
}

function menuleftOut(id) {
	document.getElementById("menuleft"+id).style.backgroundColor = "#e5e5e5";
}

function menuleftClick(link) {
	myBaseHREF(link);
}

function optOver(elem) {
	elem.style.backgroundColor='#e5e5e5'
	elem.style.cursor = "pointer";
}

function optOut(elem) {
	elem.style.backgroundColor='#ffffff'
}

function optClick(address) {
	myBaseHREF(address);
}

function mnOver(id) {
	//document.getElementById(id).src='images/home/mn_'+id+'_on.gif';
	document.getElementById(id).src='images/'+lang+'/menutop/mn_'+id+'_on.gif';
	document.getElementById('options_'+id).style.display='block';
}

function mnOut(id) {
	document.getElementById('options_'+id).style.display='none';
	document.getElementById(id).src='images/'+lang+'/menutop/mn_'+id+'.gif';
}

function optsOver(id) {
	document.getElementById('options_'+id).style.display='block';
	document.getElementById(id).src='images/'+lang+'/menutop/mn_'+id+'_on.gif';
}

function optsOut(id) {
	document.getElementById(id).src='images/'+lang+'/menutop/mn_'+id+'.gif';
	document.getElementById('options_'+id).style.display='none';
}


function popup(direccion,w,h) {
		var posx = (screen.width-w)/2;
		var posy = (screen.height-h)/2;
		var opciones = "fullscreen=0" + 
                 ",toolbar=0" + 
                 ",location=0" + 
                 ",status=0" + 
                 ",menubar=0" + 
                 ",scrollbars=1" + 
                 ",resizable=1" + 
                 ",width="+w + 
                 ",height="+h + 
                 ",left="+posx + 
                 ",top="+posy; 
     	var ventana = window.open(direccion,"popup",opciones); 
}

function ApliWebPrint(direccion,w,h) {
		var posx = (screen.width-w)/2;
		var posy = (screen.height-h)/2;
		var opciones = "fullscreen=0" + 
                 ",toolbar=0" + 
                 ",location=0" + 
                 ",status=0" + 
                 ",menubar=0" + 
                 ",scrollbars=1" + 
                 ",resizable=1" + 
                 ",width="+w + 
                 ",height="+h + 
                 ",left="+posx + 
                 ",top="+posy; 
     	var ventana = window.open(absHREF(direccion),"centerFrame",opciones); 
}

function changecursor(elem) {
	elem.style.cursor = "pointer";
}

function searchRef() {
	if (IsNumeric(document.getElementById('q').value)) {
		var codigo = document.getElementById('q').value;
		while (codigo.length<5) {
			codigo = '0'+codigo;
		}
		document.getElementById('q').value = codigo;
		
	myBaseHREF('producto/ficha_producto.aspx?referencia='+document.getElementById('q').value+'&stype=referencia&referenciaValue='+document.getElementById('q').value+'&q='+document.getElementById('q').value);
	
	} else {
	myBaseHREF('producto/busqueda-de-productos-listado-global.aspx?advancedSearch=&referenciaValue=&categoriaValue=&subcategoriaValue=&stype=pclave&palabraclave='+document.getElementById('q').value);
	
	}
	//
}

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;
   
}

