// JavaScript Document

/***************************** BOTONERA *****************************/
var id_viejo = 0;

function mostrar(id)
{
	
	if(id != id_viejo)
	{
		id_viejo = id;
		
		//escondo todas las subotoneras
		$('.div_botonera').hide('slow');
		$('.enlace').removeClass('enlace_prendido');
		
		//muestro la seleccionado.
		$('#'+id).toggle('slow');
		
		//cambio el estilo para que quede prendido.
		$('#a_'+id).addClass('enlace_prendido');
	}

}


function none() {

}

/****************************** BUSCADOR ******************************/
function buscar()
{
	if(document.getElementById('buscar').value != "")
	{
		document.getElementById('form_buscar').submit();
		return true;
	}
	else
	{
		alert('Ingrese un texto para buscar');
		document.getElementById('buscar').focus();
		return false;
	}
}


/****************************** LOGIN DE CLIENTES ******************************/
function login()
{
	if(document.getElementById('usuario').value != "" && document.getElementById('clave').value != "")
	{
		document.getElementById('from_login').submit();
		return true;
	}
	else
	{
		alert('Debe ingresar usuario y/o clave');
		document.getElementById('usuario').focus();
		return false;
	}
}

/***************************** CARRITO ***************************************/

//para los listados
function agregar(num_formulario) {
		
	document.getElementById('form_producto_' + num_formulario).submit();
}

// para la ficha de producto
function agregar_producto(num_formulario) {
		
	document.getElementById('form_producto').submit();
}

function borrar() {
	document.getElementById('form_productos').submit();
}

/****************************** POPUP ******************************/

function popWindows(url,newWindows,pResizable,pScrollbars,pMenuBar,pToolBar,pStatus,pWidth,pHeight)
{
 newWindows=window.open(url,newWindows,"resizable="+ pResizable +",scrollbars="+ pScrollbars +",menubar="+ pMenuBar +",toolbar="+ pToolBar +",status="+ pStatus +",width=" + pWidth + ",height=" + pHeight)
}

/****************************** NI IDEA ******************************/
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
