$(function(){
	var ind = $("div").index( $('#imgBoxActive') [0]);
	if (ind >= 0)
			hideNav(200);
	var indT = $("div").index( $('#thBox') [0]);
	if (indT >= 0)
		hideTh(200);

	var unterTitel = $("div").index( $('#unterT') [0]);
	if (unterTitel >= 0){
		$("div#unterT").hide(10);
	}
		

});

//PRE SCROLL

$(document).ready(function(){
  $("#pre-slider").slider({
    animate: true,
    handle: ".pre-slider-handle",
    change: preHandleSliderChange,
    slide: preHandleSliderSlide
  });
});

function preHandleSliderChange(e, ui)
{
  var maxScroll = $(".pre-scroll").attr("scrollWidth") - $(".pre-scroll").width();
  $(".pre-scroll").animate({scrollLeft: ui.value * (maxScroll / 100) }, 1000);
}

function preHandleSliderSlide(e, ui)
{
  var maxScroll = $(".pre-scroll").attr("scrollWidth") - $(".pre-scroll").width();
  $(".pre-scroll").attr({scrollLeft: ui.value * (maxScroll / 100) });
}

// DESC SCROLL

$(document).ready(function(){
  $("#desc-slider").slider({
    animate: true,
    handle: ".desc-slider-handle",
    change: descHandleSliderChange,
    slide: descHandleSliderSlide,
    orientation: "vertical"
  });
});

function descHandleSliderChange(e, ui)
{
  var maxScroll = $(".desc-scroll").attr("scrollHeight") - $(".desc-scroll").height();
  $(".desc-scroll").animate({scrollTop: ui.value * (maxScroll / 100) }, 1000);
}

function descHandleSliderSlide(e, ui)
{
  var maxScroll = $(".desc-scroll").attr("scrollHeight") - $(".desc-scroll").height();
  $(".desc-scroll").attr({scrollTop: ui.value * (maxScroll / 100) });
}


// MOUSE-OVERS
function showDesc(text){
	$("div.desc-slider-handle").css({'top' : '0'});
	$("div.desc-scroll").css({'top' : '16'});
	var getfile = 'inc/descTxt.php?f=' + text;
	$.get(getfile, function(data){
		$("div.preDesc").html(data);
	})
}

function hideTh(how){
	$("div#thBox").hide(how);
	$("div#thBoxUnder").hide(how);
	$("div#thShow").css({'visibility' : 'visible'});
}

function showTh(){
	$("div#thBox").show(200);
	$("div#thBoxUnder").show(200);
	$("div#thShow").css({'visibility' : 'hidden'});
}

function hideNav(how){
	$("div#navBox").hide(how);
	$("div#navUnder").hide(how);
	$("div#navShow").css({'visibility' : 'visible'});
}

function showNav(){
	$("div#navBox").show(200);
	$("div#navUnder").show(200);
	$("div#navShow").css({'visibility' : 'hidden'});
}

function navHelp(){
	$("div#navShow").html("Navigation");
	$("div#navShow").css({'color' : '#FF0000'});
	$("div#navShow").css({'width' : '85px'});
}

function navHelpOut(){
	$("div#navShow").html("N");
	$("div#navShow").css({'color' : '#CCCCCC'});
	$("div#navShow").css({'width' : '13px'});
}

function thHelp(){
	$("div#thShow").html("Thumbnails");
	$("div#thShow").css({'color' : '#FF0000'});
	$("div#thShow").css({'width' : '92px'});
}

function thHelpOut(){
	$("div#thShow").html("T");
	$("div#thShow").css({'color' : '#CCCCCC'});
	$("div#thShow").css({'width' : '13px'});
}

function showUnterTitel(path, ind){
	var getfile = '../txt/untertitel.php?path='+path+'&ind='+ind;
	$.get(getfile, function(data){
		if (data != ''){
			$("div#unterT").html(data);
			
			var xSize = $("img.bgImg").width() - 25;
			var yPos = $("img.bgImg").height() - 30;
			$("div#unterT").css({'width' : xSize + 'px'}); 
			$("div#unterT").css({'margin-top' : yPos + 'px'}); 
			$("div#unterT").show(200);
		}
	});
}

function hideUnterTitel(){
	$("div#unterT").hide(200);
}
