$(document).ready(function($) {
	$('.mobilenav').hcOffcanvasNav({
		maxWidth: 1000,
		customToggle: '.menuswitch',
		labelClose: '',
		labelBack:''
	});
	$( ".keywords a" ).click(function() {
		if($(this).attr("href").search(/ä|ö|ü|ß| /gi) >=0) {
			$( "#sword" ).attr('value',$(this).text());
			$( "#tx_indexedsearch" ).submit();
			return false;
		}
	});
	$( "p").each(function(index) { 
		if($(this).text().isChar(" ",100) && $(this).text().isChar(". ",100) && !$(this).text().isChar(";",1)) {
			//console.log($(this).parent());
			$(this).parent().addClass('mobile-hide');
		}
	});
	if ($( window ).width()<=450) {
		$( "iframe").each(function(index) { 
			if($(this).attr('src').search("player.vimeo.com")) {
				$(this).parent().parent().next('div').addClass('mobile-hide');
			}
		});
		/*
		$('.breadcrumb').fadeOut();
		breadcrump = $('.breadcrumb').detach().insertAfter(".maincontent");
		$('.breadcrumb').css('margin-top','30px');
		$('.breadcrumb').fadeIn();
		*/
		searchbox = $('.searchbox').detach().insertAfter(".maincontent");
	} else {
		$('.breadcrumb').css('margin-top','15px');
	}
	
	if ($( window ).width()<1000) {
		$( ".innennav a>span" ).on( "click", function() {
			$(this)
				.toggleClass('open')
				.parent().next('ul.innensubnav').slideToggle('slow');
			return false;
		});
	}
});

String.prototype.isChar=function(s,a) {
  if(this.split(s).length-1>=a) return true; return false;
}
