<script type="text/javascript">
function some_function()
	{
		var idlanguage = document.dataform.idlanguage.value;
		var idmenu_item_types = document.dataform.idmenu_item_types.value;
		
		var link ="/admin/get_json_data_for_menu/"+idmenu_item_types+"/"+idlanguage;
		$.getJSON(link, wypelnij);
		function wypelnij(data)
		{
			document.getElementById("idelement").innerHTML = ""; 
			$.each( data, function(i, n){
  				$("#idelement").append("<option value='"+i+"'>"+i+" - "+n+"</option>")
			});
		}
	}
			      	
$(document).ready(function() {
 });
</script>   


<h2><?= ucfirst($this->site['dodaj_pozycje_menu']);?>:</h2>
<table>
<?php
	if(isset($idparent)){
		echo form_open('admin/add_menu_item/'.$idmenus.'/'.$idparent, array('name' => 'dataform'));
	}else{
		echo form_open('admin/add_menu_item/'.$idmenus, array('name' => 'dataform'));
	}
		echo '<tr><td>'.ucfirst($this->site['nazwa']).': </td><td>'.form_input(array('name'=>'title', 'size'=>'50')).'</td></tr>';
		$js = 'id="idlanguage" onChange="some_function();"';
		echo '<tr><td>'.ucfirst($this->site['jezyk']).': </td><td>'.form_dropdown('idlanguage', $languages, 'large', $js).'</td></tr>';//
		$js = 'id="idmenu_item_types" onChange="some_function();"';
		echo '<tr><td>'.ucfirst($this->site['kategoria']).': </td><td>'.form_dropdown('idmenu_item_types', $menu_item_types, 'large', $js).'</td></tr>';//
		$js = 'id="idelement"';
		echo '<tr><td>'.ucfirst($this->site['idelement']).': </td><td>'.form_dropdown('idelement', array(), 'large', $js).'</td></tr>';
		echo '<tr><td>URL: </td><td>'.form_input(array('name'=>'friendlyurl', 'size'=>'50')).'</td></tr>';
		echo '<tr><td>'.ucfirst($this->site['aktywny']).': </td><td>'.form_checkbox('active', '1', TRUE).'</td></tr>';//
		echo '<tr><td></td><td>'.form_submit('submit', ucfirst($this->site['wyslij'])).'</td></tr>';	
	echo form_close();
?>
</table>