    /**
        @name:          sqeenCMS
        @version:       2.x
        @package:       template
        @subpackage:    sqc_core
        @access:        frontend
        @author:        sqeen
        @copyright:     sqeen
        @since:         2010
        @todo:          jQuery JavaScript functions
    */


    // Document ready functions
        $(document).ready(function () {
            // Decrypt email addresses
                var htmlBody = $('body').html();
                var htmlBodyRepl = htmlBody.replace(/\[SQM\]/g, '@');
                $('body').html(htmlBodyRepl);

            // Init background image
                var hoehe = $(window).height();
                var weite = $(window).width();
                //initBgImage();

            // Resize background image
                $(window).resize(function() {
                    bgImageSize();
                });
        });

        // Show & Hide divContent
        function bgImageToggle() {
            if ($('#divContent').is(':visible')) {
                $('#divContent').hide();
                $('#aBgToggle').css('background', 'url(images/bg_hide.png) no-repeat');
            }
            else {
                $('#divContent').show();
                $('#aBgToggle').css('background', 'url(images/bg_show.png) no-repeat');
            }
        }

        // Change background image
        function bgChangeImg(imgName, elmt) {
            $(elmt).append('<img src="images/preloader.gif" id="imgLoader" />');
            $('#bgImg').attr('src', 'images/'+imgName+'.jpg').load(function() {
                myImgHeight = $('#bgImg').height();
                myImgWidth = $('#bgImg').width();
                bgImageSize();
                $('#imgLoader').remove();
            });
        }

        function initBgImage() {
            myImgHeight = 1700;
            myImgWidth = 2600;
            if(window.innerWidth) {
                hoehe=window.innerHeight;
                weite=window.innerWidth;
            }
            else {
                hoehe=document.documentElement.clientHeight;
                weite=document.documentElement.clientWidth;
            }
            var newHeight = Math.round(myImgHeight/(myImgWidth/weite));
            if( newHeight > hoehe) {
                document.getElementById("bgImg").style.width = weite+'px';
            }
            else {
                document.getElementById("bgImg").style.height = hoehe+'px';
            }
        }

        function bgImageSize(){
            if(hoehe!=0) {
                if(window.innerWidth){
                    hoehe=window.innerHeight;
                    weite=window.innerWidth;
                }
                else{
                    hoehe=document.documentElement.clientHeight;
                    weite=document.documentElement.clientWidth;
                }
                if( weite > 900 ){
                    var newHeight = Math.round(myImgHeight/(myImgWidth/weite));
                    if( newHeight > hoehe){
                        document.getElementById("bgImg").style.width = weite+'px';
                        document.getElementById("bgImg").style.height = 'auto';
                    }
                    else {
                        document.getElementById("bgImg").style.height = hoehe+'px';
                        document.getElementById("bgImg").style.width = 'auto';
                    }
                }
            }
        }
