function ocultar_capa_busqueda(id_j_frame) {
	$('contenedor_'+id_j_frame).setHTML('');
	$(id_j_frame).setStyle('visibility','hidden');
}

function iniciar_capa_busqueda(id_j_frame, servicio, otros_parametros, run_js, codificacion,nodraggable) {
	
	ir_a('contenedor_'+ id_j_frame, servicio, otros_parametros, run_js, codificacion);	
	
	if(nodraggable) {
		$('cabecera_'+id_j_frame).setStyle("cursor","auto");
		$(id_j_frame).setStyle('visibility','visible');
	} else {
		top_inicial = 7 - $(id_j_frame).getSize()['size']['y'] / 2;
		$(id_j_frame).setStyle('top',-80);
		left_inicial = 30 - $(id_j_frame).getSize()['size']['x'] / 2;
		$(id_j_frame).setStyle('left',left_inicial);
		(
			function(){
				if( ( $('contenedor_'+id_j_frame).getTop() + $(id_j_frame).getSize()['size']['y'] ) > screen.availHeight 	){
					var height_overflow = screen.availHeight - $('contenedor_'+id_j_frame).getTop();
					var top_init = $(id_j_frame).getStyle('top');
					var resto = top_init.toInt() - $(id_j_frame).getSize()['size']['y'] + ( height_overflow / 2 );
					$(id_j_frame).setStyle('top', resto );
				}
				$(id_j_frame).setStyle('visibility','visible');
			}.delay(600)
			
		);
		$(id_j_frame).makeDraggable(
			{ 
				handle: $('cabecera_'+id_j_frame),
				onStart: function(){
					$(id_j_frame).setOpacity(0.5);
				}.bind(this),
				 
				onComplete: function(){
					$(id_j_frame).setOpacity(1);
				},
				
				x:0,
				y:0,
				limit: {
					x: [
						(window.getScrollLeft() - $('referencia_'+id_j_frame).getLeft() ), 
						function() { return (window.getWidth() - $('referencia_'+id_j_frame).getLeft() - $(id_j_frame).getSize()['size']['x'] );	}
					], 
					y: [
						( 0 - $('referencia_'+id_j_frame).getTop() ), ( window.getHeight() - $('referencia_'+id_j_frame).getTop() - $(id_j_frame).getSize()['size']['y'] )
					]
				}
			} );
	}
}

function asignar_resultado_busqueda(variables, valores, delimitador) {
	if( ! delimitador ) delimitador = '|';
	arr_variables = variables.split(delimitador);
	arr_valores   = valores.split(delimitador);
	for(i=0 ; i<arr_variables.length ; ++i) {
		if($(arr_variables[i])) {
			$(arr_variables[i]).setProperty( 'value', arr_valores[i] );
			dispara_evento(arr_variables[i], 'sentencia_ejecutar');
		}
	}
}
