(function ($) {
$.fn.clearSearchField = function() {
	$('#col2_content input.tx-solr-q').click(
		function() {
			if ($(this).val() == 'Suchen') {
				$(this).val('');
			}
		});
	$('#col2_content input.tx-solr-q').blur(
		function() {
			if ($(this).val() == '') {
				$(this).val('Suchen');
			}
	});
};


$.fn.equalHeight = function () {
	if ($('.columns').length >= 1 ) {
		$("div.columns").each(function(i) {
			if($(this).parent(".tx-dkdcolumns-pi1").length >=1){
				col_one_height = $(this).children('.column-1').height();
				col_two_height = $(this).children('.column-2').height();

				if (col_one_height > col_two_height) {
					$(this).children('.column-1').css({
						'height': col_one_height+5
					});
					$(this).children('.column-2').css({
						'height': col_one_height+5
					});
				} else {
					$(this).children('.column-1').css({
						'height': col_two_height+5
					});
					$(this).children('.column-2').css({
						'height': col_two_height+5
					});
				}
			}else{
				var col_height = new Array();
				col_height[0] = $(this).children("div.col1").height();
				col_height[1] = $(this).children('.col2').height();
				col_height[2] = $(this).children('.col3').height();
				height = 0;
				for(i=0;i<3;i++){
					if(col_height[i]>height){
						height=col_height[i];
					}
				}
				$(this).children('.col1').css({
						'height': height+5
				});
				$(this).children('.col2').css({
						'height': height+5
				});
				$(this).children('.col3').css({
					'height': height+5
				});
			}
		});
	}

	if ($('.columns').length >= 1 ) {
		$("div.columns").each(function(i) {
			if($(this).parent(".kb_nescafe_columns").length >=1){
				col_one_height = $(this).children('.column-1').height();
				col_two_height = $(this).children('.column-2').height();

				if (col_one_height > col_two_height) {
					$(this).children('.column-1').css({
						'height': col_one_height+5
					});
					$(this).children('.column-2').css({
						'height': col_one_height+5
					});
				} else {
					$(this).children('.column-1').css({
						'height': col_two_height+5
					});
					$(this).children('.column-2').css({
						'height': col_two_height+5
					});
				}
			}else{
				var col_height = new Array();
				col_height[0] = $(this).children("div.col1").height();
				col_height[1] = $(this).children('.col2').height();
				col_height[2] = $(this).children('.col3').height();
				height = 0;
				for(i=0;i<3;i++){
					if(col_height[i]>height){
						height=col_height[i];
					}
				}
				$(this).children('.col1').css({
						'height': height+5
				});
				$(this).children('.col2').css({
						'height': height+5
				});
				$(this).children('.col3').css({
					'height': height+5
				});
			}
		});
	}
}
})(jQuery);
$(document).ready(function(){
		$(this).equalHeight();
		$(this).clearSearchField();
});

