jQuery.extend({
	chunk : 
	function(str, chunk, separator) 
	{
		//console.log(this);
		if(!separator)	
			separator = ':';
		if(!chunk)	
			chunk = 0;
			
		chunks = str.split(separator);
		return chunks[chunk];
	}
});


jQuery.fn.extend({
	chunkId :
	function(chunk, separator)
	{
		return jQuery.chunk($(this).attr('id'), chunk, separator);
	}
});


jQuery.fn.extend({
	appendPost :
	function(url, data, type)
	{
		$element = $(this);
		if(!data) 
			data = {};
		if(!type) 
			type = 'html';
			
		$.post(url, 
			   data, 
			   function(dataRes){
			   	   $element.append(dataRes);
			   },
			   type
		);
		return $(this);
	}
});


jQuery.fn.replaceAttr = function(aName,rxString,repString)
{
        return this.each
        ( function()
                {
                        jQuery(this).attr
                        ( aName
                        , jQuery(this).attr(aName).replace(rxString,repString)
                        )
                }
        );
} 
