(function($, jQuery) {
    jQuery.fn.chkForm = function(options) {
        options = jQuery.extend({}, jQuery.fn.chkForm.defaults, options);

        return $(this).each(function() {

            $('#form').css({width:"390px"});
			var fields = options.fields.split(",");
								
			$.each(fields,function(index, value){
				if($(value).val().length > 0) {
					$('<img class="gruen" src="/shop/gruen.png" alt="" />').insertAfter(value);
				}else {				
					$('<img class="pfeil" src="/shop/pfeil.png" alt="" />').insertAfter(value);				
				}
				$(value).bind('keypress change', function(){
					if( $(this).val().length > 0){
						$(this).next().attr('src' , '/shop/gruen.png');
					}else{
						$(this).next().attr('src' , '/shop/pfeil.png');
					}						
				});				
			});
					
            return $(this);
        });
    }
    jQuery.fn.chkForm.defaults = {
        'fields' : ''        
    }
jQuery(document).ready(function(){
jQuery('#form').chkForm({fields: '#firma,#email,#vorname,#name,#plz,#strasse,#ort'});
});
})(jQuery, jQuery);
