/**
 * 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 = false;
  //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;
    }
  }
}

/**
 *
 * This package contains initialization functions.
 *
 * @author <a href="mailto:info@cappuccinonet.com.com">Bernhard Woehrlin, IT.CappuccinoNet.com</a>
 */
if (typeof application == 'undefined') {
  application = function () { }
}

application.init = function () { }



/**
 * initializes the page's JavaScript

 * @package application.init
 */
application.init.initialize = function () {

  $(document).ready( function() {

    // slide show home page
    //$('#box_topimage').cycle({fx: 'fade',speed: 5000});

    $('.box_radio').corners({});

    // lightbox
    $('a.lightbox').lightBox({fixedNavigation:true}); // Select all links with lightbox class

		// social bookmarks http://keith-wood.name/bookmark.html
		$.bookmark.addSite('netselektor', 'Netselektor', './imgs/social/netselektor_g.gif', 'http://www.netselektor.de/?url={u}&title={t}');
		$.bookmark.addSite('folkd', 'Folkd', './imgs/social/folkd_g.gif', 'http://www.folkd.com/page/submit.html?url={u}&title={t}');
		$.bookmark.addSite('oneview', 'Oneview', './imgs/social/oneview_g.gif', 'http://www.oneview.de/?url={u}&title={t}');
		$.bookmark.addSite('seekxl', 'SeekXL', './imgs/social/seekxl_g.gif', 'http://social-bookmarking.seekxl.de?add_url={u}&title={t}');

		$('#bookmarks').bookmark({
				sites: ['delicious', 'digg', 'ask', 'netselektor', 'oneview', 'seekxl', 'linkarena', 'facebook', 'google', 'reddit', 'yahoo', 'yahoobm', 'yahoobuzz', 'myspace', 'slashdot', 'misterwong', 'yigg', 'windows', 'technorati', 'stumbleupon', 'furl', 'folkd']
		});

	  // dropshadow

		//var css = $('link[rel=stylesheet]@href');
		/*
	  $('img.large').dropShadow({
				left: 4,
				top: 2,
				opacity: 0.5,
				blur: 1,
        color: 'black'
		});
    */
		$('a[@href$=".pdf"]').addClass('pdflink');

	} );
}
application.init.initialize();


function Spring() {
    var welcherLink = document.sprache.URLs.selectedIndex;
    document.sprache.URLs.selectedIndex = "0";
    if(welcherLink > "0"){
       top.location.href = document.sprache.URLs.options[welcherLink].value;
    }
}