
;(function($) {

$.yii = {
	version : '1.0',

	submitForm : function (element, url, params) {
		var f = $(element).parents('form')[0];
		if (!f) {
			f = document.createElement('form');
			f.style.display = 'none';
			element.parentNode.appendChild(f);
			f.method = 'POST';
		};
		if (typeof url == 'string' && url != '') {
			f.action = url;
		};
		var inputs = [];
		jQuery.each(params, function(name, value) {
			var input = document.createElement("input");
			input.setAttribute("type", "hidden");
			input.setAttribute("name", name);
			input.setAttribute("value", value);
			f.appendChild(input);
			inputs.push(input);
		});

		jQuery(f).trigger('submit');

		jQuery.each(inputs, function() {
			f.removeChild(this);
		});
	}
};

})(jQuery);


$(function(){
	
	
	
	var zoneid = $('meta[name=zoneid]').attr('content');
	
	$('td.idusera').each(function() {
		
		
		var id = $(this).attr('id');
		var nick = $(this).children('table').children('tbody').children('tr').children('.a10').text();
		//var anch = '<div style="width:100%; text-align:center; "><a href="http://127.0.0.1:10001/index.php/site/postawForum/id/'+ id + '/username/'+ nick + '/zoneid/'+ zoneid + '" id="yt0"><img src="/images/jastawiam_banner.jpg" border="0"></a></div>';
		
		$(this).next('.a7')
		.children('table')
		.children('tbody')
		.children('tr')
		.next('tr')
		.children('td')
		.children('.jastawiam_buttons')
		
		// w nastepnej lini sprawdzic adres !!!
		
		.children('a').attr('href', 'http://jastawiam.pl/index.php/site/postawForum/id/'+ id + '/username/'+ nick + '/zoneid/'+ zoneid);
		
		//('.jastawiam_buttons').append(anch);
		
	}
	);
	
	//jQuery('#yt0').click(function(){if(confirm('Are you sure to delete #1?')) {jQuery.yii.submitForm(this,'',{'command':'delete','id':'1'});return false;} else return false;});

	
});
