$(document).ready(function(){

	$('.scroll-pane').jScrollPane({showArrows:true});

	$('a.lightbox').fancybox({
		'overlayShow': true,
		'overlayOpacity': 0.9
	});
    
	$('a.flashbox-800x600').fancybox({
		'overlayShow': true,
		'overlayOpacity': 0.9,
        'frameWidth': 800,
        'frameHeight': 600
	});
    
    $('.flashbox-autoshow').trigger('click');

	if($.browser.msie && $.browser.version < 7) {
		$('#InfinityLogo').attr('src', '/fileadmin/img/infinity-club.jpg');
	}

	$('.tips').cluetip({
		width: 430
	});

	setInterval('shoutbox_getEntries()', '30000');
    
    $('.events-dynamic p.image-link a').click(function(e) {
        e.preventDefault();
        $(this).parent().next().slideToggle();
    });
});

function showPaidInformation(value) {
    value = parseInt(value);
    var el = $('#paidInformation');
    if (value >= 2 && value <=4) {
        el.slideDown();
        $('#reservateButton').val('Bezahlen und reservieren');
    }
    else {
        el.slideUp();
        $('#reservateButton').val('Kostenlos reservieren');
    }
}

function validatePayPalForm() {

    if ($("input[name='agb']").is(':checked')) {
        return true;
    }

    alert('Sie müssen unsere AGBs akzeptieren');
    return false;
}

function CheckLen(Target) {
	var maxlength = "200";
	var StrLen=Target.value.length;
	if (StrLen==1&&Target.value.substring(0,1)==" ") {
		Target.value="";
		var StrLen=0;
	}
	if (StrLen>maxlength ) {
		Target.value=Target.value.substring(0,maxlength);
		var CharsLeft=0;
	}
	else {
		var CharsLeft=maxlength-StrLen;
	}
	$('#CharsLeft').html(CharsLeft+" Zeichen frei");
}