	$(function(){
	$('ul.jd_menu').jdMenu({
	onShow: loadMenu,
	activateDelay: 100
	});
	$('ul.jd_menu_vertical').jdMenu({onShow: loadMenu, onHide: unloadMenu, offset: 1, onAnimate: onAnimate});
	});
	function onAnimate(show) {
	//$(this).fadeIn('slow').show();
	if (show) {
	$(this)
	.css('visibility', 'hidden').show()
	.css('width', $(this).innerWidth())
	.hide().css('visibility', 'visible')
	.fadeIn('normal');
	} else {
	$(this).fadeOut('fast');
	}
	}
	var MENU_COUNTER = 1;
	function loadMenu() {
	if (this.id == 'dynamicMenuRW') {
	$('> ul > li', this).remove();
	var ul = $('<ul></ul>');
	var t = MENU_COUNTER + 10;
	for (; MENU_COUNTER < t; MENU_COUNTER++) {
	$('> ul', this).append('<li>Item ' + MENU_COUNTER + '</li>');
	}
	}
	}
	function unloadMenu() {
	if (MENU_COUNTER >= 30) {
	MENU_COUNTER = 1;
	}
	}
	// We're passed a UL
	function onHideCheckMenu() {
	return !$(this).parent().is('.LOCKED');
	}
	// We're passed a LI
	function onClickMenu() {
	$(this).toggleClass('LOCKED');
	return true;
	}
       
        function toggle(id)
               {
                   div_el = document.getElementById(id);
                   img_el = document.getElementById('img'+id);
                   if (div_el.style.display != 'none')
                   {
          
					
                      div_el.style.display='none';
                      img_el.src = '/fileadmin/templates/fileadmin/templates/fileadmin/templates/seo.html_files/show.png';
          
                   }
                   else
                   {
          
                      div_el.style.display='block';
                      img_el.src = '/fileadmin/templates/fileadmin/templates/fileadmin/templates/seo.html_files/hide.png';
          
                   };
               };
          
      			
    function animateLetter(jChar, letterShowTimeout, letterResetTimeout)
    {
        jChar.hide();
        jChar.css("display", "inline");
        jChar.css("font-weight", 400);
        jChar.show(letterShowTimeout, function() { jChar.css("font-weight", 700); });
        setTimeout(function() { jChar.css("font-weight", 400); }, letterResetTimeout);
    }

    function showMotto()
    {
        var mottoText = "Driving Your Business Growth";
        var mottoLength = mottoText.length;
        var container = $("#mottotext");
        container.css("display", "block");
        setTimeout(
            function(){ writeText( 0, mottoLength, mottoText, container ); },
            450);
    }


    function showMotto2()
    {
        var mottoText = "Sales keep Growing and Growing";
        var mottoLength = mottoText.length;
        var container = $("#mottotext2");
        container.css("display", "block");
        setTimeout(
            function(){ writeText( 0, mottoLength, mottoText, container ); },
            450);
    }








    function writeText(i, length, text, container) 
    {
        if (i == length) 
        {
            return;
        }

        var character = text.charAt(i);

        if (" " == character) 
        {
            character = "&nbsp;";
        }

        var characterSpan = "<span id='mt" + i + "'>" + character + "</span>";
        container.append(characterSpan);

        var jChar = container.find("#mt" + i).eq(0);
        var letterShowTimeout = 60;
        var letterResetTimeout = 90;
        var easingStartLength = 1400;

        if ( i > easingStartLength ) 
        {
            var easing = Math.ceil((i - easingStartLength) / 3);
            var easingSq = easing * easing;
            letterShowTimeout += easingSq * letterShowTimeout;
            letterResetTimeout += easing * letterResetTimeout;
        }

        animateLetter(
            jChar,
            letterShowTimeout, 
            letterResetTimeout);    
        i++;

        var textWriteTimeout = 90;
        setTimeout(
            function() { writeText(i, length, text, container); },
            textWriteTimeout);
    }

    function beginAnimation() 
    {
        var animationStartDelay = 300;
        var rolloverDuration = 800;

        setTimeout(
            function() 
            {
              
                $("#motto").animate(
                    { left: "2px" },
                    { duration: rolloverDuration, easing: "linear", complete: showMotto });

            },
            animationStartDelay);
    }

			