function cambiarPagina(url_destino)
{
	window.location =  url_destino;
}

function abrirVentanaArchivo(url_destino)
{
	abrirVentana(url_destino,"ventana_imagen",'760','600');
}

function abrirVentana(windowURL,windowName,windowWidth,windowHeight)
{
	window.name = 'parentWnd';
	newWindow = window.open(windowURL,windowName,'width='+windowWidth+',height='+windowHeight+',toolbar=0,location=0,directories=0, status=0,menuBar=0,scrollBars=1,resizable=1');
	newWindow.focus();
}

function copiarValor(valor, destinoId)
{
	document.getElementById(destinoId).value = valor;
}

function vaciarCampo(destinoId)
{
	document.getElementById(destinoId).value = "";
}

function copiarDatosLibro(libro_titulo, libro_precio, autor_nombre, area_nombre, editorial_nombre, libro_ano, libro_edicion, libro_isbn)
{
	document.getElementById('campo_libro_titulo').value = libro_titulo;
	document.getElementById('campo_libro_precio').value = libro_precio;
	document.getElementById('campo_autor_nombre').value = autor_nombre;
	document.getElementById('combo_libro_area_id').selectedIndex = area_nombre;
	document.getElementById('campo_editorial_nombre').value = editorial_nombre;
	document.getElementById('campo_libro_ano').value = libro_ano;
	document.getElementById('campo_libro_edicion').value = libro_edicion;
	document.getElementById('campo_libro_isbn').value = libro_isbn;
	alert('Datos copiados - ' + libro_titulo);
}

function limpiarTexto(field)
{
    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;
}

function enviarFormularioEnter(event, thisForm)
{
	if (event && event.which == 13)
		thisForm.submit();
	else
		return true;
}

function clearSearch(campo, textoPorDefecto)
{
	if(	campo.value == textoPorDefecto)
	{
		campo.value = '';
		campo.style.textAlign = 'left';
	}
}

function fillSearch(campo, textoPorDefecto)
{
	if(	campo.value == '')
	{
		campo.value = textoPorDefecto;
		campo.style.textAlign = 'center';
	}
}