// Sifr
if(typeof sIFR == "function"){
	sIFR.replaceElement(named({sSelector:".box h2 span", sFlashSrc:"fileadmin/js/sifr/fagocoblack.swf",sWmode:"transparent", sColor:"#FFFFFF", sLinkColor:"#FFFFFF", sHoverColor:"#FFFFFF", sCase: "upper", nPaddingTop:0, nPaddingBottom:0}));
	sIFR.replaceElement(named({sSelector:"#menusub h2 span", sFlashSrc:"fileadmin/js/sifr/fagocoblack.swf",sWmode:"transparent", sColor:"#FFFFFF", sLinkColor:"#FFFFFF", sHoverColor:"#FFFFFF", sCase: "upper", nPaddingTop:0, nPaddingBottom:0}));
	sIFR.replaceElement(named({sSelector:"h1 span", sFlashSrc:"fileadmin/js/sifr/fagocoblack.swf",sWmode:"transparent", sColor:"#000000", sLinkColor:"#000000", sHoverColor:"#000000", nPaddingTop:0, nPaddingBottom:0}));
};

$(document).ready(function() {
	var defaultSearchKeyword = $('#tx-indexedsearch-searchbox-sword').val();

	$('#tx-indexedsearch-searchbox-sword').focus(function() {
		if ($(this).val() == defaultSearchKeyword) $(this).val('');
	});

	$('#tx-indexedsearch-searchbox-sword').blur(function() {
		if ($(this).val() == '') $(this).val(defaultSearchKeyword);
	});

	$('.teaserSlider').each(function() {
		var itemsCount = $(this).find('div.items div').length;
		$(this).find('.totalElementsNo').text('von ' + itemsCount);
		if (itemsCount == 1) {
			$(this).find('.slide-btn').remove()
		}
	});

	if ($('#playerdetail .slideshow .items div').length > 0) {
		$('.slideshow').show();
		$('#playerdetail').css({'height': '574px'});
	}

	$('.panes .news-container').each(function() {
  		if ($(this).find('.news').length > 3) {
  			hideMoreNews($(this).index());
  		}
	});

	$('.video-btn .preview').each(function() {
		if ($(this).find('div a').length == 0) {
			$(this).remove();
		}
	});

	// jQuery.euqalheights
	(function($) {
		$.fn.equalHeights = function(minHeight, maxHeight) {
			tallest = (minHeight) ? minHeight : 0;
			this.each(function() {
				if($(this).height() > tallest) {
					tallest = $(this).height();
				}
			});
			if((maxHeight) && tallest > maxHeight) tallest = maxHeight;
			return this.each(function() {
				$(this).height(tallest).css("overflow","hidden");
			});
		}
	})(jQuery);
	$(".equalHeights .box-content").equalHeights();
	$(".min-sitemap ul").equalHeights();

	// jQueryTools Tabs
	$(".box ul.tabs").tabs("div.panes > div");
	$(".tabbox ul.tabs").tabs("div.panes > div");

	// jQueryTools Gallery
	$('.teaserSlider .scrollable').scrollable({
		onBeforeSeek: function(event, index) {
			if (event.target.getRoot().find('div.items div:eq(' + index + ')').length > 0) {
				event.target.getRoot().parent().find('.currentElementNo').text(++index);
			}
		}
	});
	$('.slideshow-content .scrollable').scrollable({itemsPerPage: 3});
	$('#playerdetail .scrollable').scrollable({itemsPerPage: 5});
	$('.slideshow-layer .scrollable, .nextgame, .slideshow-highlights, .start-gallery').scrollable();

	$('.scrollable .items > a').remove();

	// stage
	$(".start-gallery .items a").click(function() {
		var aTag = $(this);
		currentStageItemIndex = aTag.index()+(4*(aTag.parent().index()));
		setStageItem(aTag);

		// when page loads simulate a "click" on the first image
		return false;
	}).filter(":first").click();

	if ($('.start-gallery').length > 0) {
		stageItemsCount = $('.start-gallery .items a').length;

		$('.start-gallery').hover(function() {
			animateStage('stop');
		},
		function () {
			animateStage('start');
		});

		animateStage('start');
	}

	// Main Sub Navigation
	$('#subnav .sub').each(function() {
		if ($(this).find('ul').length == 0) {
			$(this).remove();
		}
		else {
			var parts = $(this).attr('id').split('-');
			var prefix = '';
			if ($('#nav ul').hasClass('business')) prefix = 'business_';
			else if ($('#nav ul').hasClass('english')) prefix = 'en_';
			$(this).find('.head-img img').attr('src', $(this).find('.head-img img').attr('src').replace(/no1/, prefix + parts[1]));
		}
	});

	var subnavHeight = '184px';
	var active = hidingTriggered = false;
	var activeSubnavElement = null;
	$('.sub').css({'margin-top': '-' + subnavHeight});
	$('#nav ul > li a').hover(function() {
		hidingTriggered = false;
		var currentElement = $('#sub-' + $(this).attr('class'));

		if (currentElement.length == 0) {
			triggerSubNavigationHiding();
		}
		else {
			if (!active) {
				active = true;
				$('.sub').css({'margin-top': '-' + subnavHeight});
				if ($.support.opacity) {
					$('#subnav, #subnav-shadow').stop(false, true).fadeIn('fast');
				}
				else {
					$('#subnav, #subnav-shadow').show();
				}
			}

			if (activeSubnavElement !== null) {
				$('.sub').stop(true, true);
				if (activeSubnavElement.attr('id') !== currentElement.attr('id')) {
					activeSubnavElement.animate({'margin-top': subnavHeight}, 400);
					currentElement.stop(false, true).css({'margin-top': '-' + subnavHeight}).animate({'margin-top': '0'}, 400);
				}
			}
			else {
				currentElement.css({'margin-top': '0'});
			}

			activeSubnavElement = currentElement;
			$('#nav li').removeClass('hover');
			$(this).parent().addClass('hover');
		}
	},
	function() {
		triggerSubNavigationHiding();
	});

	$('.sub').hover(function() {
		active = true;
		hidingTriggered = false;
	},
	function() {
		triggerSubNavigationHiding();
	});

	function triggerSubNavigationHiding() {
		hidingTriggered = true;
		window.setTimeout(function() {
			if (hidingTriggered) {
				if ($.support.opacity) {
					$('#subnav, #subnav-shadow').stop(false, true).fadeOut('fast');
				}
				else {
					$('#subnav, #subnav-shadow').hide();
				}

				if (activeSubnavElement !== null) {
					activeSubnavElement.css({'margin-top': '-' + subnavHeight});
					activeSubnavElement = null;
					$('#nav li').removeClass('hover');
				}

				active = false;
			}
		}, 200);
	}

	// IE6 Focus Outline
	$('.tabs li a').click(function() {
		$(this).blur();
	});

	gamesSliderAllGames = $('.nextgame .items').html();

	if ($('.nextgame .items .previousMatches').length == 0) {
		$('#nextGamesHeadline label').remove();
	}
	else {
		$('.nextgame .items div.previousMatches').remove();
	}

	if ('undefined' != typeof shareURL) {
		$.ajax({
			type: 'GET',
			url: '/CDA/fileadmin/php/ajax.shareCounts.php',
			data: 'url=' + shareURL,
			dataType: 'json',
			success: function(data) {
				$('.facebookShareCount').html(data.facebookShareCount);
				$('.tweetCount').html(data.tweetCount);
				$('.googlePlusCount').html(data.googlePlusCount);
			}
		});
	}
});

var stageAnimation;
var stageItemsCount = 0;
var currentStageItemIndex = -1;
var gamesSliderAllGames = '';
function showGames(mode) {
	$('#nextGamesHeadline, #previousGamesHeadline').hide();
	$('#' + mode + 'GamesHeadline').show();
	$('.nextgame, .nextgame-btn').remove();
	$('#previousGamesHeadline').after('<div class="scrollable nextgame"><div class="items">' + gamesSliderAllGames + '</div></div>');

	if (mode == 'previous') $('.nextgame .items div.nextMatches').remove();
	else $('.nextgame .items div.previousMatches').remove();

	if ($('.nextgame .items div.' + mode + 'Matches').length > 1) {
		$('.nextgame').after('<div class="nextgame-btn"><a class="prev browse left"><span>zurück</span></a><a class="next browse right"><span>weiter</span></a></div>');
	}

	$('.nextgame').scrollable();
}

function setStageItem(clickedATag) {
	// see if same thumb is being clicked
	if (clickedATag.hasClass("active")) { return; }
	// calclulate large image's URL based on the thumbnail URL (flickr specific)
	var imageURL = clickedATag.attr("rel");
	var url = clickedATag.attr('href');
	// get handle to element that wraps the image and make it semi-transparent
	var wrap = $("#image_wrap").fadeTo(0, 1);
	// the large image from www.flickr.com
	var image = new Image();
	// call this function after it's loaded
	image.onload = function() {
		// change the image
		var stageATag = wrap.find('a');
		var currentImage = wrap.find("img");
		var newImage = currentImage.clone();
		newImage.attr("src", imageURL);
		newImage.css({ display: 'none' });

		stageATag.append(newImage);

		newImage.fadeIn();
		currentImage.fadeOut('normal', function() {
			$(this).remove();
		});

		stageATag.attr('href', url);
		// activate item
		$(".items a").removeClass("active");
		clickedATag.addClass("active");
	};
	// begin loading the image from www.flickr.com
	image.src = imageURL;
}

function animateStage(action) {
	if (action == 'start') {
		stageAnimation = window.setTimeout(function() {
			currentStageItemIndex++;
			if (currentStageItemIndex >= stageItemsCount) currentStageItemIndex = 0;

			$('.start-gallery .items a:eq(' + currentStageItemIndex + ')').click();
			if ('function' == typeof $('.start-gallery .scrollable').scrollable().seekTo) {
				$('.start-gallery .scrollable').scrollable().seekTo(currentStageItemIndex/4);
			}

			animateStage('start');
		}, 8000);
	}
	else {
		window.clearTimeout(stageAnimation);
	}
}

function showMoreNews(newsContainerIndex) {
	$('.panes .news-container:eq(' + newsContainerIndex + ') div').slideDown();
	$('.panes .news-container:eq(' + newsContainerIndex + ') .moreNews').remove();

	$('.panes .news-container:eq(' + newsContainerIndex + ') .box-link:last').append('<a class="right lessNews" href="javascript:hideMoreNews(' + newsContainerIndex + ')">weniger News anzeigen</a>');
}

function hideMoreNews(newsContainerIndex) {
	$('.panes .news-container:eq(' + newsContainerIndex + ') .news:gt(2), .news-container:eq(' + newsContainerIndex + ') .box-link').slideUp();
  	$('.panes .news-container:eq(' + newsContainerIndex + ') .news:eq(2)').after('<div class="box-link ic-down clearfix moreNews"><a class="right" href="javascript:showMoreNews(' + newsContainerIndex + ')">weitere News anzeigen</a></div>');
	$('.panes .news-container:eq(' + newsContainerIndex + ') .lessNews').remove();
}

function popup(url, b, h) {
	var maxwidth = screen.width-50;
	var maxheight = screen.height-120;
	var scrolling = "no";
	var resizable = "no";
	h += 0;
	if (b > maxwidth) b = maxwidth;

	if (h > maxheight) {
		h = maxheight;
		b += 20;
	}

	if (navigator.appVersion.search(/AOL/) != -1) {
		scrolling = 'yes';
		b = maxwidth;
		h = maxheight;
	}

	var param = "resizable=" + scrolling + ",status=no,menubar=no,scrollbars=" + scrolling + ",toolbar=no,width=" + b + ",height=" + h;
	f = window.open(url,'',param);
	f.moveTo((screen.width-b)/2,(screen.height-h)/2-40);
}

/* UPDATE André Wenk Start */
function checkRecommendForm(){
	var isError = false;
	// validate name sender
	if ($('#name_from').val() == '') {
		isError = true;
		$('#name_from').addClass('vote_error');
	}
	else {
		$('#name_from').removeClass('vote_error');
	}

	// validate email address sender
	if ($('#mail_from').val() == '') {
		isError = true;
		$('#mail_from').addClass('vote_error');
	}
	else {
		$('#mail_from').removeClass('vote_error');
	}

	// validate name recipient
	if ($('#name_to').val() == '') {
		isError = true;
		$('#name_to').addClass('vote_error');
	}
	else {
		$('#name_to').removeClass('vote_error');
	}

	// validate email address recipient
	if($('#mail_to').val() == '') {
		isError = true;
		$('#mail_to').addClass('vote_error');
	}
	else {
		$('#mail_to').removeClass('vote_error');
	}

	// validate message
	if ($('#notice').val() == '') {
		isError = true;
		$('#notice').addClass('vote_error');
	}
	else {
		$('#notice').removeClass('vote_error');
	}

	if (isError) {
		return false;
	}
	else {
		return true;
	}
}

function checkTicketForm(){
	var isError = false;

	if ( document.getElementById('salutation').selectedIndex == 0 ) {
		isError = true;
		document.getElementById('salutation').style.backgroundColor = "red";
	}
	else {
		document.getElementById('salutation').style.backgroundColor = "#fff";
	}	
	if ( document.getElementById('firstname').value == '' ) {
		isError = true;
		document.getElementById('firstname').style.backgroundColor = "red";
	}
	else {
		document.getElementById('firstname').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('lastname').value == '' ) {
		isError = true;
		document.getElementById('lastname').style.backgroundColor = "red";
	}
	else {
		document.getElementById('lastname').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('zip').value == '' ) {
		isError = true;
		document.getElementById('zip').style.backgroundColor = "red";
	}
	else {
		document.getElementById('zip').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('phone').value == '' ) {
		isError = true;
		document.getElementById('phone').style.backgroundColor = "red";
	}
	else {
		document.getElementById('phone').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('address').value == '' ) {
		isError = true;
		document.getElementById('address').style.backgroundColor = "red";
	}
	else {
		document.getElementById('address').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('city').value == '' ) {
		isError = true;
		document.getElementById('city').style.backgroundColor = "red";
	}
	else {
		document.getElementById('city').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('email').value == '' ) {
		isError = true;
		document.getElementById('email').style.backgroundColor = "red";
	}
	else {
		document.getElementById('email').style.backgroundColor = "#fff";
	}	
	if ( document.getElementById('ticketanzahl').selectedIndex == 0 ) {
		isError = true;
		document.getElementById('ticketanzahl').style.backgroundColor = "red";
	}
	else {
		document.getElementById('ticketanzahl').style.backgroundColor = "#fff";
	}	
	
  	if(!document.getElementById('membernumber_check').checked && !document.getElementById('seasonticketnumber_check').checked){
		isError = true;
		alert('Bitte geben Sie Ihre Mitglieds oder Kundennummer an!')
		document.getElementById('membernumber').style.backgroundColor = "red";
		document.getElementById('seasonticketnumber').style.backgroundColor = "red";
	}
 	else{
		if(document.getElementById('membernumber').value == '' && document.getElementById('seasonticketnumber').value == ''){
			isError = true;
			alert('Bitte geben Sie Ihre Mitglieds oder Kundennummer an!');
		}
		else{
			document.getElementById('membernumber').style.backgroundColor = "#fff";
			document.getElementById('seasonticketnumber').style.backgroundColor = "#fff";		
		}
	} 
	 
	/*
	if ( document.getElementById('birthday').value == '' ) {
		isError = true;
		document.getElementById('birthday').style.backgroundColor = "red";
	}
	else {
		document.getElementById('birthday').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('firstname_kid').value == '' ) {
		isError = true;
		document.getElementById('firstname_kid').style.backgroundColor = "red";
	}
	else {
		document.getElementById('firstname_kid').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('lastname_kid').value == '' ) {
		isError = true;
		document.getElementById('lastname_kid').style.backgroundColor = "red";
	}
	else {
		document.getElementById('lastname_kid').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('birthday_kid').value == '' ) {
		isError = true;
		document.getElementById('birthday_kid').style.backgroundColor = "red";
	}
	else {
		document.getElementById('birthday_kid').style.backgroundColor = "#fff";
	}
 	if ( document.getElementById('school_kid').value == '' ) {
		isError = true;
		document.getElementById('school_kid').style.backgroundColor = "red";
	}
	else {
		document.getElementById('school_kid').style.backgroundColor = "#fff";
	} 
	if ( document.getElementById('email_kid').value == '' ) {
		isError = true;
		document.getElementById('email_kid').style.backgroundColor = "red";
	}
	else {
		document.getElementById('email_kid').style.backgroundColor = "#fff";
	}*/

	if (isError) {
		return false;
	}
	else {
		return true;
	}
}

function checkUmfrageForm(){
	var isError = false;

	if ( document.getElementById('firstname').value == '' ) {
		isError = true;
		document.getElementById('firstname').style.backgroundColor = "red";
	}
	else {
		document.getElementById('firstname').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('lastname').value == '' ) {
		isError = true;
		document.getElementById('lastname').style.backgroundColor = "red";
	}
	else {
		document.getElementById('lastname').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('birthday').value == '' ) {
		isError = true;
		document.getElementById('birthday').style.backgroundColor = "red";
	}
	else {
		document.getElementById('birthday').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('address').value == '' ) {
		isError = true;
		document.getElementById('address').style.backgroundColor = "red";
	}
	else {
		document.getElementById('address').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('zip').value == '' ) {
		isError = true;
		document.getElementById('zip').style.backgroundColor = "red";
	}
	else {
		document.getElementById('zip').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('city').value == '' ) {
		isError = true;
		document.getElementById('city').style.backgroundColor = "red";
	}
	else {
		document.getElementById('city').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('email').value == '' ) {
		isError = true;
		document.getElementById('email').style.backgroundColor = "red";
	}
	else {
		document.getElementById('email').style.backgroundColor = "#fff";
	}

	if( !document.ticketform.anreise[0].checked  && !document.ticketform.anreise[1].checked ) {
		isError = true;
		alert('Bitte wählen sie die Anreise!');
	}

	if( document.ticketform.anreise[0].checked  ) {
		if( !document.ticketform.dauerkarte_als_fahrkarte[0].checked && !document.ticketform.dauerkarte_als_fahrkarte[1].checked ) {
			isError = true;
			alert('Bitte wählen Sie, ob Sie die Dauerkarte als Fahrkarte nutzen!');
		}

		if( !document.ticketform.ghvkarte_vorhanden[0].checked && !document.ticketform.ghvkarte_vorhanden[1].checked ) {
			isError = true;
			alert('Bitte wählen Sie, ob Sie bereits eine GVH-Karte besitzen!');
		}

	}

	if( document.ticketform.anreise[1].checked  ) {
		if( !document.ticketform.dauerkarte_als_fahrkarte_nutzbar_bekannt[0].checked && !document.ticketform.dauerkarte_als_fahrkarte_nutzbar_bekannt[1].checked ) {
			isError = true;
			alert('Bitte wählen Sie, ob Sie wissen, dass die Dauerkarte auch als Fahrkarte nutzbar ist.!');
		}

		if( !document.ticketform.ghvkarte_vorhanden2[0].checked && !document.ticketform.ghvkarte_vorhanden2[1].checked ) {
			isError = true;
			alert('Bitte wählen Sie, ob Sie bereits eine GVH-Karte besitzen!');
		}
	}

	if (isError) {
		return false;
	}
	else {
		return true;
	}
}

function togglePollingQuestions1(){
	document.getElementById( 'hidePollingQuestion1' ).style.display = 'block';
	document.getElementById( 'hidePollingQuestion2' ).style.display = 'none';
}

function togglePollingQuestions2(){
	document.getElementById( 'hidePollingQuestion2' ).style.display = 'block';
	document.getElementById( 'hidePollingQuestion1' ).style.display = 'none';
}

function checkEventForm(){
	var isError = false;

	if ( document.getElementById('salutation').selectedIndex == 0 ) {
		isError = true;
		document.getElementById('salutation').style.backgroundColor = "red";
	}
	else {
		document.getElementById('salutation').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('eventchoice').selectedIndex == 0 ) {
		isError = true;
		document.getElementById('eventchoice').style.backgroundColor = "red";
	}
	else {
		document.getElementById('eventchoice').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('ticketchoice').selectedIndex == 0 ) {
		isError = true;
		document.getElementById('ticketchoice').style.backgroundColor = "red";
	}
	else {
		document.getElementById('ticketchoice').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('firstname').value == '' ) {
		isError = true;
		document.getElementById('firstname').style.backgroundColor = "red";
	}
	else {
		document.getElementById('firstname').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('lastname').value == '' ) {
		isError = true;
		document.getElementById('lastname').style.backgroundColor = "red";
	}
	else {
		document.getElementById('lastname').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('company').value == '' ) {
		isError = true;
		document.getElementById('company').style.backgroundColor = "red";
	}
	else {
		document.getElementById('company').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('address').value == '' ) {
		isError = true;
		document.getElementById('address').style.backgroundColor = "red";
	}
	else {
		document.getElementById('address').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('zip').value == '' ) {
		isError = true;
		document.getElementById('zip').style.backgroundColor = "red";
	}
	else {
		document.getElementById('zip').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('city').value == '' ) {
		isError = true;
		document.getElementById('city').style.backgroundColor = "red";
	}
	else {
		document.getElementById('city').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('phone').value == '' ) {
		isError = true;
		document.getElementById('phone').style.backgroundColor = "red";
	}
	else {
		document.getElementById('phone').style.backgroundColor = "#fff";
	}
	if ( document.getElementById('email').value == '' ) {
		isError = true;
		document.getElementById('email').style.backgroundColor = "red";
	}
	else {
		document.getElementById('email').style.backgroundColor = "#fff";
	}

	// billing adress
	if( document.getElementById('billingadress').checked ){
		if ( document.getElementById('billing_salutation').selectedIndex == 0 ) {
			isError = true;
			document.getElementById('billing_salutation').style.backgroundColor = "red";
		}
		else {
			document.getElementById('billing_salutation').style.backgroundColor = "#fff";
		}
		if ( document.getElementById('billing_firstname').value == '' ) {
			isError = true;
			document.getElementById('billing_firstname').style.backgroundColor = "red";
		}
		else {
			document.getElementById('billing_firstname').style.backgroundColor = "#fff";
		}
		if ( document.getElementById('billing_lastname').value == '' ) {
			isError = true;
			document.getElementById('billing_lastname').style.backgroundColor = "red";
		}
		else {
			document.getElementById('billing_lastname').style.backgroundColor = "#fff";
		}
		if ( document.getElementById('billing_company').value == '' ) {
			isError = true;
			document.getElementById('billing_company').style.backgroundColor = "red";
		}
		else {
			document.getElementById('billing_company').style.backgroundColor = "#fff";
		}
		if ( document.getElementById('billing_address').value == '' ) {
			isError = true;
			document.getElementById('billing_address').style.backgroundColor = "red";
		}
		else {
			document.getElementById('billing_address').style.backgroundColor = "#fff";
		}
		if ( document.getElementById('billing_zip').value == '' ) {
			isError = true;
			document.getElementById('billing_zip').style.backgroundColor = "red";
		}
		else {
			document.getElementById('billing_zip').style.backgroundColor = "#fff";
		}
		if ( document.getElementById('billing_city').value == '' ) {
			isError = true;
			document.getElementById('billing_city').style.backgroundColor = "red";
		}
		else {
			document.getElementById('billing_city').style.backgroundColor = "#fff";
		}
		if ( document.getElementById('billing_phone').value == '' ) {
			isError = true;
			document.getElementById('billing_phone').style.backgroundColor = "red";
		}
		else {
			document.getElementById('billing_phone').style.backgroundColor = "#fff";
		}
		if ( document.getElementById('billing_email').value == '' ) {
			isError = true;
			document.getElementById('billing_email').style.backgroundColor = "red";
		}
		else {
			document.getElementById('billing_email').style.backgroundColor = "#fff";
		}
	}

	if (isError) {
		return false;
	}
	else {
		return true;
	}
}

function setNormal( param ){
	if( param.value != '' ) {
		param.style.backgroundColor = '#fff';
	}
	else{
		param.style.backgroundColor = 'red';
	}
}

function toggleTextfieldStatus( param ){
	if( document.getElementById( param ).disabled ) {
		document.getElementById( param ).disabled = false;
		//document.getElementById( param ).style.backgroundColor = '#fff';
	}
	else{
		document.getElementById( param ).disabled = true;
		//document.getElementById( param ).style.backgroundColor = '#cecece';
		document.getElementById( param ).value = '';
	}
}

function getFlexibleDropdownContent( eventid ) {
	$.ajax({
		type: 'GET',
		url: 'fileadmin/php/ajax.getFlexibleDropdownContent.php',
		data: 'eventId=' + eventid,
		success: function(response) {
			$('#flexibleDropdownContent').html(response);
		}
	});
}

function getEventdescription( eventid ) {
	$.ajax({
		type: 'GET',
		url: 'fileadmin/php/ajax.getEventdescription.php',
		data: 'eventId=' + eventid,
		success: function(response) {
			$('#descriptioncontent').html(response);
		}
	});
}

function getEventheadline( eventid ) {
	$.ajax({
		type: 'GET',
		url: 'fileadmin/php/ajax.getEventheadline.php',
		data: 'eventId=' + eventid,
		success: function(response) {
			$('#headlinecontent').html(response);
		}
	});
}

function toggleBillingAdressForm(){
	// alert(document.getElementById('billingContent').style.display);

	if( document.getElementById('billingContent').style.display == 'none' ){
		document.getElementById('billingContent').style.display = 'block';
	}
	else {
		document.getElementById('billingContent').style.display = 'none';
	}
}
/* UPDATE André Wenk End */

function generateLayerContent() {
 	var containerDivTag = document.createElement("div");
	var className = '';
	containerDivTag.id  = 'trikotLaunch';
	//containerDivTag.style.display = 'none';


	containerDivTag.innerHTML =  '<div class="launchButton">'+
									'<a href="javascript:void(0)" onclick="toggleLaunchLayer(\'show\')" title="Mit Stolz trage ich dieses Trikot..."><img src="fileadmin/img/campagneTrikotlaunch/launch-button.png" width="278" height="79" alt="Mit Stolz trage ich dieses Trikot..." /></a>'+
								 '</div>'+
								 '<div class="launchLayer" id="launchLayer" style="display:none">'+
										'<div class="launchImage"><a href="http://www.hannover96.de/CDA/index.php?id=8582" title="Jetzt mehr erfahren"><img src="fileadmin/img/campagneTrikotlaunch/launch-campagne.jpg" width="554" height="849" alt="Mit Stolz trage ich dieses Trikot..." /></a></div>'+
										'<div class="launchArrow"><img src="fileadmin/img/campagneTrikotlaunch/launch-arrow.png" width="78" height="123" alt="" /></div>'+
										'<div class="launchClose"><a href="javascript:void(0)" onclick="toggleLaunchLayer(\'hide\')" title="Fenster schließen"><img src="fileadmin/img/campagneTrikotlaunch/launch-close.gif" width="40" height="50" alt="Fenster schließen" /></a></div>'+
									'</div>';
	document.getElementById('wrapper').appendChild(containerDivTag);
}

function toggleLaunchLayer(param){
	if(param=='show')
		document.getElementById('launchLayer').style.display = 'block';
	else
		document.getElementById('launchLayer').style.display = 'none';
}
