<?
	header("Content-Type: text/html; charset=utf-8");
	
	$g_path = '../../my/';
	
	include $g_path."u_globals.php";
	include $g_path."html/f.php";
	include $g_path."u_spoj_na_bazu.php";
	
	include $g_path."u_headers.php";
	
	$x = get_item('select ime_polja from meta_item where rbr = '.$_GET['param1'].' and rbr_atribut = '.$_GET['param2']);
	$y = get_item('select ime_tablice from meta_tablica_list where rbr = '.$_GET['param1']);
	
	$z = get_data('select '.$x.' from '.$y.' where '.$x.' like "%'.$_GET['value'].'%" ', 1);
	
	//$result = 'select '.$x.' from '.$y.' where '.$x.' like "%'.$_GET['value'].'%" ';
	$result = '<p class="searchP"><a href="#" onclick="close_layer(\'searchResults\'); return false;"><i>Zatvori</i></a></p>';
	$result .= '<ul class="searchUl">';
	for($i = 0; $i < sizeof($z[$x]); $i++){
		$result .= '<li><a href="#" onclick="setSearch(\''.$z[$x][$i].'\', '.$_GET['param2'].'); return false;">'.$z[$x][$i].'</a></li>';
	}
	$result .= '</ul>';
	$result .= '<p class="searchP"><i>Za odabir, klikni na gornji podatak</i></p>';
	
	/*
	$result = '<select multiple="multiple" class="searchUl" style="height:200px">';
	for($i = 0; $i < sizeof($z[$x]); $i++){
		$result .= '<option onclick="setSearch(\''.$z[$x][$i].'\'); return false;">'.$z[$x][$i].'</option>';
	}
	$result .= '</select>';
	*/
	
	
	print $result;
?>
