function MediClub(options) {     
	this.options = options;
	 
	var me = this;
	
	$(".mc_toggle_friend").live('click', function (){
		var fbtn = $(this);
		var path = '/profil-ajax/' + me.getSubPath();
		if (fbtn.parents('.friend').length) {
			path = fbtn.parents('.friend').find('.mc_profile_link').attr('href').replace('profil','profil-ajax')
		}
		var thisBtn = this;
		var handleFriend = new CommandHandler({
			serviceURL: path,
			type: 'GET', 
			data: $(this).attr('rel'),
			bindOnClick: false,	
			successOnFailure: false,						
			success:	function (data) { 
							me.showStatus(data, fbtn.parent('div'), true);
							var el = fbtn.parent('div');
							el.text('');
							el.prepend($(data).find('response_data').text());
							if ($(thisBtn).attr('rel')=='friend=remove') {
								el.parent().find(".add_comment").hide();
							}		
							me.actualizeStatistics.sendCommand();
							setTimeout(function(){$('.mc_status_window').hide();},3000);
						},		
			failure: 	function (data) {
							me.showStatus(data, $('#mc_friend_attach'),true);
							setTimeout(function(){$('.mc_status_window').hide();},3000);
						} 				 
			});
		handleFriend.sendCommand();						
	});
	
	             
	this.sendEvent = new CommandHandler({ 
		serviceURL: '/event-ajax/?msg=add',
		type: 'POST',
		className: '#mc_event_send',
		bindOnClick: true,
		data: {mc_event_content: 'actualValue',
			  	msg: 'actualValue',
			  	mc_attach_content: 'actualValue'
			  },
		clearInputOnSuccess: true,
		success: 	function(data) {
						//me.showStatus(data, $('#mc_send_event strong'), true);
						me.actualizeStatistics.sendCommand(); 
						if ((typeof me.options !== 'undefined') && (me.options.dndMyEvent == true)) {
							me.showStatus(data, $('#mc_send_event .mc_form_container'), true); 
							return false;
						}   
						
						$("#mc_send_event #mc_event_content").height(15);
						$('.messages_container').prepend($(data).find('response_data').text());
						 
						var first = $('.messages_container .message').first();
						$(first).find('.mc_message_video_button').click(function(){
							$(this).toggle();
							$(this).next('.mc_message_video').toggle();
						});					
					},
		failure:	function(data) {
			        	me.showStatus(data, $('#mc_send_event strong'), true)
					}
	});
	this.sendPhoto = function(){  
		$('.mc_window').hide();
        var iForm = $('#mc_upload_iframe').contents().find('form');
        iForm.find('#mc_event_content').val($('#mc_event_content').val());
        iForm.submit();
		//iForm.find("input[type='text']").value="bla";
	}
	this.loadedPhoto = function() {
		 
		if ($('#mc_upload_iframe').contents().find("root").length > 0) {
			me.actualizeStatistics.sendCommand(); 
			$('#mc_event_content').val('');
			var status = $('#mc_upload_iframe').contents().find('status code').text();
			if ((typeof me.options !== 'undefined') && (me.options.dndMyEvent == true)) { 
				me.showStatus($('#mc_upload_iframe').contents(), $('#mc_send_event .mc_form_container'), true); 
				$("#mc_send_event .mc_message_switch.on").click();
				return false;
			} 
			
			if (status == 'OK') {   
				$('.messages_container').prepend($('#mc_upload_iframe').contents().find('response_data').text());
				$('#mc_event_content').val('');
				var first = $('.messages_container .message').first();
				$(first).find('.photo a').lightBox({fixedNavigation: false});		
			} else {    
				me.showStatus($('#mc_upload_iframe').contents(), $('#mc_event_content'), true);
			}
			$("#mc_send_event .mc_message_switch.on").click();
				
		}
		//alert($('#mc_upload_iframe').contents().find("root").length);
	}
	var sendMessage = new CommandHandler({
		serviceURL: '/event-ajax/?msg=' + $('form [name="mc_msg"]').val(),
		type: 'POST',
		className: '#mc_comment_send',
		bindOnClick: true,
		data: 		{
						mc_comment_content: 'actualValue', 
						mc_id: 'actualValue'
					},
		clearInputOnSuccess: true,
		success:	function(data) {   
						if(window.location.pathname == "/soukrome-zpravy") {
							$('.messages_container').prepend($(data).find('response_data').text());
						} else {                                                              
					    	$('.message [rel="' + $('form [name="mc_id"]').val() + '"]').parents('div.message').append($(data).find('response_data').text());
					    }
						$('#mc_reply_form').hide();
						//me.showStatus(data, $('#mc_reply_form'), true);
						me.actualizeStatistics.sendCommand();
						me.showStatus(data, $('#mc_reply_form'), true);	
						setTimeout(function(){$('.mc_window').hide();},2000);
					},
		failure:	function(data) {
			        	me.showStatus(data, $('#mc_reply_form'), true);
			        	setTimeout(function(){$('.mc_window').hide();},2000);
					}
	});
	this.sendInvite = new CommandHandler({
		serviceURL: '/invite-ajax/',
		type: 'POST',
		className: '#mc_invite_send',
		bindOnClick: true,
		data: 		{
						mc_invite_email: 'actualValue'
					},
		clearInputOnSuccess: true,
		success:	function(data) {   
						
						$('#mc_invite_form').hide();
						//me.showStatus(data, $('#mc_reply_form'), true);
						me.actualizeStatistics.sendCommand();
						me.showStatus(data, $('#mc_friend_invite'), true);	
						setTimeout(function(){$('.mc_window').hide();},2000);
					},
		failure:	function(data) {
			        	me.showStatus(data, $('#mc_friend_invite'), true);
			        	setTimeout(function(){$('.mc_window').hide();},2000);
					}	
	});
	this.sendVote = new CommandHandler({
		serviceURL: '/vote-ajax/',
		type: 'GET',
		className: '.add_vote',
		bindOnClick: true,
		getDataFromClick: true,
		success: function(data) {
			var id = $(data).find('id').attr('value');
			var cnt =  $('.messages_container [rel="vote=' + id + '"]').text(); 
			$('.messages_container span.vote' + id).text($(data).find('popular').attr('value'));
			//$('.messages_container [rel="vote=' + id + '"]').replaceWith(cnt);
			$('.messages_container [rel="vote=' + id + '"]').replaceWith('<span class="mc_ico mc_ico_popular"></span><span class="mc_black">' + $(data).find('popular').attr('value') + '</span>');
			
		},
		failure: function(data) {
			//alert($(data).text());
		}  
	});	//mc_button_load_older
	this.getMessages = new CommandHandler({
		serviceURL: '/messages-ajax/',
		type: 'GET',
		className: "#mc_button_load_older",
		success: function(data) {
			$("#mc_button_load_older").attr('rel',parseInt($("#mc_button_load_older").attr('rel')) + 1);
			$("#mc_button_load_older").click(function(){
				me.getMessages.setCommand({page: $(this).attr('rel')});
				me.getMessages.sendCommand();
				$("#mc_button_load_older").unbind('click');	
			});
			$('.messages_container').append($(data).find('response_data').text());
			if ($(".messages_container .message .photo")) {
				$('.photo a').each(function() {
					$(this).lightBox({fixedNavigation: false});
				});
			}
		},
		failure: function(data) {     
			$("#mc_button_load_older").text($(data).find('description').text());
		}
	});
	this.sendImpEmail = new CommandHandler({
		serviceURL: '/improvment-ajax/',
		type: 'POST',
		className: '#mc_profile_send_imp',
		bindOnClick: true,
		data: 		{
						mc_info_imp_text: 'actualValue'
					},
		clearInputOnSuccess: true,
		success:	function(data) {                                                                   
			        	me.showStatus(data, $('#mc_profile_send_imp').parent(), true);
						setTimeout(function(){$('.mc_window').hide();},3000);	
					},
		failure:	function(data) {
			        	me.showStatus(data, $('#mc_profile_send_imp').parent(), true);
			        	setTimeout(function(){$('.mc_window').hide();},3000);
					}
	});	
	this.blinkHandler = false;
	this.actualizeStatistics = new CommandHandler({
		serviceURL: '/statistics-ajax/',
		type: 'GET',
		success: function(data) { 
			var pms = $(data).find('newpm').attr('value');
			var pmsEl = $('.mc_new_pm'); 
			if (pms != "0") {
				pmsEl.show();
				pmsEl.css("color","black");
				//pmsEl.prev('a').find(".mc_value").addClass("strong");
				var pmsIco = $('#mc_ico_moje_zpravy');
				if (!me.blinkHandler) { 
					me.blinkHandler = setInterval(function() {pmsIco.toggleClass('mc_ico mc_blank_ico');},579);
				}	
			} else {
				//pmsEl.hide();
				pmsEl.css("color","white");
				pmsEl.prev('a').find(".mc_value").removeClass("strong");
			}  
			pmsEl.text( pms );   
			//$('.mc_new_msgs').text($(data).find('msgs').attr('value'));
			$('.mc_friends').text($(data).find('friends').attr('value'));
		}          
	}); 
	this.actualizeStatistics.sendCommand();           
	setInterval(function() {me.actualizeStatistics.sendCommand()},15000);
	this.bindButtons();

}  

MediClub.prototype.bindButtons = function() { 
	var me = this;

//tlacitka pro komentare
	$('.add_comment').live('click',function(){ 
		$('form [name="mc_id"]').val($(this).attr('rel'));
		$(this).parent().css('position','relative');
		$(this).parent().append($('#mc_reply_form'));
		$('#mc_reply_form .mc_top_arrow').css('left',parseInt($(this).position().left + 20)  + 'px'); 
		$('#mc_reply_form').width($(this).parents('div.message_inner_container').outerWidth());
		$('#mc_reply_form').show();
		$('#mc_comment_content').focus(); 
	});
	
//tlacitko pro pozvanku	
	$("#mc_friend_invite").click(function(){ 
		$('#mc_invite_form').show();
		$('#mc_invite_email').focus(); 
	});
	
//editace formu	
	$('#mc_profile_edit').click(function(){ 
		$('.mc_info_container').hide(); 
		me.setForm();
	});
	
//zavirani statusoveho okna	
	$('.mc_close').click(function(){
		$(this).parents('.mc_window').hide();
	});
//prepinani pritele	
	$('.mc_more_friends').click(function () {
		$("#mc_friends_container").toggle();	
		$("#mc_potencional_friends").toggleClass("mc_potencional_friends_default");
		$("#mc_potencional_friends").toggleClass("mc_potencional_friends_all");
	});
	
//rozevirani boxu s prateli	
	$("#mc_top_banner_bottom, .mc_more_friends_top_banner").click(function (){
    	$(".messages_container, #mc_top_banner_bottom, .mc_bottom_menu, #mc_potencional_friends").toggleClass("compact");                                    
    });

//upload obrazku    
    $("#mc_image_upload_button .mc_upload_form_button").click(function(){
		$("#mc_image_upload_form").show();		
	});

//odeslani obrazku 
	$("#mc_event_send_photo").click(this.sendPhoto);
	
		
//prepinani typu zpravy
	$("#mc_send_event .mc_message_switch").click(function() {
		$("#mc_send_event .mc_message_switch").removeClass('on');
		$(this).addClass('on');
		var rel = $(this).attr('rel');
		$('#mc_send_event [name="msg"]').val(rel);
		$("#mc_event_attachment .attachment_info, #mc_event_content_descr span").hide();
		if (rel != 'event') {
			//#mc_send_event #mc_event_content.top_border {border-top: none; padding: 6px 3px 5px 78px; width: 382px; }
			$(".attachment_info." + rel + ", #mc_event_content_descr span." + rel).show();	
			$("#mc_attach_content_container, #mc_event_content_descr, #mc_event_attachment").show();
			$("#mc_event_content").addClass('top_border');
			$("#mc_attach_content").focus();
			$("#mc_resize_area").css("width","382px");
			$("#mc_send_event #mc_event_content.top_border").css("padding","6px 3px 5px 78px").css("width","382px");
		} else {
			$("#mc_event_content").focus();
			$("#mc_event_content").removeClass('top_border');
			$("#mc_attach_content_container, #mc_event_content_descr, #mc_event_attachment").hide();
			$("#mc_send_event #mc_event_content").css("padding","3px").css("width","457px");
			$("#mc_resize_area").css("width","457px");
		}
		$("#mc_attach_content").removeClass();
		$("#mc_attach_content").addClass(rel);
		$('#mc_upload_iframe').remove();
		if (rel == 'photo') {
			$("#mc_event_content").focus();
			$("#mc_attach_content_container").hide();
			var iFrame = $("#mc_upload_iframe_container");
			$('<iframe id="mc_upload_iframe" onload="mc_content.loadedPhoto();" frameborder="0" border="0" scrolling="no" ></iframe>').load(function(){
    			$('#mc_upload_iframe').contents().find('body').html('<form action="/event-ajax/?msg=photo" method="post" enctype="multipart/form-data"><input type="hidden" id="mc_event_content" name="mc_event_content" value=""/><input type="file" value="" id="mc_image" name="mc_image"></form>');
    			$('#mc_upload_iframe').contents().find('body').css('margin','0');
    			$('#mc_upload_iframe').contents().find('body').css('background-color','transparent');
    			//$('#mc_upload_iframe').contents().find('body input[type="submit"]').hide();
			}).appendTo(iFrame);
			iFrame.show();		
			$("#mc_event_send_photo").show();
			$("#mc_event_send").hide();
		} else {
			$("#mc_upload_iframe_container").hide();
			$("#mc_event_send_photo").hide();
			$("#mc_event_send").show();
		}

	});	
	$("#mc_event_content_descr").hover(function(){
		$("#mc_event_content").addClass('pink');
	},function(){
	    $("#mc_event_content").removeClass('pink');
	});
	
	$("#mc_event_content_descr").click(function(){
		$("#mc_event_content").focus();	
	});
	$("#mc_event_attachment").click(function(){
		if (!$(this).find(".photo").is(':visible')) {
			$("#mc_attach_content").focus();	
		} else {
			//$('#mc_upload_iframe').contents().find('#mc_image').focus();	
		}
	});
	
		
	
//prepinac videi 
	$(".messages_container .message .mc_message_video_button").live('click',function(){
		$(this).toggle();
		$(this).next('.mc_message_video').toggle();
	});
	
//zapnuti lightboxu
	if ($(".messages_container .message .photo")) {
		$('.photo a').each(function() {
			$(this).lightBox({fixedNavigation: false});
		});
	}
	
//odeslani na shift + enter
	$("#mc_event_content").keypress(function(e){
		if(e.keyCode == 13 && e.shiftKey == true) {                
    	    me.sendEvent.sendCommand();   
	    }
	});

	$("mc_invite_message").submit(function(e){
		return false;
	});
			
//nacteni starsich zprav
	$("#mc_button_load_older").click(function(){
		me.getMessages.setCommand({page: $(this).attr('rel')});
		me.getMessages.sendCommand();
		$("#mc_button_load_older").unbind('click');	
	});	
//textarea handler	
	$('#mc_event_content').autoResize({
	    animate : false,
	    extraSpace : 0,
	    charLimit : 500,
	    id : 'mc_resize_area',
	    onReachCharLimit: function() { 
			me.showStatus($('<div><description>'+ $('#mc_reach_limit_msg').text() +'</description></div>'),$(this).parent());
		}
	});	
/*	$("#mc_invite_content").autoResize({
	    animate : false,
	    extraSpace : 0,
	    charLimit : 500,
	    onReachCharLimit: function() { 
			me.showStatus($('<div><description>'+ $('#mc_reach_limit_msg').text() +'</description></div>'),$('#mc_reply_form'), '250');
		}
	});     */
	$('#mc_comment_content').autoResize({
	    animate : false,
	    extraSpace : 0,
	    charLimit : 500,
	    onReachCharLimit: function() { 
			me.showStatus($('<div><description>'+ $('#mc_reach_limit_msg').text() +'</description></div>'),$('#mc_reply_form'), '250');
		}
	});		
}
MediClub.prototype.setForm = function() {
	var me = this;
	$('.mc_editable').each(function(){
		if ($(this).is('.mc_fr_vchar')) {
			$(this).replaceWith('<input type="text" class="' + $(this).attr('class') + '" id="mc_' + $(this).attr('rel') + '" name="mc_' + $(this).attr('rel') + '" value="' + $(this).text() + '" />');
		}
		if ($(this).is('.mc_fr_select')) {
			me.createSelectFromAjax($(this));
		}
	});
	//$('#mc_profile_edit').text("Uložit");
	$('#mc_profile_edit').unbind();
	$('#mc_profile_edit .mc_save, #mc_profile_edit .mc_edit').toggle();
	$("#mc_image_upload_button").show();
	$(".mc_notifikace").show();
	$('#mc_profile_edit').click(function(){
		$('#mc_edit_profile').submit();
	});
}
MediClub.prototype.unsetForm = function() {
	var me = this;
	$('.mc_editable').each(function(){
		if ($(this).is('.mc_fr_vchar')) {
			$(this).replaceWith('<span class="' + $(this).attr('class') + '" rel="' + $(this).attr('name').replace('mc_','') + '" >' + $(this).val() + '</span>');
		}
	});
	$('#mc_profile_edit').unbind();
	$('#mc_profile_edit').click(function(){
		me.setForm();
	});
}
MediClub.prototype.createSelectFromAjax = function(el) {
	var dataHandler = new CommandHandler({
		serviceURL: '/' + el.attr('link') + '/',
		type: 'GET',
		success: function(data) {
			var sB = $('<select class="' + el.attr('class') + '" id="mc_' + el.attr('rel') + '" name="mc_' + el.attr('rel') + '" ></select>');
			sB.append("<option value=\"0\">žádné</option>");
			$(data).find('element').each(function(){
				sB.append("<option value=\"" + $(this).find('id').attr("value") + "\">" + $(this).find('name').attr("value") + "</option>");
			});
			sB.val(el.attr("intval"));
			el.replaceWith(sB);
			//el.replaceWith('<select class="' + el.attr('class') + '" id="mc_' + el.attr('rel') + '" name="mc_' + el.attr('rel') + '" ></select>');
		}         
	});	
	dataHandler.sendCommand();
}
MediClub.prototype.getSubPath = function() {
	subPath = window.location.pathname.split('/');
	return subPath[2];
}

MediClub.prototype.showStatus = function(data, el, replace) {
	el.parent().css('position','relative');		
	var pos = el.position();
	var win = $("#mc_status_window");
	el.parent().append(win);	
	if (replace === true) { 
		win.position(pos);
		win.css('margin-left',el.css('margin-left'));
	} else {		
		win.css('margin','10px 0 0 0');
		
		//win.css('bottom','-' + win.outerHeight() + 'px');
		win.css('bottom','-56px');
		if (replace !== false) {
			win.css('bottom', '-' + replace + 'px');
		}
		win.css('left',pos.left + 'px');
	}
	win.find('.mc_status_window_content').text($(data).find('description').text());
	win.show();
	//setTimeout(function(){win.hide()},2000);
//	alert($(data).find('description').text());
} 

function CommandHandler(options) {        
	var me = this;
	this.options = options;
	this.options.dataOperation = new Array();
	if (this.options.bindOnClick) {
		$(this.options.className).live('click',function() {
           	if (me.options.getDataFromClick) {
				me.options.data = $(this).attr('rel'); 	
			} 
			me.sendCommand();
		});
	}
	if (this.options.data != undefined) {
		for(var key in this.options.data){
      		if (this.options.data[key] == 'actualValue') {
		  		this.options.dataOperation[key] = 'actualValue';
			}
		}
   	}
}
CommandHandler.prototype.sendCommand = function() {
	var me = this;

	$('.mc_loading').show();
	if (this.options.data != undefined) {
		this.prepareDataToSend();
	}
	if (this.options.bindOnClick) {
		$('.mc_window').hide();
	}
	$.ajax({
		type:	this.options.type,
  		url:	this.options.serviceURL,
  		data: 	this.options.data || this.getCommand(),  
		dataType: "xml",
		complete: function(bla,data) {
			//$('.mc_loading').hide();
  
			//alert('status' + me.options.data);
			//alert('status:' + $(data).text());
			//alert('status' + data);
		}, 
  		success: function(data, textStatus) {
    		me.onComplete(data,textStatus);
		}
	});
}
CommandHandler.prototype.onComplete = function(data, status) {
	this.status = $(data).find('status code').text();
	if (this.status == 'OK') {   
		if (typeof(this.options.success) == 'function') {		
			this.options.success(data);
		}
		if (this.options.clearInputOnSuccess){
			this.clearData();
		}
	} else { 
	    if (typeof(this.options.failure) == 'function') {            
			this.options.failure(data);
		} else if(this.options.successOnFailure == true) { 
			if (typeof(this.options.success) == 'function') {		
				this.options.success(data);
			}	
		}
	}
}
CommandHandler.prototype.prepareDataToSend = function() {	
	for(var key in this.options.data){
      if (this.options.dataOperation[key] == 'actualValue') {
	  	this.options.data[key] = $('form [name="' + key + '"]').val();
	  }
   	}

}
CommandHandler.prototype.clearData = function() {
	//alert(typeof this.options.data);	
	for(var key in this.options.data){
		if (key != 'msg') {
	  		$('form [name="' + key + '"]').val("");
	  	}
   }

}
CommandHandler.prototype.getCommand = function() {  
	return $(this.options.className).attr('rel');
}
CommandHandler.prototype.setCommand = function(data) {  	
	if (this.options.data != 'undefined') {   
		this.options.data = new Array();
		this.options.data = data;			
	}
}
var mc_content;
$(document).ready(function(){
	if ($("#mediclub").length > 0) {
		var options;
		if ($('#mc_top_banner').length > 0) {
			options = {dndMyEvent: true}				
		}
		mc_content = new MediClub(options);
			
	}
	if ($("#login-container").length > 0) {
		$("#login-container .hover, #login-container .attachbox").mouseenter(function(){
			$("#login-container .attachbox").show();
		});
	}
	if ($("#login-container").length > 0) {
		$("#login-container .hover, #login-container .attachbox").mouseleave(function(){
			$("#login-container .attachbox").hide();
		});
	}  
});
/*
 * jQuery autoResize (textarea auto-resizer)
 * @copyright James Padolsey http://james.padolsey.com
 * @version 1.04
 */

(function($){
    
    $.fn.autoResize = function(options) {
        
        // Just some abstracted details,
        // to make plugin users happy:
        var settings = $.extend({
            onResize : function(){},
            animate : true,
            animateDuration : 150,
            animateCallback : function(){},
            extraSpace : 20,
            limit: 150
        }, options);
        
        // Only textarea's auto-resize:
        this.filter('textarea').each(function(){
            
                // Get rid of scrollbars and disable WebKit resizing:
            var textarea = $(this).css({resize:'none','overflow-y':'hidden'}),
            
                // Cache original height, for use later:
                origHeight = textarea.height(),
                
                // Need clone of textarea, hidden off screen:
                clone = (function(){
                    
                    // Properties which may effect space taken up by chracters:
                    var props = ['height','width','lineHeight','textDecoration','letterSpacing','font-size','font-style','font-family'],
                        propOb = {};  
                    // Create object of styles to apply:
                    
                    $.each(props, function(i, prop){
                        propOb[prop] = textarea.css(prop);
                    });
                    
                    
                    // Clone the actual textarea removing unique properties
                    // and insert before original textarea:
                    
					
                    var resizeArea = textarea.clone().removeAttr('id').removeAttr('name').css({
                        position: 'absolute',
                        top: 0,
                        left: -9999
                    }).css(propOb).attr('tabIndex','-1').insertBefore(textarea);
                    if (settings.id != '') {
						resizeArea.attr('id', settings.id);
					}
                    return resizeArea;
                    
                })(),
                lastScrollTop = null,
                updateSize = function() {
					
                    // Prepare the clone:
                    clone.height(0).val($(this).val()).scrollTop(10000);
					if ($(this).val().length >= settings.charLimit) {
						$(this).val($(this).val().substring(0,settings.charLimit));
						settings.onReachCharLimit.call(this);
					} 
                    // Find the height of text:
                    var scrollTop = Math.max(clone.scrollTop(), origHeight) + settings.extraSpace,
                        toChange = $(this).add(clone);
						
                    // Don't do anything if scrollTip hasen't changed:
                    if (lastScrollTop === scrollTop) { return; }
                    lastScrollTop = scrollTop;
					
                    // Check for limit:
                    if ( scrollTop >= settings.limit ) {
                        $(this).css('overflow-y','');
                        return;
                    }
                    // Fire off callback:
                    settings.onResize.call(this);
					
                    // Either animate or directly apply height:
                    settings.animate && textarea.css('display') === 'block' ?
                        toChange.stop().animate({height:scrollTop}, settings.animateDuration, settings.animateCallback)
                        : toChange.height(scrollTop);
                };
            
            // Bind namespaced handlers to appropriate events:
            textarea
                .unbind('.dynSiz')
                .bind('keyup.dynSiz', updateSize)
                .bind('keydown.dynSiz', updateSize)
                .bind('change.dynSiz', updateSize);
            
        });
        
        // Chain:
        return this;
        
    };
    
    
    
})(jQuery);
