<script type="text/javascript">
function some_function()
	{
		var idlanguage = document.dataform.idlanguage.value;
		
		var link ="/admin/get_json_meta_types/"+idlanguage;
		$.getJSON(link, wypelnij);
		function wypelnij(data)
		{
			$("#idmetatags").html(data.content);
			get_metatags();
		}
	}
	
function get_metatags()
	{
		var idmetatags = document.dataform.idmetatags.value;
		
		var link ="/admin/get_json_meta/"+idmetatags;
		$.getJSON(link, wypelnij);
		function wypelnij(data)
		{
			$("#keywords").val(data.keywords);
			$("#shortdesc").val(data.shortdesc);
			$("#abstract").val(data.abstract);
			$("#subject").val(data.subject);
			$("#topic").val(data.topic);
			$("#copyrights").val(data.copyrights);
		}
	}
			      	
$(document).ready(function() {
	some_function();
 });
</script> 

<h2><?= ucfirst($this->site['dodaj_nowy_artykul']);?></>:</h2>
<table>
<?php
	echo form_open_multipart('admin/add_article/'.$idparent, array('name' => 'dataform'));
		echo '<tr><td>'.ucfirst($this->site['tytul']).': </td><td>'.form_input(array('name'=>'title', 'size'=>'50')).'</td></tr>';
		echo '<tr><td>'.ucfirst($this->site['skrocony_tytul']).': </td><td>'.form_input(array('name'=>'seotitle', '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="idmetatags" onChange="get_metatags();"';
		echo '<tr><td>'.ucfirst($this->site['metatagi']).': </td><td>'.form_dropdown('idmetatags', array(), 'large', $js).'</td></tr>';//
		echo '<tr><td>'.ucfirst($this->site['obrazek']).': </td><td>'.form_upload(array('name'=>'file')).'</td></tr>';//	
		echo '<tr><td>'.ucfirst($this->site['tresc']).': </td><td>'.form_textarea(array('name'=>'artcontent')).'</td></tr>';
		echo '<tr><td>'.ucfirst($this->site['skrocony_opis']).': </td><td>'.form_textarea(array('name'=>'shortdesc', 'id'=>'shortdesc')).'</td></tr>';
		echo '<tr><td>'.ucfirst($this->site['slowa_kluczowe']).': </td><td>'.form_input(array('name'=>'keywords', 'id'=>'keywords', 'size'=>'180')).'</td></tr>';
		echo '<tr><td>Abstract: </td><td>'.form_input(array('name'=>'abstract', 'id'=>'abstract', 'size'=>'180')).'</td></tr>';
		echo '<tr><td>Subject: </td><td>'.form_input(array('name'=>'subject', 'id'=>'subject', 'size'=>'180')).'</td></tr>';
		echo '<tr><td>Topic: </td><td>'.form_input(array('name'=>'topic', 'id'=>'topic', 'size'=>'180')).'</td></tr>';
		echo '<tr><td>'.ucfirst($this->site['prawa_autorskie']).': </td><td>'.form_input(array('name'=>'copyrights', 'id'=>'copyrights', 'size'=>'50')).'</td></tr>';
		echo '<tr><td>URL: </td><td>'.form_input(array('name'=>'friendlyurl', 'size'=>'50')).'</td></tr>';
		echo '<tr><td>'.ucfirst($this->site['cos_jeszcze']).': </td><td>'.form_textarea(array('name'=>'additional_data')).'</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>
<script type="text/javascript">
	window.onload = function()
	{
	var oFCKeditor = new FCKeditor( 'artcontent' ) ;
	oFCKeditor.Height = '300' ;
	oFCKeditor.BasePath = "/files/fckeditor/" ;
	oFCKeditor.ReplaceTextarea() ;
	}
</script>