/*
 * scrolling
 */ 
 
$(function() {
	
	// hide/show scrolling-icons vertical text-scroll
	if($('#scrollable').height() <= $('#boxContentText').height()+1)
	{
		$('#boxContentScroll').hide();
	} else {
		$('#boxContentScroll').show();
	}

});



// scroll up & down
function scrollup(n) {
	var zeilenhoehe = n*18; // 18px pro zeile, default 5 zeilen
	var scrollspeed = n*100; // Scroll geschwindigkeit: zeile mal 100ms
	$('#boxContentText').scrollTo('-='+ zeilenhoehe +'px', scrollspeed);
}
function scrolldown(n) {
	var zeilenhoehe = n*18; // 18px pro zeile, default 5 zeilen
	var scrollspeed = n*100; // Scroll geschwindigkeit: zeile mal 100ms
	$('#boxContentText').scrollTo('+='+ zeilenhoehe +'px', scrollspeed);
}



/*
 * sound
 */
var soundWindow = true;
function popitup(){

    if (typeof soundWindow != 'object') {
        //$('#soundControl').attr('src', 'fileadmin/images/basic/ic_soundbutton.png');
        soundWindow = window.open('fileadmin/templates/sound.html', 'soundWin', 'dependent=yes,width=400,height=150,scrollbars=yes');
        soundWindow.blur();
    }
    else {
        stopSound();
    }
    
}



function stopSound(){

    if (typeof soundWindow == 'object') {
        soundWindow.close();
    }
    soundWindow = false;
    //$('#soundControl').attr('src', 'fileadmin/images/basic/ic_soundbuttonSilence.png');
    
}



// menu rollover
$(document).ready(function() {


   
	if($('#boxPhotos .scrollable .items a').size() <= 5) {
		$('#boxPhotos #boxPhotosScroll a').hide();
	}
   
   
});



jQuery(function($) {

	$('div.boxContentText').bind('mousewheel', function(event, delta) {
            var dir = delta > 0 ? 'Up' : 'Down',
                vel = Math.abs(delta);
				
			if(dir == 'Up') {
				scrollup(1);
			} else if(dir == 'Down') {
				scrolldown(1);
			}

            return false;
	});
		
		
	if($('#navLeft ul li ul li').hasClass('childHasChild')) {
		$('#navLeft ul li ul li.normalChild').hide();
		$('#navLeft ul li ul li.childHasChild').parent().css('marginLeft', 0);
	}

		
});


// fotos scrollbar machen auf team seite
$(function() {	
	// initialize scrollable
	$("div.scrollable").scrollable().mousewheel();		
});

