(function($){
	$.fn.inputDefaultText = function(options)
	{
		options = $.extend({
			text: 'Hledany vyraz'
		}, options);
	
		return this
			.val(options.text)
			.bind('focus', function(){ if(this.value == options.text) this.value = ''; })
			.bind('blur', function(){ if(this.value == '') this.value = options.text; });
	};
	$.fn.skGet = function(get, dimension, callback) {
		if(!this.length){
			return this;
		}
		
		var result;
		var m = Math[get];
		this.each(function(index) {
			var newResult = $(this)[dimension]();
			result = index ? m(result, newResult) : newResult;
		});
		
		if(typeof callback == 'function'){
			callback.call(this, result);
			return this;
		}
		
		return result;
	};
	
	$(document).ready(function(){
    	
        // table
    	$('.wysiwyg table')
    		.not('.reset')
    		.wrap('<div class="table-wrap"></div>')
    		.find('tbody tr:odd')
    			.addClass('even')
    			.end()
    			
    	$('.wysiwyg hr')
    		.wrap('<div class="separator"></div>')
    		.hide();
    	
    	/* placeholer with hmtl 5 fallback */
		function supports_input_placeholder() {
		  var i = document.createElement('input');
		  return 'placeholder' in i;
		}
		
    	if(!supports_input_placeholder()){
			$('input[placeholder], textarea[placeholder]').each(function(){
				var text = $(this).attr('placeholder'); 
				$(this).inputDefaultText({text: text});
			});
		}	
		
		// Antispam
		$('.antispam').each(function(index) {
			$(this).find('input').val($(this).data('antispam'));
		});
		
		

		
    });

})(this.jQuery);



