$(document).ready(function() {
	$("a#forum_image").fancybox({
		'overlayShow'	: true,
		'opacity'		: true,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});		
					  // override some default options
  	$('div.expandable').expander({
    	slicePoint:       150,  // default is 100
		expandPrefix:     '… ',
    	expandText:         '[weiterlesen]', // default is 'read more...'
    	//collapseTimer:    5000, // re-collapses after 5 seconds; default is 0, so no re-collapsing
		expandEffect:     'show',
  		expandSpeed:      '2000', 
    	userCollapseText: '[Einklappen]'  // default is '[collapse expanded text]'
  	});
					//wenn nicht registriert links ändern
	humane.timeout = 500;//zeit setzen für info fenster
	humane.waitForMove = true;//geht erst weg wenn mausbewegung
	if(!user_id){//prüfen ob user eingelogt ist
		$(".only_login").each(function(){//schleife um alle links mit der klasse zu finden
			$(this).attr('href', 'javascript:humane("<font color=red>zugriff nur für Registrierte User</font>")');//atribute auf warnmeldung ändern
		});
	}
					
	$(".login").fancybox({
		'scrolling'		: 'no',
		'titleShow'		: false,
		'onClosed'		: function() {
	   	$("#login_error").hide();
			}
	});
	$("#login_form").bind("submit", function() {
		if ($("#login_name").val().length < 1 || $("#login_pass").val().length < 1) {
	    	$("#login_empty").show();
	   		$.fancybox.resize();
	    	return false;
		}
	$.fancybox.showActivity();
		$.ajax({
			type	: "POST",
			cache	: false,
			url		: uri_root+"/usrctrl/login.php",
			data	: $(this).serializeArray(),
			success: function(data) {
				login_check(data)
			},
			complete: function(){
				$.fancybox.hideActivity();
			}
		});
		return false;
	});

	login_check = function(data){
		if (data == "login_error") {
	    	$("#login_error").show();
	    	$.fancybox.resize();
		}
		if (data == "login_email") {
	    	$("#login_email").show();
	    	$.fancybox.resize();
		}
		if (data == "login_ok") {
	    	$.fancybox.close();
			window.location.reload();
		}
	};
					
});	//ende document ready
				
				//menü initialisieren
ddsmoothmenu.init({
	mainmenuid: "smoothmenu1", //menu DIV id
	orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
	classname: 'ddsmoothmenu', //class added to menu's outer DIV
	//customtheme: ["#1c5a80", "#18374a"],
	contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
});

//plugin zum laden von bildern wenn sie benötigt werden
$("img").lazyload({ 
    effect : "fadeIn"
});
