window.addEvent( 'domready', function() {
	$('category_p').addEvent('change', function(){

		var e = document.getElementById('category_p');
		var parent_id = e.options[e.selectedIndex].value;
		
		if (parent_id==0){
			$('category_warper').innerHTML='<select class=\"inputbox required\" id=\"category\" name=\"category\"><option value=\"0\">תת קטגוריה</option></select>';
			return;
		}else{
			var url = '/index.php?option=com_adsman&view=adsman&layout=categorySon&Itemid=216&category='+parent_id+'&css_id=category&css=required';
			
			var a = new Ajax( url, {
				method: 'get',
				update: $('category_warper')
			}).request();
		}

	});
});