

/**
 * Initialize the Logger
 */
// DEBUG LEVEL
var LOG = 0;
var DEBUG = 1;
var INFO = 2;
var ERROR = 3;

// Wrapper around Firebug Console, so we output just in case of console
// NOTE: i.e. IE does not have a Console
FB = function () { }


if(location.hostname == 'localhost') {
	FB.o = true;
	FB.l = 3; // add log level ID for console output
} else {
	FB.o = true;
	//FB.o = false; //globally disable debugging output
	FB.l = 0; // add log level ID for console output
}

FB.log = function (msg, level, x) {

	if (!FB.o) return true;

	if (!window.console) {
		return true;
	} else {
		switch(level) {
			case(DEBUG):
			    if (FB.l <= 1 ) {
					window.console.log('DEBUG: '+msg);
					//window.console.debug(msg); // won't work on Safari
				}
				break;
			case(INFO):
				if (FB.l <= 2 ) {
					window.console.log('INFO: '+msg);
					//window.console.info(msg); // won't work on Safari
				}
				break;
			case(ERROR):
			    if (FB.l <= 3 ) {
					window.console.log('ERROR: '+msg);
					//window.console.error(msg); // won't work on Safari
				}
				break;
			default:
			    if (FB.l <= 1 ) {
					window.console.log('LOG: '+msg);
				}
				break;
		}
	}
}

/**
 * eversjung package
 *
 * This package contains initialization functions.
 *
 * @author <a href="mailto:info@cappuccinonet.com.com">Bernhard Woehrlin, IT.CappuccinoNet.com</a>
 */
if (typeof eversjung == 'undefined') {
	eversjung = function () { }
}

eversjung.init = function () { }

/**
 * initializes the page's JavaScript

 * @package eversjung.init
 */
eversjung.init.initialize = function () {
	$(document).ready( function() {
		// Online-Beratung: Navigation Orientierung
		$('a.alert').attr('href', 'javascript:void(0);');
		$('.alert').click( function() { alert(unescape('Bitte w%E4hlen Sie Ihren Handlungsweg am Fu%DF der Seite \'2. Entscheidung\'')); } );
		
		$('<a href="#top" class="totop"><img src="/templates/firmenhilfe/images/totop.jpg" border="0" /></a>').insertAfter('#middle.emph #article h3');
		FB.log('added dom elements', DEBUG);
		
		// Online-Beratung: Animated Intro-Blocks
		$('address.wissen').hide();
		$('#middle.emph #article h2.wissen').addClass('plus').click(function () {
			if ($(this).hasClass('plus')) {
				$(this).removeClass('plus');
				$(this).nextAll('address.wissen').slideDown('fast');
			} else {
				$(this).addClass('plus');
				$(this).nextAll('address.wissen').slideUp('fast');
			}
		});

		$('.accordeon p').hide();
		$('.accordeon h2').addClass('plus').click(function() {
			if ($(this).hasClass('plus')) {
				$('.accordeon h2:not(.plus)').next('p').slideUp('fast');
				$('.accordeon h2:not(.plus)').addClass('plus');
				
				$(this).next('p').slideDown('fast');
				$(this).removeClass('plus');
			} else {
				$(this).next('p').slideUp('fast');
				$(this).addClass('plus');
			}
		});
	});
}

eversjung.init.initialize();

