$(document).ready(function() {
	
	$('.tx-wsveranstaltungen-list-item td.tickets').find('a').each(function() {
		$(this).attr('href',$(this).attr('href') + '?t=block');
	});
	$('.tx-wsveranstaltungen-list-item td.tickets').each(function() {
		if ($(this).html() == 'Tickets') {
			$(this).html('');
		}
	});
	
	// Miniscrollbars für die Teaserboxen
	$(".tbinner div").jScrollPane({
		'scrollbarWidth': '3'
	});

	
	/* -------------------------- 3D-Newsscroller am rechten Rand --------------------------- */
	if ($('#newsscroller').length > 0) {
		$(".scrollbereich").jCarouselLite({
			auto: 3000,
			vertical: true,
			speed: 500,
			//visible: 2.3,
			visible: 2.5,
			mouseWheel: true,
			btnNext: ".prev",
			btnPrev: ".next"
		});
		$('.prev').mouseover(function() {
			$('#newsscroller').css({
				'background-position': '0 490px' 
			});
		}).mouseout(function() {
			$('#newsscroller').css({
				'background-position': '0 0' 
			});
		});
		$('.next').mouseover(function() {
			$('#newsscroller').css({
				'background-position': '0 245px' 
			});
		}).mouseout(function() {
			$('#newsscroller').css({
				'background-position': '0 0' 
			});
		});
	}
	/* ------------------------- ENDE 3D-Newsscroller am rechten Rand -------------------------- */

	
	/* ------------------------- Ausklapp-Menüs am rechten Rand -------------------------- */
	var count1 = 1;
	$('.eventsearchtitle').click(function(){
		if ($(this).attr('rel') == 'auf') count3++;
		$(this).attr('rel',''); // wird gebraucht, wenn zu Begin das DIV geöffnet ist
        if ($(this).attr('rel') == 'auf') { $(this).attr('rel') = ''; }
		$('.eventsearchcontent').toggle('blind');
		if (count1++ % 2 == 0) {
            $('.eventsearchtitle').css('background-image','url(fileadmin/templates/img/servicebutton_zu.png)');
        } else {
            $('.eventsearchtitle').css('background-image','url(fileadmin/templates/img/servicebutton_auf.png)');
        }
    });
	var count2 = 1;
	$('.servicetitle').click(function(){
		if ($(this).attr('rel') == 'auf') count2++;
		$(this).attr('rel','');
		if ($(this).attr('rel') == 'auf') { $(this).attr('rel') = ''; }
        $('.servicecontent').toggle('blind');
		if (count2++ % 2 == 0) {
            $('.servicetitle').css('background-image','url(fileadmin/templates/img/servicebutton_zu.png)');
        } else {
            $('.servicetitle').css('background-image','url(fileadmin/templates/img/servicebutton_auf.png)');
        }
    });
	var count3 = 1;
	$('.eventcalendartitle').click(function() {
		if ($(this).attr('rel') == 'auf') count3++;
		$(this).attr('rel','');
        $('.eventcalendarcontent').toggle('blind');
		if (count3++ % 2 == 0) {
            $('.eventcalendartitle').css('background-image','url(fileadmin/templates/img/servicebutton_zu.png)');
        } else {
            $('.eventcalendartitle').css('background-image','url(fileadmin/templates/img/servicebutton_auf.png)');
        }
    });
	/* -------------------------- ENDE ... am rechten Rand --------------------------- */
	
	
	/* -------------------------- Hauptnavigation --------------------------- */
	$('ul.menu2').mouseover(function() {
		$(this).prev().css('background','transparent url(fileadmin/templates/img/navm_act.png) 0 0 no-repeat');
	}).mouseout(function() {
		$(this).prev().css('background','');
	});
	$('ul.menu li:first').mouseover(function() {
		//alert("getz");
		$(this).children('a').css('background-image','url()');
	});
	$('ul.menu li:first').css('font-weight','bold');
	$('ul.menu2 li:last-child a').css('border','0');
	$('ul.menu3').append('<li class="navfoot"></li>');
	/* -------------------------- ENDE ... Hauptnavigation --------------------------- */

	
	/* -------------------------- Headerbanner --------------------------- */
	$('#s3slider').s3Slider({
		timeOut: 4000
	});
	/* -------------------------- ENDE Headerbanner --------------------------- */

	/* -------------------------- Buttontest, ob disabled --------------------------- */
	var arri;
	$('body').find('.tickets a').each(function() {
		if ($(this).text() == 'ausverkauft' || $(this).text() == 'nicht öffentlich') {
			$(this).css('background-image','url("fileadmin/templates/img/buttonbackdisabled.gif")');
			$(this).removeAttr('href');
		}
		if ($(this).text() == '') {
			$(this).text('Tickets');
		}
	});
	/* -------------------------- ENDE Buttontest --------------------------- */
	
		
	/* -------------------------- Sitzplan --------------------------- */
	$('.sitzplanbild').html($('.sitzplanbild').attr('rel'));
	$('#smap_a').mouseover(function() {
		$('.sitzplanbild').html('<img src="fileadmin/sitzplan/blocka.jpg" />');
		$('.sitzplanbild').next().html('Großer Saal, Block A');
		$('.spriteplan').css('background-position','0 -225px');
	}).mouseout(function() {
		//$('.sitzplanbild').html('');
		//$('.sitzplanbild').next().html('&nbsp;');
		$('.spriteplan').css('background-position','0 0');
	});
	$('#smap_b').mouseover(function() {
		$('.sitzplanbild').html('<img src="fileadmin/sitzplan/blockb.jpg" />');
		$('.sitzplanbild').next().html('Großer Saal, Block B');
		$('.spriteplan').css('background-position','0 -450px');
	}).mouseout(function() {
		//$('.sitzplanbild').html('');
		//$('.sitzplanbild').next().html('&nbsp;');
		$('.spriteplan').css('background-position','0 0');
	});
	$('#smap_c').mouseover(function() {
		$('.sitzplanbild').html('<img src="fileadmin/sitzplan/blockc.jpg" />');
		$('.sitzplanbild').next().html('Großer Saal, Block C');
		$('.spriteplan').css('background-position','0 -675px');
	}).mouseout(function() {
		//$('.sitzplanbild').html('');
		//$('.sitzplanbild').next().html('&nbsp;');
		$('.spriteplan').css('background-position','0 0');
	});
	$('#smap_d').mouseover(function() {
		$('.sitzplanbild').html('<img src="fileadmin/sitzplan/blockd.jpg" />');
		$('.sitzplanbild').next().html('Großer Saal, Block D');
		$('.spriteplan').css('background-position','0 -900px');
	}).mouseout(function() {
		//$('.sitzplanbild').html('');
		//$('.sitzplanbild').next().html('&nbsp;');
		$('.spriteplan').css('background-position','0 0');
	});
	$('#smap_e').mouseover(function() {
		$('.sitzplanbild').html('<img src="fileadmin/sitzplan/blocke.jpg" />');
		$('.sitzplanbild').next().html('Großer Saal, Block E');
		$('.spriteplan').css('background-position','0 -1125px');
	}).mouseout(function() {
		//$('.sitzplanbild').html('');
		//$('.sitzplanbild').next().html('&nbsp;');
		$('.spriteplan').css('background-position','0 0');
	});
	$('#smap_f').mouseover(function() {
		$('.sitzplanbild').html('<img src="fileadmin/sitzplan/blockf.jpg" />');
		$('.sitzplanbild').next().html('Kleiner Saal, Block F');
		$('.spriteplan').css('background-position','0 -1350px');
	}).mouseout(function() {
		//$('.sitzplanbild').html('');
		//$('.sitzplanbild').next().html('&nbsp;');
		$('.spriteplan').css('background-position','0 0');
	});
	$('#smap_g').mouseover(function() {
		$('.sitzplanbild').html('<img src="fileadmin/sitzplan/blockg.jpg" />');
		$('.sitzplanbild').next().html('Kleiner Saal, Block G');
		$('.spriteplan').css('background-position','0 -1575px');
	}).mouseout(function() {
		//$('.sitzplanbild').html('');
		//$('.sitzplanbild').next().html('&nbsp;');
		$('.spriteplan').css('background-position','0 0');
	});
	$('#smap_h').mouseover(function() {
		$('.sitzplanbild').html('<img src="fileadmin/sitzplan/galerie.jpg" />');
		$('.sitzplanbild').next().html('Galerie');
		$('.spriteplan').css('background-position','0 -1800px');
	}).mouseout(function() {
		//$('.sitzplanbild').html('');
		//$('.sitzplanbild').next().html('&nbsp;');
		$('.spriteplan').css('background-position','0 0');
	});
	$('#smap_k').mouseover(function() {
		$('.sitzplanbild').html('<img src="fileadmin/sitzplan/galerie.jpg" />');
		$('.sitzplanbild').next().html('Galerie');
		$('.spriteplan').css('background-position','0 -1800px');
	}).mouseout(function() {
		//$('.sitzplanbild').html('');
		//$('.sitzplanbild').next().html('&nbsp;');
		$('.spriteplan').css('background-position','0 0');
	});
	/* -------------------------- ENDE Sitzplan --------------------------- */
	
	$('.datepick-nav a.datepick-cmd-prev').html('wech');
	
	/* Presse-Punkt im Headermenü grün machen */
	$('#navi-top li a').each(function() {
		if ($(this).text() == "Presse") $(this).css('color','#279d2e');
	});
	
	
	/* -------------------------- Event-Detailseite --------------------------- */
	// Ticketbutton ausblenden, wenn keine Tickets vorhanden
	var sindticketsda = ' ' + $('#hiersindticketszukaufen').html();
	if (sindticketsda.length < 20) {
		$('.tx-wsveranstaltungen-single-ticketform').css('display','none');
		$('.tx-wsveranstaltungen-single-flyout').css('display','none');
	}
		
	// Bildkorrektur
	$('#tx-wsveranstaltungen-single-data-left').find('img').removeAttr('height');
	$('#tx-wsveranstaltungen-single-data-left').find('img').removeAttr('width');
	
	// Ticketlayer ausblenden, wenn t=block
	var myurl = document.URL;
	var mysearch = myurl.search(/t=block/);
	
	if(mysearch == -1) {
		$('.tx-wsveranstaltungen-single-flyout').css('display','none');
	}
	/* -------------------------- ENDE Event-Detailseite --------------------------- */
	
	$('#killmeself').live('click',function() {
		Check = confirm("Wollen Sie wirklich Ihr Konto löschen?");
		if (Check) {
			var para = jQuery(this).attr('rel');
			//url = 'typo3conf/ext/sr_feuser_register/killmeself.php?para=' + para;
			//window.open(url,'Konto löschen','width=500,height=400');
			
			jQuery.get('typo3conf/ext/sr_feuser_register/killmeself.php?para=' + para, { wert: '' }, function (data) { 
				var daten = data;
				if (daten == '1') {
					alert('Ihr Konto wurde gelöscht');
					document.location.reload();
				}
			});
			
		}
	});
	

});



/* -------------------------- Funktionen für die Hauptnavigation --------------------------- */
function show(element) {
	element.className += "hover";
}
function hide(element){
	element.className = element.className = "";
}
/* -------------------------- ENDE Funktionen für die Hauptnavigation --------------------------- */




