

//Para la paginacion de resultados:
function GotoPage(form_name,pag){
	document.forms[form_name].pagina.value = pag;
	document.forms[form_name].submit();
}

function OpenSelector(table,key){
	//** table -> la tabla que tratamos
	//** Key -> la referencia a otra tabla
	if (table == "provincias"){
		if(formulario.select_countries.value == ""){
			alert("Por favor seleccione un pais");
			return;
		}
	}

	if (table == "ciudades"){
		if(formulario.select_provincias.value == ""){
			alert("Por favor seleccione una provincia");
			return;
		}
	}

	if (table == "zonas"){
		if(formulario.select_ciudades.value == ""){
			alert("Por favor seleccione una ciudad");
			return;
		}
	}

	if (table == "localizacion"){
		if(formulario.select_zonas.value == ""){
			alert("Por favor seleccione una zona");
			return;
		}
	}
	window.open("selector.php?table=" + table + "&key=" + key,"","left=200,top=250,width="+ 500 +",height= "+ 170 +",toolbar=no,status=no,scrollbars=no,fullscreen=no,resizable=yes");
}

function OpenUpdater(select_object,value){
	if (value == ""){
		return;
	}

	window.open("updater.php?select_object=" + select_object + "&key=" + value,"","left=200,top=250,width="+ 250 +",height= "+ 80 +",toolbar=no,status=no,scrollbars=no,fullscreen=no,resizable=yes");

}

//Cambia el color de una fila de una tabla al recibir el foco
function RowFocus(row,color){
	row.style.backgroundColor = color ;
}

//igual al perder el foco
function RowBlur(row,color){
	row.style.backgroundColor = color ;
}

function dar_foco(objeto) {
	objeto.style.backgroundColor="#DDDDDD";
	objeto.style.cursor="hand";
}

function quitar_foco(objeto) {
	objeto.style.backgroundColor="";
}

function OpenLink(page){
	window.open(page);
}


function ShowImage (image,width,height){
	width_window = width + 200;
	height_window = height + 250;

	if (width < 800){ width_window = 800} //para las imagenes de las caņitas esas, ancho minimo

	window.open("view_image.php?imagen=" + image + "&img_width=" + width + "&img_height=" + height,"","left=0,top=0,width="+ width_window +",height= "+ height_window +",toolbar=no,status=no,scrollbars=no,fullscreen=no,resizable=yes");
}
