/**
 * Site-Functions
 * 
 * Description
 * @author		Heiko Bee
 * @link		http://maxout.de
 * @email		hb@maxout.de
 * 
 * @file		func.js
 * @version		1.0
 * @date		21/08/2009
 * 
 * Copyright (c) 2009
 */
 /* settings
 // -------------------------------------------------------------------------- */
 var
    effects_speed       = 500,
    content_dir         = "content/",
    current_language    = "DE";
    jQuery.easing.def   = "easeInExpo";
 $(document).ready(function () {
    
    
    $('#nav a').click(function (e) {
        $('#nav a').removeClass('selected');
        $(this).addClass('selected').blur();
    });


    $("a[id^='link-']").click(function (e) {
        if (match = this.id.match(/(\w+)/g)) {
            var url = match;
             
            getContent(url[1]);
        }
        return false;
    });
    
    //Cufon.replace('#nav');
    
    $("#contentHead").click(function(){
        $("#content").slideToggle(600);
        $('#nav').animate({paddingTop: '120px'}, 500);
    });

    
 });
 
 function liftMenu(){
    if($(document).height() < 720){ 
        $('#nav').animate({paddingTop: '5px'}, 500);
        //$("#nav li").css({float:'left',clear:'right'}); 
    }
 }

 function getContent(content){
    $('#content').slideUp(effects_speed,function(){
        liftMenu();
        $("#scrollpane").load(content_dir + content + ".html", {lang: current_language}, function(){
            $('#content').slideDown(effects_speed); 
            reinitialiseScrollPane();
        });
    });
 }


 $(function(){
   $('#scrollpane').jScrollPane();
   $('#scrollpane').parent().find('.jScrollPaneTrack').css({opacity: .2});
   $("#content").css({visibility:'visible',display:'none'}).slideUp(0); 

 });
 function reinitialiseScrollPane(){
        $('#scrollpane').jScrollPane();
        $('#scrollpane').parent().find('.jScrollPaneTrack').css({opacity: .2});
    }
    
/* scrollpane add on
// --------------------------------------------------------------------------*/

