(function($) {
$.fn.jForm = function(options) {

var defaults = {
	labelInside	:	false,
	noValueBtn	: 	false,
	wrap		:	'p',
	activeBg	:	false,
	fadeThis	:	'#ffffe2',
	origFade	:	'#ffffff'
};

var opts = $.extend(defaults, options);
  
//--------------------------------------------------------
//adding classes, as ie6 doesn't support these special css selectors
this.children(""+opts.wrap+"").children("input[type='submit']").addClass("btn"); //submit button
this.children(""+opts.wrap+"").children("input[type='password']").addClass("password"); //password input
this.children(""+opts.wrap+"").children("input[type='text']").addClass("text"); //normal input
this.children(""+opts.wrap+"").children("input[type='radio']").addClass("radio"); //radio button
this.children(""+opts.wrap+"").children("input[type='checkbox']").addClass("checkbox"); //checkbox

this.children(""+opts.wrap+"").addClass("clearfix"); //wrapping tag
this.children().children("input[rel='required'], textarea[rel='required']").addClass("required"); //required input


if (opts.labelInside == true) { // Grabs the label, and makes this the value of the input, then hides the label
			this.children(""+opts.wrap+"").children("label").each(function () {
				var label = $(this).html();
										   
				$(this).next().attr("value",label);
				$(this).hide();
										   
			});
			
			this.children(""+opts.wrap+"").children("input.text, input.password, textarea").focus(function() { // on focus clear the text if it matches the label
				var val = $(this).attr("value");
				var origLabel = $(this).prev().html();
				if ( opts.activeBg == true ) {
				$(this).animate({backgroundColor: opts.fadeThis},750);
				}
			
				if ($(this).attr("value")==origLabel ){
						$(this).attr("value","").blur(function(){	// on blue return text if nothing is entered

						if ( opts.activeBg == true ) {
							$(this).animate({backgroundColor: opts.origFade},750);	
						}
						
							if (!$(this).attr("value")){
									$(this).attr("value",val);
							}
							
						});
				}
				
			});
																	 
}



if (opts.noValueBtn == true) { // if using an image background for the button, removes the value from the button
			this.children(""+opts.wrap+"").children("input.btn").attr("value","");
}







}//close jquery function
})(jQuery);
