/**
 * Author: Stephan Hinz
 */
var $j = jQuery.noConflict();

$j(document).ready(function(){

  //Wir verstecken die zweiten Teile
  $j(".part2").hide();

  //Wir klappen die zweiten Teile ein oder aus
  $j(".expandbar span.expand a").click(function(event) {
    $j(this).parents(".folded").find(".part2").slideToggle("slow", function() {
      $j(this).next(".expandbar").find("span.expand").toggle();
    });
    return false;
  });
 
  //nyroModal
	$j("a.nyroModal-gallery").nyroModal({width: 642, height: 481});
  $j("a.nyroModal-playlist").nyroModal({width: 780, height: 500});  

  //Tabs
    $j("#tabsBox").tabs({
    fxFade: true,
    fxSpeed: "slow",
    fxAutoHeight: true,
    onShow: function() {
      $j(".scroll-pane").jScrollPane();
    }
  });

  //Tooltip
  $j("*.tooltipElement").Tooltip({
    showBody: "::",
    showURL: false,
    fixPNG: false
  });

  $j("#navigation img").preload({
    find:'.gif',
    replace:'-over.gif'
  });

  $j("#navigation img").hover(function() {
    this.src = this.src.replace('.gif','-over.gif');
  },function() {
    this.src = this.src.replace('-over','');
  });

  $j(".scroll-pane").jScrollPane();

  // Softscrolling
  $j('a[@href*=#]').click(function() {
    if(this.hash == "#singles"
      || this.hash == "#remixes"
      || this.hash == "#longplayer")
      return false;
    else {
	    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
	    && location.hostname == this.hostname) {
	      var $target = $j(this.hash);
	      $target = $target.length && $target
	      || $j('[name=' + this.hash.slice(1) +']');
	      if ($target.length) {
		      var targetOffset = $target.offset().top;
		      $j('html,body')
		        .animate({scrollTop: targetOffset}, 1000);
	        return false;
	      }
	    }
    }
  });
});

