<?
	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";
	
	$la_tmp = explode('?', $_SERVER['HTTP_REFERER']);
	$la_old = array('/default.php', $g_path_sl);
	$la_new = array('/', '');
	$l_lang_ref = str_replace($la_old, $la_new, $la_tmp[0]);
	include '../../'.$l_lang_ref.'my/u_globals.php';
	
	include $g_path."u_headers.php";
	
	$l_dokument = gen_prikaz('tablica_dokumenata', 'document', ' document.folder_guid = "'.$_GET['value'].'"', 
		$_GET['value'], $_GET['aj'], $_GET['column'], $_GET['reverse']);
	
	$la_data = array();
	
	if($_GET['aj'] == ''){
		$x = get_data("select guid, library_guid, FolderName as Naziv, parent_guid from folder where guid = '".$_GET['value']."' ");
		$result = '<div class="content">';
		
		//$result .= '<div id="dodajDatotekuLayer"><iframe id="upload_frame" '.
			//'name="upload_frame" frameborder="0" border="0" scrolling="no" scrollbar="no"></iframe></div>';
		
		$result .= '<div id="adddata"></div>'.
			'<div id="chdata">'.
			$l_dokument.
			'</div>'.
		'</div>';
		
		$la_data[0] = $result;
	}else{
		$la_data[0] = $l_dokument;
	}
	
	
	$la_data[1] = ' &nbsp; || &nbsp; '.$g_term[$g_language_sign]['top_mapa'].': "'.$x['Naziv'].'"';
	$la_data[2] = $g_term[$g_language_sign]['top_akcija_pregled_dokumenata'];
	
	ob_start();
	
?>
		<div class="buttons">
			<a href="#" onclick="a_is_redak_set[0] = 0; document_get('<?=$_GET['value']
				?>', '', '', ''); return false;" title="<?=$g_term[$g_language_sign]['top_pregled_dokumenata']?>"><img src="<?=$g_path_sl_res?>images/b-list.gif" border="0"></a>
			<a href="#" onclick="a_is_redak_set[0] = 0; document_get_add('<?=$_GET['value']
				?>', 'chdata'); return false;" title="<?=$g_term[$g_language_sign]['top_dodaj_novi_dokument']?>"><img src="<?=$g_path_sl_res?>images/b-add.gif" border="0"></a>
			<div id="documentSaveButton">
				<img src="<?=$g_path_sl_res?>images/b-separator.gif" border="0">
				<a href="#" onclick="submitThisForm(); return false;" title="Spremi"><img src="<?=$g_path_sl_res?>images/b-spremi.gif" border="0"></a>
			</div>
		</div>
<?
	$output = ob_get_contents();
	ob_end_clean();
	$la_data[3] = $output;
	
	$l_json = json_encode($la_data);
	print $l_json;
	
	/*
	if($_GET['aj'] == ''){
		$x = get_data("select guid, library_guid, FolderName as Naziv, parent_guid from folder where guid = '".$_GET['value']."' ");
		$result = '<div class="content">'.
			'<p>Odabrali ste mapu: <b>'.$x['Naziv'].'</b></p>'.
			'<div class="buttons">'.
			'	<a href="#" onclick="document_get(\''.$_GET['value'].'\', \'\', \'\', \'\'); return false;" class="button" title="Pregled dokumenata mape \''.
				$x['Naziv'].'\'">Pregled dokumenata</a>'.
			'	<a href="#" onclick="document_get_add(\''.$_GET['value'].'\', \'chdata\'); return false;" class="button" title="Dodaj novi dokument u mapu \''.
				$x['Naziv'].'\'">Dodaj novi dokument</a>';
		
		//$result .= '<div id="lnkDodajDatoteku"><a href="#" onclick="new_document(\''.$_GET['value'].'\', 13, activeDocument, 1); return false;" '.
		//	' class="button" title="Dodaj novu datoteku">Dodaj datoteku</a></div>';
		
		$result .= '<div id="dodajDatotekuLayer"><iframe id="upload_frame" '.
			'name="upload_frame" frameborder="0" border="0" src="" scrolling="no" scrollbar="no"></iframe></div>';
		
		//$l_file = get_item('select FileUrl from document where guid = "'.$_GET['value'].'" ');
		//$l_file == '' ? $l_file = '' : $l_file = '<a href="'.$z[$y['ime_polja'][$j]][$i].'" target="_blank"><img src="res/images/document.jpg" border="0"></a>'; 
		//$result .= $_GET['value'].'<div id="dodajDatotekuImg">xx'.$l_file.'xx</div>';
		
		
		$result .= '</div>'.
			'<div id="adddata"></div>'.
			'<div id="chdata">'.
			'	<p>Svi dokumenti u mapi</p>'.
			$l_dokument.
			'</div>'.
		'</div>';
	}else{
		$result = $l_dokument;
	}
	print $result;
	*/
?>
