jQuery.fn.extend({
	newBlock:  function(title,subtitle,id,clss,html){
		if(html) html="<span class=\"rawhtml nonsortable\">"+html+"</span>";
		if(jQuery.isArray(title))
			for(i=0;i<title.length;i++) jQuery(this).newBlock(title[i][0],title[i][1],title[i][2]);
		else
		jQuery(this).append('<div class="groupItem '+clss+'" id="block_'+id+'"><div class="itemHeader">'+title+
				'<a href="#" class="closeEl">[-]</a>'+
				'<a href="/admin/inc/startpagina/ajax.php?height=450&width=400&action=blockedit&id=editblock_'+id+'" class="edit_block DOMWindow" id="editblock_'+id+'">[e]</a></div>'+subtitle+'<br>'+html+'<div class="itemContent"><br></div> </div>');
		return this;
	},
	newli:	function(title,href,id,clss,hint,target,options){
		if(jQuery.isArray(title))
			for(i=0;i<title.length;i++) jQuery(this).newli(title[i][0],title[i][1],title[i][2],title[i][3],title[i][4],title[i][5],title[i][6]);
		else
			jQuery(this).append('<li class="liitem '+clss+'" id="item_'+id+'"><a href="'+href+'" title="'+hint+'" target="'+target+'">'+title+'</a>'+
				(options.tip?" (tip) ":"")+
				(options.nieuw?" (nieuw) ":"")+
				'<a href="/admin/inc/startpagina/ajax.php?height=450&width=400&action=linkedit&id=edititem_'+id+'" class="edit_link DOMWindow" id="edititem_'+id+'">Edit</a></li>');
		return this;
	}
});

jQuery.fn.jxsserialize= function(selector, o ){
	var str=[];
	o = o || {};

	this.each(
		function(){
			var par=jQuery(this).attr('id');
			jQuery(this).find(selector).each(function(){
				var id=jQuery(this).attr('id');
				str.push(
					( o.key || jQuery(this).parents(o.parentSelector).attr('id') )
					+'[]='+id);
			});
	});

	return(str.join("&"));
}

