$(window).load(function() {
    // EQUAL HEIGHTS---------------------------------------
    $.ajax({
        type: 'GET',
        url: '/website/de/js/jquery.equalHeight.js',
       success: function() {
        $('.nocopy,.emp').equalHeights();
              if (!$('#slides').length)
            $('#subnav,#content,#context').equalHeights();
            $('.content-box .group').equalHeights();
            $('.content-box fieldset.span-6').equalHeights();
            $('.direct .group').equalHeights();
        },
        dataType: 'script',
        cache: true
    });
});
$(document).ready(function() {
    // FORMS----------------------------------------------
    $.ajax({
        type: 'GET',
        url: '/website/de/js/jquery.jqtransform.js',
        success: function() {
   $('form.jqtransform,fieldset.jqtransform').jqTransform();
      $('.jqTransformSelectWrapper').css('width', '180px');
      $('.jqTransformSelectWrapper span').css({'overflow': 'hidden','width': '80px'});
      $('.jqTransformSelectWrapper ul').css('width', '280px');
   $('.jqTransformSelectWrapper').click(function() {
    $('.jqTransformSelectWrapper').css('z-index', '10');
    $(this).css('z-index', '100');
   });
   $('.jqTransformSelectOpen').click(function() {
    $('.jqTransformSelectWrapper').css('z-index', '10');
    $(this).parent().parent('.jqTransformSelectWrapper').css('z-index', '100');
   });
      $('.span-6 .jqTransformSelectWrapper').css('width', '120px');
   $('td .jqTransformSelectWrapper').css('width', '50px');
      $('td .jqTransformSelectWrapper ul').css('width', '50px');
   $('.group2 td .jqTransformSelectWrapper').css('width', '110px');
   $('.group2 td .jqTransformSelectWrapper ul').css('width', '150px');
   $('#context .jqTransformSelectWrapper').css('width', '110px');
      $('#context .jqTransformSelectWrapper ul').css('width', '110px');
        },
        dataType: 'script',
        cache: true
    });



 // HOVER INTENT---------------------------------------
    $.ajax({
        type: 'GET',
        url: '/website/de/js/jquery.hoverIntent.js',

         success: function() {
         $('#info-menu').hoverIntent(
         function() {
             $('#info-arrow').animate({
                 height: '0px',
                 top: '+=20px'
             },
             70,
             function() {
                 $('#controls').fadeIn();
                 $('#visual').cycle('pause');
                 $('#info').cycle('pause');
                 $('#info-more').cycle('pause');
                 return false;
             }
             );
         },
         function() {
             $('#controls').fadeOut(function() {
                 $('#info-arrow').animate({
                     height: '14px',
                     top: '-=20px'
                 },
                 70);
                 $('#visual').cycle('resume');
                 $('#info').cycle('resume');
                 $('#info-more').cycle('resume');
                 return false;
             }
             );
         }
         );
        },

        dataType: 'script',
        cache: true
    });

    // SLIDESHOW-------------------------------------------
    $.ajax({
        type: 'GET',
        url: '/website/de/js/jquery.cycle.all.min.js',
        success: function() {
          
          // $('#visual img:first').fadeIn(2000);
            $('#pause').click(function() {
                $('#visual').cycle('pause');
                return false;
            });
            $('#play').click(function() {
                $('#visual').cycle('resume');
                return false;
            });
            
 $(function() {
                $.getJSON(list, startSlideshow);
                function startSlideshow(slides) {
                    var totalSlideCount = 1 + slides.length;
                    var $slideshow = $('#visual');
                    $slideshow.prepend('<img width="1280" height="610" src="' + slides.pop() + '" />');
                    $slideshow.append('<img width="1280" height="610" src="' + slides.shift() + '" />');
     
     // Stop Slideshow -> set timeout to 0
     if (($('#controls2').length) // || ($.browser.msie && $.browser.version >= 6)
     ){
      var setTimeout = 0;
      $('#info-more').cycle('stop');
      $('#info').cycle('stop');
                    }
     // Reset Slideshow -> set timeout to n
     else
     {
      var setTimeout = 6000
     }
              $('#info,#info-more').cycle({
                  fx: 'fade',
                  timeout: setTimeout,
                  speed: 500,
                  prev: '#prev',
                  next: '#next'
              });
                    $slideshow.cycle({
                        fx: 'fade',
                        timeout: setTimeout,
                        startingSlide: 1,
                        speed: 500,
                        prev: '#prev',
                        next: '#next',
                        before: onBefore,
                        after: onAfter
                    });
                    function onBefore(curr, next, opts, fwd) {
                        var setTimeout = 0
                        if (!opts.addSlide)
                        return;
                        if (opts.slideCount == totalSlideCount)
                        return;
                        var nextSlideSrc = fwd ? slides.shift() : slides.pop();
                        opts.addSlide('<img width="1280" height="610" src="' + nextSlideSrc + '" />', fwd == false);
                    };
                    function onAfter() {
                        var setTimeout = 0
                 };
                };
            });
            $('#pause2').click(function() {
                $('#slides').cycle('pause');
                return false;
            });
            $('#play2').click(function() {
                $('#slides').cycle('resume');
                return false;
            });
            $('#slides').cycle('pause');
            $('#slides').cycle({
                fx: 'fade',
                timeout: 6000,
                speed: 500,
                prev: '#prev2',
                next: '#next2'
            });
        },
        dataType: 'script',
        cache: true
    });    // FANCYBOX--------------------------------------------
    $.ajax({
        type: 'GET',
        url: '/website/de/js/jquery.fancybox.js',
        success: function() {
 
           var fancywidth = 340;
            if ($.browser.msie && $.browser.version <= 6) var fancywidth = 380;
            $('a.colorpop').fancybox({
                'frameWidth': fancywidth,
                'frameHeight': 300,
                'padding': 20,
                'hideOnContentClick': true,
                'overlayShow': false
            });
        },
        dataType: 'script',
        cache: true
    });
    // CSS-------------------------------------------------
    $('#subnav a.on').parents('li').addClass('active');
    $('#tabs').next().css('padding-top', '63px');
    
    if ($.browser.msie && $.browser.version >= 6) $('.content-box').append('<p>&nbsp;</p>');
    $('.logos .column:nth-child(3n)').addClass('last');
    $('.presspics .column:nth-child(4n)').addClass('last');
    $('.vtg td:nth-child(1)').addClass('vtg-1');
    $('.vtg td:nth-child(4)').addClass('vtg-2');
    $('#subnav h4 a img').filter(function() {
        return $(this).attr('alt').length > 18
    }).each(function() {
        $(this).parent().parent().parent().addClass('multiline');
    });
    $('#subnav li a').filter(function() {
        return $(this).text().length > 29
    }).each(function() {
        $(this).parent().addClass('multiline');
    });
     $('#info a').filter(function() {
         return $(this).text().length > 27
     }).each(function() {
         $(this).addClass('multiline');
     });
     $('.emp').append('<p class="nocopy">&nbsp;</p>');
     var getTitle = $('#titletext').text();
     if ($('title').text().length < 1) document.title = getTitle;
     $('.press-box-block:eq(1)').addClass('press-box-secondary');
});
// GENERIC JAVASCRIPT---------------------------------------
function spkz() {
    location.href = document.change.go.value;
}
// Tour Popup ---------------------------------------
function startTour(spkz) 
{
if (spkz == "de") {
    tech_folder = "technik"
} else {
    tech_folder = "technology"
}
 openstring = 'index.html,fenster,width=750,height=300,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no';
   if (navigator.appName.indexOf("Microsoft")>=0) {
      openstring+=',left=100,top=25'
    }else{
      openstring+=',screenX=100,screenY=25'
    }
    F1 = open("/" + spkz + "/"+tech_folder+"/tour/indext_rohstoffe1.html","Fenster1",openstring);
}