
jQuery(document).ready(function(){


	$("#socialbox").css("width", startbreite+"px");
	$("#open_socialbox").css("cursor", "pointer");
	$("#socialbox .bigf").css("display", "none");

	$("#open_socialbox").hover(
		function(){
			$("#socialbox").animate({ width: "268px" }, {queue:false, duration:"normal"} );
			$("#open_socialbox").animate({opacity: "hide"}, "fast");
		},
		function(){
		});



	$("#socialbox").hover(
		function(){
		},
		function(){
		    document.aktuell = 1;
			$("#socialbox").animate({ width: "0px" }, {queue:false, duration:"normal"} );
			$("#open_socialbox").animate({opacity: "show"}, "slow");
			setTimeout(function(){
  				show_sb_content(1);
			}, 500);
			

	});
	

});

function show_sb_content(what) {

    for (var i = 1; i <= 6; i++) {
        
		if (i == what) {
		    document.getElementById('sb_content_' + i).style.marginLeft = '0px';
		   	document.getElementById('sb_content_' + i).style.display = 'block';
		   	document.getElementById('navi_dot_' + i).style.backgroundImage = 'url(images/socialbox/images/sb_dot1.gif)';
		} else {
		    if (document.getElementById('sb_content_' + i)) document.getElementById('sb_content_' + i).style.display = 'none';
		    if (document.getElementById('navi_dot_' + i)) document.getElementById('navi_dot_' + i).style.backgroundImage = 'url(images/socialbox/images/sb_dot2.gif)';
		}
    }
}

function nav_sb_content(what) {

	var a = 0;
    for (var i = 1; i <= 6; i++) {
        if (document.getElementById('sb_content_' + i)) { // prüfung ob jeweiliger DIV überhaupt existiert
            a++;
			if (!document.getElementById('sb_content_' + i).style.display || document.getElementById('sb_content_' + i).style.display == 'block') var aktuell = i;
        }
    }
    
    var next = aktuell + 1;
    var prev = aktuell - 1;
    if (next > a) next = 1;
    if (prev < 1) prev = a;


	if (what == 'prev') show_sb_content(prev);
    if (what == 'next') show_sb_content(next);


}

