$(document).ready(function() {

	//Inputs initialisieren
	$('input[type=text],input[type=password]').each(function() {
		apply_input_logic($(this), $(this).val());
	});
 
 	//Login initialisieren
 	$("#header_controls_login_button").mousedown(toggle_login_window);
 	$(document).mouseup(hide_login_window); 
 	$("#header_controls_login_button").mouseup(function(e) {
 		return false;
 	});
 	$("#header_controls_login_window").mouseup(function(e) {
 		return false;
 	});
 	
 	$.tools.validator.localize("de", {
 		'*'				: 'Bitte dieses Feld korrigieren.',
 		':email'  		: 'Bitte eine gültige E-Mail-Adresse eingeben.',
 		':number' 		: 'Bitte eine Zahl eingeben.',
 		':url' 			: 'Bitte eine gültige URL eingeben.',
 		'[data-equals]'	: 'Die beiden Werte stimmen nicht überein.',
 		'[max]'	 		: 'Bitte eine kleinere Zahl als $1 eingeben.',
 		'[min]'			: 'Bitte eine größere Zahl als $1 eingeben.',
 		'[required]'	: 'Bitte dieses Feld ausfüllen.'
 	});
 	
	$("#combined_newsbox").scrollable({
		circular: true, 
		mousewheel: false,
		onSeek: function(event, tabIndex) {
			var actual_newsbox_height = 
				$('#combined_newsbox div.items').children(':nth-child('+(tabIndex+2)+')').outerHeight();
			$('#combined_newsbox').animate({
					height: actual_newsbox_height+'px'
				}, 'fast', 'linear'
			);
		}
	}).navigator({
		navi: "#combined_newsbox_navigation",
		naviItem: 'a',
		activeClass: 'current',
		history: true
	});
});

function hide_sidebar() {
	$('#sidebar').hide();
	$('#mainbar').css('width', '865px');
}
