//////////////////////////////////////////////////////
// FUNCIONES EXCLUSIVAS DEL FRONT
//////////////////////////////////////////////////////

// abre la hoja de impresión
function imprime(funcion, tipo, op, id, ancho, alto, tipo_impresion){
	
	URL = RUTA_RAIZ + SITIO_MASTER + "inc/impresion.php?f="+funcion+"&id="+id+"&op="+op+"&tipo="+tipo;

	// impresión por popup
	if(tipo_impresion==1) {
	
		imprimir = window.open(URL, "_blank", "toolbar=no ,location=no, status=no, menubar=no, resizable=no, scrollbars=yes, width="+ancho+", height="+alto+"");
		imprimir.moveTo((screen.availWidth/2)-(ancho/2),(screen.availHeight/2)-(alto/2));
		
	// impresión oculta
	} else {
		
		// Creo un iFrame
		var jFrame = $( "<iframe name='pagina_impresion'>" );

		// lo oculto y lo agrego al cuerpo del sitio
		jFrame
			.css( "width", "1px" )
			.css( "height", "1px" )
			.css( "position", "absolute" )
			.css( "left", "-9999px" )
			.appendTo( $( "body:first" ) )
			.attr( "src", URL);
		
		setTimeout(
			function(){
				jFrame.remove();
			}, (60 * 1000) );
	
	} // fin tipo_impresion

}

function popup(url, ancho, alto, scrollbar) {

	if(scrollbar=="undefined") { scrollbar = "no"; };
	
	ventana = window.open(url, "_blank", "toolbar=no ,location=no, status=yes, menubar=no, resizable=no, scrollbars=" + scrollbar + ", width="+ancho+", height="+alto+"");
	ventana.moveTo((screen.availWidth/2)-(ancho/2),(screen.availHeight/2)-(alto/2));

}

function navegador_multimedia(formato, idimagen, tipo, idrelacional, indice, navegable, ruta_galeria) {

	// fijo el ancho y el alto de la ventana
	ancho = screen.availWidth*eval("popup_" + formato + "_ancho");
	alto = screen.availHeight*eval("popup_" + formato + "_alto");
	ventana = window.open(RUTA_RAIZ + SITIO_MASTER + "inc/navegador_multimedia.php?formato=" + formato + "&id=" + idimagen + "&tipo=" + tipo + "&idrelacional=" + idrelacional + "&indice=" + indice + "&navegable=" + navegable + "&ancho_ventana=" + ancho + "&alto_ventana=" + alto + "&ruta_galeria=" + ruta_galeria, "_blank", "toolbar=no ,location=no, status=yes, menubar=no, resizable=no, scrollbars=no, width="+ancho+", height="+alto+"");
	ventana.moveTo((screen.availWidth/2)-(ancho/2),(screen.availHeight/2)-(alto/2));

}

function navegador_video(formato, idimagen, tipo, idrelacional, ancho, alto) {

	// fijo el ancho y el alto de la ventana
	ventana = window.open(RUTA_RAIZ + SITIO_MASTER + "inc/navegador_multimedia.php?formato=" + formato + "&id=" + idimagen + "&tipo=" + tipo + "&idrelacional=" + idrelacional + "&ancho_ventana=" + ancho + "&alto_ventana=" + alto, "_blank", "toolbar=no ,location=no, status=yes, menubar=no, resizable=no, scrollbars=no, width="+ancho+", height="+alto+"");
	ventana.moveTo((screen.availWidth/2)-(ancho/2),(screen.availHeight/2)-(alto/2));

}
