<!--
/**
 * K-onstruct CMS
 * Copyright (C) 2008-2011 Kevin Kis
 *
 * Formerly known as CECMS Content Management System
 *
 * PHP version 5
 * @copyright  2008-2011 Kevin Kis
 * @author     Kevin Kis <http://www.k-kombinat.de>
 *
 */

/**
 * Load on ready state
 */
$(function() {

    // init shadowbox
    Shadowbox.init({
        }, setupShadowBox);

    valignCenter('MainDiv');
     
    initNavInfoBox();
    
    setTimeout(function(){
        initNavScroll();
    },100);
    
    initMsgbox();
    
    checkBrowserCompatibility();

});

function checkBrowserCompatibility() {
  if($.browser.name == 'msie' && $.browser.versionNumber < 9){
    alert('ACHTUNG ! \n\rBitte verwenden Sie einen Internet Explorer ab Version 9 \n\roder einen alternativen Browser wie Firefox oder Chrome um diese Seite richtig nutzen zu können.');
  }
}
    
function setupShadowBox() {    

    // init shadow layer
    Shadowbox.setup('a.shadowbox', {
        width   :   950,
        height  :   598,
        counterType:    "skip"
    });
}


function valignCenter(id) {
    
    if($(window).height() > $('#'+id).height()) {
        
        margintop = ($(window).height()-$('#'+id).height() ) / 2 ;
        
        $('#'+id).css('margin-top',margintop);
        
    } else {
        $('#'+id).css('margin-top','0px');
    }
}


function initNavInfoBox() {
    
    $('#nav-selbox').click(function(){
        
        $('#nav-infobox').slideToggle();
        $('#nav-arrow').toggleClass("navarrow_up");
        
    });
}


function strtolower (str) {
    return (str + '').toLowerCase();
}

function initNavScroll () {
    $("#mcs_container").mCustomScrollbar("vertical",300,"easeOutCirc",1.25,"fixed","yes","no",0);  
}

function rand (min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
}

function highestZindex(selector) {
    var array = [];
    $(selector).each(function() {
        array.push($(this).css("z-index"));
    });
    return Math.max.apply(Math, array);
}

function initMsgbox() {
    $('#MainBorder').append('<div class="infoborder msgbox" style="display:none;"><div class="infobox_close"></div><h2></h2></div>');
    //init close button
    $('.msgbox .infobox_close').click(function(){
        $('.msgbox').hide();
    })
}

function showMsgBox(msg) {
    var sethigherzindex = highestZindex(".infoborder") + 1;
    $('.msgbox').css("z-index",sethigherzindex);
    $('.msgbox h2').html(msg);    
    $('.msgbox').show();
}

-->