function dom_init() {



	// CHECK URL FOR ANCHOR
	var hash = location.hash;
	


	$("#loginForm :input:visible:enabled:first").focus();

	// SET DEFAULT PLACEHOLDER FOR INPUT FIELDS
	$('input[placeholder]').setDefault();
	
	
	// REMOVE DEFAULT PLACEHOLDER
	$('input[placeholder]').clearDefault();



	// HOME : MAIN DESCRIPTION
	$('#mainDescription').hide();
	
	$("#homeTeaser").hover(
		function () {
			$('#mainDescription').fadeIn(100);
		},
		function () {
			$('#mainDescription').fadeOut(100);
		}
	);
	
	$('#content').mouseleave(function() {
		$('#mainDescription').fadeOut(100);
	});
	


	
	
	
	// BLOG & COMMENTS ////////////////////////////////////////////////////////////////
	
	
	// NOTES
	$(".note").click(function() {
		$(this).fadeOut(200);
	});
	
	// SHOW HIDDEn CONFIRM MESSAGE FOR LATEST COMMENT
	if (hash == '#confirm') {
		$('#confirm').fadeIn(500);
	}
	
	// REPLY TO COMMENT
	$(".comReply").click(function() {
		var comAuthor = $(this).parents('.comment').find('.comAuthor').html();
		var comId = $(this).parents('.comment').attr('id');
		var comLink = '[@'+comAuthor+'](#'+comId+'): ';
		$('#comComment').val(comLink).focus();
		window.location.href("#kommentieren");
	});
	
	
	// ARTICLE : GALLERY
	$("a.galleryImg").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	300,
		'overlayShow'	:	true,
		'overlayOpacity':   0.5,
		'cyclic'        :    true,
		'titlePosition' :   'over',
		'titleFormat'		: formatGalleryTitle
	});
	
	

	

	// SLIDE CONTROL ////////////////////////////////////////////////////////////////


	// SETUP SLIDES : HOME
	
	$('#homeTeaser').cycle({ 
		fx:      	'none',
		next:   	'#nextslide',
		prev: 		'#prevslide',
		speedIn:  	0,
		timeout: 	0
	});
	
	$('#teaserNavi1').hover(function() {
		$('#teaserNavi a').removeClass('active');
		$(this).addClass('active');
	    $('#homeTeaser').cycle(1); 
	    return false; 
	}); 
	 
	$('#teaserNavi2').hover(function() {
		$('#teaserNavi a').removeClass('active');
		$(this).addClass('active');
	    $('#homeTeaser').cycle(2); 
	    return false; 
	}); 
	
	$('#teaserNavi3').hover(function() {
		$('#teaserNavi a').removeClass('active');
		$(this).addClass('active');
	    $('#homeTeaser').cycle(3); 
	    return false; 
	});
	
	$('#content').mouseleave(function() {
		$('#teaserNavi a').removeClass('active');
		$(this).addClass('active');
	    $('#homeTeaser').cycle(0); 
	    return false; 
	});
	
	



	// SETUP SLIDES : CONTENT
	
	var index = 0;
	if (hash) {
		index = $(hash).index();
		var title = hash.substring(1, hash.length);
		var index = $('.slide[title="'+title+'"]').index();
	}

	
	$('#slideshow').cycle({ 
		fx:      		'scrollHorz',
		next:   		'#nextslide',
		prev: 			'#prevslide',
		startingSlide:	index,
		speed:  		460,
		easing:			'swing',
		timeout: 		0,
		after: function(curr,next,opts) {
			window.location.hash = next.title;
		}
	});
	

			
	$("#nextslide").hover(
		function () {
			$('#startSlideshow').toggleClass('active');
			$('#nextslide .area').animate({
				opacity: 0.5,
				right: '0'
			}, 200, 'swing', function() {});
		},
		function () {
			$('#startSlideshow').toggleClass('active');
			$('#nextslide .area').animate({
				opacity: 0,
				right: '-80px'
			}, 200, 'swing',  function() {});
		}
	);
	
	$("#prevslide").hover(
		function () {
			$('#prevslide .area').animate({
				opacity: 0.5,
				left: '0'
			}, 200, function() {});
		},
		function () {
			$('#prevslide .area').animate({
				opacity: 0,
				left: '-80px'
			}, 200, function() {});
		}
	);
	
	$("#prevslide").click(function() {
		$(this).find('.area').animate({
				opacity: 0,
				left: '-10px'
			}, 200, 'swing', function() {
			$(this).animate({
				opacity: 0.5,
				left: '0'
			}, 400, 'swing', function() {});	
			
		});
	});
	
	$("#nextslide").click(function() {
		$(this).find('.area').animate({
				opacity: 0,
				right: '-10px'
			}, 200, 'swing',function() {
			$(this).animate({
				opacity: 0.5,
				right: '0'
			}, 400, 'swing', function() {});	
			
		});
	});
	
	
	// CALL SLIDE VIA LINK
	$(".gotoSlide").click(function() {
		var anchor = $(this).attr('href');
		var title = anchor.substring(1, anchor.length);
		var slideNr = $('.slide[title="'+title+'"]').index();
		$('#slideshow').cycle(slideNr); 
    	return false;
	});
	


  
}



// FORMAT GALLERY TITLE
function formatGalleryTitle(title, currentArray, currentIndex, currentOpts) {
    return '<div class="galleryTitle">' + (title && title.length ? '<strong>' + title + '<span class="affix">' : '' ) + 'Bild ' + (currentIndex + 1) + ' von ' + currentArray.length + '</span></strong></div>';
}



// SET DEFAULT VALUE FOR INPUT FIELDS
(function($){
	$.fn.setDefault = function(){
		var default_value = $(this).attr('placeholder');
		$(this).val(default_value).removeClass('active');
	};
})(jQuery);


// REMOVE DEFAULT VALUE @ONCLICK + MANAGE ACTIVE-STATUS
(function($){
	$.fn.clearDefault = function(){
		return this.each(function(){
			var default_value = $(this).attr('placeholder');
			$(this).focus(function(){
				if ($(this).val() == default_value) $(this).val("").addClass('active');
			});
			$(this).blur(function(){
				if ($(this).val() == "") $(this).val(default_value).removeClass('active');
			});
		});
	};
})(jQuery);







