/* inner wrap */
(function($) { jQuery.fn.innerWrap = function(u) {
	return this.each(function() {
		var w = $(u)[0], v = w;
		while (v.firstChild) v = v.firstChild;
		while (this.firstChild) v.appendChild(this.firstChild);
		this.appendChild(w);
	});
}})(jQuery);

/* sidefade */
(function($) { jQuery.fn.sidefade = function(o) {
	var o = $.extend({}, {
		img: 'fmenu',
		imgPath: '/img/'
	}, o);
}})(jQuery);

/* maxlength for textarea */
(function($) { jQuery.fn.limitlength = function(length) {
	if (!length) var length = $(this).attr('maxlength');
	this.keyup(function() {
		if ($(this).val().length > length) {
			$(this).val($(this).val().substr(0, length));
		}
	});
}})(jQuery);

/* rounded corners */
(function($) { jQuery.fn.round = function(o) {
	var o = $.extend({}, {
		img: 'fmenu',
		imgPath: '/img/'
	}, o);

	var padding = this.css('padding');
	var content = this.html();
	this.css({padding:0});
	this.html(
		'<div style="background:url('+o['imgPath']+o['img']+'_tl.gif) top left no-repeat;">'
		+'<div style="background:url('+o['imgPath']+o['img']+'_tr.gif) top right no-repeat;">'
		+'<div style="background:url('+o['imgPath']+o['img']+'_br.gif) bottom right no-repeat;">'
		+'<div style="background:url('+o['imgPath']+o['img']+'_bl.gif) bottom left no-repeat;padding:'+padding+'">'
		+content
		+'</div>'
		+'</div>'
		+'</div>'
		+'</div>'
	);	
}})(jQuery);