
/**
 * FontSize changer wrapper
 */ 
appFontSize = function(mode) {
    switch(mode) {
        case 'inc':
            FontSize.increase();
            break;
        case 'dec':
            FontSize.decrease();
            break;    
        case 'reset':
        default:
            FontSize.reset();
            break;
    }
    
    jQuery(".submenu").z35CenterMenu();
}
 
/**
 * Centering menues
 */ 
jQuery.fn.z35CenterMenu = function() {
    return this.each(function(){
        var pl      = 0;
        var self    = this;
        jQuery("li", self).each(function(){ pl += jQuery(this).outerWidth(true); });
        jQuery("ul:first", self).css('paddingLeft', ( (jQuery(self).width() - pl) / 2 ) + 'px');
    });
};

/**
 * Apply rounded corners and decor graphics to boxes
 */ 
jQuery.fn.z35SetupBox = function() {
    return this.each(function(){
        var i       = 0;
        var decor   = ['download','feed','casestudy','contact','cube','editorial','note'];
        var self    = this;
        for (i=0; i<decor.length; i++) {
            if(jQuery(self).hasClass(decor[i])) {
                jQuery(self).append('<div class="icon"></div>');
                break;
            }
        }
        jQuery(self).append(
            '<div class="box-top"><div><br/></div></div>' +
            '<div class="box-bottom"><div><br/></div></div>'
        );
    });
};

/**
 * Toggle contact form
 */ 
jQuery.fn.z35ToggleKontakt = function() {
    return this.each(function(){
        var target  = "#kontakt-wrapper";
        var h       = jQuery(target).height();
        var speed   = 800;
        var self    = this;
        jQuery(self).toggle(
             function() { jQuery(target).animate( { marginTop:"0px" }, { queue:false, duration:speed ,easing:"easeInOutQuad" } ); }
            ,function() { jQuery(target).animate( { marginTop:"-"+h+"px" }, { queue:false, duration:speed ,easing:"easeInOutQuad" } ); }
        );
    });
};

    
/**
 * Init 
 */ 
jQuery(document).ready(function(){
    
    //$(".box").z35SetupBox();
    
    jQuery(".submenu").z35CenterMenu();
    
    jQuery("#metamenu-kontakt").z35ToggleKontakt();
    
});

