<?
		
		if($_GET['c'] == -1 || $_GET['c']){
			
			if($_GET['c'] == 2 && ($_GET['e'] == -1 || $_GET['e'])){
				$l_css_klasa_rbr = get_item('select rbr from meta_forma where ime = "'.$lha_sif_table_desc[$_GET['d'] - 1].'" ');
			}else{
				$l_css_klasa_rbr = get_item('select rbr from meta_forma where ime = "'.$lh_table_opis.'" ');
			}
			
			$ima_li = get_item('select verzija from meta_css where rbr_meta_forma = '.$l_css_klasa_rbr);
			if($ima_li){
				print '<link rel="stylesheet" id="cssforma" type="text/css" href="'.$g_path_sl_res.'css/klasa/css-5'.$l_css_klasa_rbr.'-'.$ima_li.'.css"  media="all">'."\n";
			}
		
			if($_GET['editmove'] == 1234 && $_SESSION['__id'] == 1){
?>
				<div class="defaultCSS">
					<a href="#" onclick="genDefCSS(<?=$l_css_klasa_rbr?>); return false;">Generiraj defaultni CSS file</a>
				</div>
				<div id="defaultCSSActive">
					<div id="defaultCSSActiveP">
						&nbsp;x
					</div>
					<div id="defaultCSSActiveE">
						&nbsp;y
					</div>
				</div>
				<div class="defaultCSSTop">
					<u>P pos</u> &nbsp;
					<a href="#" onclick="moveCSS(1); return false;"><</a>
					<a href="#" onclick="moveCSS(2); return false;"><<</a>
					<a href="#" onclick="moveCSS(3); return false;"><<<</a>
					<a href="#" onclick="moveCSS(4); return false;">>>></a>
					<a href="#" onclick="moveCSS(5); return false;">>></a>
					<a href="#" onclick="moveCSS(6); return false;">></a>
					<a href="#" onclick="moveCSS(7); return false;">A</a>
					<a href="#" onclick="moveCSS(8); return false;">AA</a>
					<a href="#" onclick="moveCSS(9); return false;">AAA</a>
					<a href="#" onclick="moveCSS(10); return false;">VVV</a>
					<a href="#" onclick="moveCSS(11); return false;">VV</a>
					<a href="#" onclick="moveCSS(12); return false;">V</a>
				</div>
				<div class="defaultCSSTop">
					<u>P size</u> &nbsp;
					<a href="#" onclick="psizeCSS(1); return false;"><</a>
					<a href="#" onclick="psizeCSS(2); return false;"><<</a>
					<a href="#" onclick="psizeCSS(3); return false;"><<<</a>
					<a href="#" onclick="psizeCSS(4); return false;">>>></a>
					<a href="#" onclick="psizeCSS(5); return false;">>></a>
					<a href="#" onclick="psizeCSS(6); return false;">></a>
				</div>
				<div class="defaultCSSTop">
					<u>E size</u> &nbsp;
					<a href="#" onclick="esizeCSS(1); return false;"><</a>
					<a href="#" onclick="esizeCSS(2); return false;"><<</a>
					<a href="#" onclick="esizeCSS(3); return false;"><<<</a>
					<a href="#" onclick="esizeCSS(4); return false;">>>></a>
					<a href="#" onclick="esizeCSS(5); return false;">>></a>
					<a href="#" onclick="esizeCSS(6); return false;">></a>
					<a href="#" onclick="esizeCSS(7); return false;">A</a>
					<a href="#" onclick="esizeCSS(8); return false;">AA</a>
					<a href="#" onclick="esizeCSS(9); return false;">AAA</a>
					<a href="#" onclick="esizeCSS(10); return false;">VVV</a>
					<a href="#" onclick="esizeCSS(11); return false;">VV</a>
					<a href="#" onclick="esizeCSS(12); return false;">V</a>
				</div>
				<div class="defaultCSSTop">
					<a href="#" onclick="submitCSS(<?=$l_css_klasa_rbr?>); return false;">SUBMIT</a>
				</div>
<?
			}
		}
?>
		<div class="visWrap">
<?
			include $g_path."html/h_buttons_top.php";
			
			switch(strval($_GET['c'])){
				// dodaj novi podatak
				case '-1':
						$l_forma = gen_form($lh_table, $lh_table_opis);

						$_GET['added'] == 1 ?
							$l_added = '<div class="added">Novi podatak uspješno je dodan. Možete dodati još podataka.</div>'
							:
							$l_added = '';
						
						$_GET['error'] ?
							$l_error = '<div class="error">Dogodila se pogreška. Molimo probajte ponovo.</div>'
							:
							$l_error = '';
?>
						<?=$l_added?>
						<?=$l_error?>
						<div class="list">
							<?=$l_forma?>
						</div>
<?
					break;
					
				// pregled podataka
				case '':
					$_GET['edited'] == 1 ?
						$l_edited = '<div class="added">Podatak je uspješno promijenjen.</div>'
						:
						$l_edited = '';
							
					$_GET['added'] == 1 ?
						$l_added = '<div class="added">Novi podatak uspješno je dodan.</div>'
						:
						$l_added = '';
					
					$_GET['error'] ?
						$l_error = '<div class="error">Dogodila se pogreška. Molimo probajte ponovo.</div>'
						:
						$l_error = '';
?>
					<?=$l_edited?>
					<?=$l_added?>
					<?=$l_error?>
<?
					if(empty($l_dodatni_uvjet)){
						$l_dodatni_uvjet = '';
					}
					$l_dokument = gen_prikaz($lh_table_opis, $lh_table, $l_dodatni_uvjet, 0, '-', $_GET['sort'], $_GET['reverse']);
					print $l_dokument;
					
					break;
					
				/*
				case '2':
					switch(strval($_GET['e'])){
						// dodaj novi podatak
						case '-1':
							$l_forma = gen_form($lha_sif_table[$_GET['d'] - 1], $lha_sif_table_desc[$_GET['d'] - 1]);
?>
							<div class="list">
								<?=$l_forma?>
							</div>
<?
							break;
						
						case '':
							$_GET['edited'] == 1 ?
								$l_edited = '<div class="added">Podatak je uspješno promijenjen.</div>'
								:
								$l_edited = '';
									
							$_GET['added'] == 1 ?
								$l_added = '<div class="added">Novi podatak uspješno je dodan.</div>'
								:
								$l_added = '';
							
							$_GET['error'] ?
								$l_error = '<div class="error">Dogodila se pogreška. Molimo probajte ponovo.</div>'
								:
								$l_error = '';
?>
							<?=$l_edited?>
							<?=$l_added?>
							<?=$l_error?>
<?
							$l_dokument = gen_prikaz($lha_sif_table_desc[$_GET['d'] - 1], $lha_sif_table[$_GET['d'] - 1], '', 0, '-', $_GET['sort'], $_GET['reverse']);
							print $l_dokument;
							break;
						
						// editiraj podatak
						default:
							$l_forma = gen_form($lha_sif_table[$_GET['d'] - 1], $lha_sif_table_desc[$_GET['d'] - 1], $_GET['e']);
							
							$_GET['edited'] == 1 ?
								$l_edited = '<div class="added">Podatak je uspješno promijenjen. Možete ga mijenjati ponovo.</div>'
								:
								$l_edited = '';
							
							$_GET['error'] ?
								$l_error = '<div class="error">Dogodila se pogreška. Molimo probajte ponovo.</div>'
								:
								$l_error = '';
?>
							<?=$l_edited?>
							<?=$l_error?>
							<div class="list">
								<?=$l_forma?>
							</div>
<?
					}
					break;
					*/
					
				
				// editiraj podatak
				default:
					$l_forma = gen_form($lh_table, $lh_table_opis, $_GET['c']);
?>
					<div class="list">
						<?=$l_forma?>
					</div>
<?
			}
?>
		</div>
