    
Cufon.replace('#stage h1.cufon, h2 span a,#wide h1 span,#wide h1.genCufon, .stage_content p.font_gen', {
    fontFamily: 'Franklin Gothic Heavy',
    hover: true
});
Cufon.replace('.landingpage h1, .landingpage h2', {
    fontFamily: 'Helvetica Neue',
    hover: true
});
Cufon.replace('#small h1 span, .cufon_tag a', {
    fontFamily: 'Franklin Gothic Heavy',
    hover: true
});

    
$(document).ready( function() {  

    $('A[rel="external"]').click( function() {
        window.open( $(this).attr('href') );
        return false;
    });   
	
    if($('#content-pages') && $('#content-pages').length > 0) {
        $('#content-pages').pager('div');
    }
	
    $('.teaser-image .background').hover(
        function () {
            $(this).addClass("active");
        },
        function () {
            $(this).removeClass("active");
        }
        );
	
    $('.teaser-text .background').hover(
        function () {
            $(this).addClass("active");
        },
        function () {
            $(this).removeClass("active");
        }
        );


    //bugfix hover event, text color
    $('div.teaser-image > div.background').hover(
      function() {
          $(this).find('.col_content').children().children().css('color', '#0C2635');
      },
      function() {
          $(this).find('.col_content').children().children().css('color', '#fff');
      }
    );


      $('.Cteaser-image .background').hover(
        function() {
            $(this).addClass("active");
        },
        function() {
            $(this).removeClass("active");
        }
        );

      $('.Cteaser-text .background').hover(
        function() {
            $(this).addClass("active");
        },
        function() {
            $(this).removeClass("active");
        }
        );


      //bugfix hover event, text color
      $('div.Cteaser-image > div.background').hover(
      function() {
          $(this).find('.col_content').children().children().css('color', '#0C2635');
      },
      function() {
          $(this).find('.col_content').children().children().css('color', '#fff');
      }
    );



        $('.item-product .background-item').hover(
        function () {
            $(this).addClass("active");
        },
        function () {
            $(this).removeClass("active");
        }
        );
	
	
    var defaul_teaser_small_bg = "";
    $('#teaser-small .background').hover(
        function () {
            var element = $(this);
            $(this).css({
                "background-image":"url(../static/image/background_teaser_small_mouseover.jpg)",
                "background-color":"#D7DBDA",
                "color":"#0C2635"
            });
            defaul_teaser_small_bg = over_teaser_small_bg = $(".visual img", element)[0].src;
            $(".visual img", element)[0].src = over_teaser_small_bg.replace(/.png/,"_mouseover.png");
        },
        function () {
            var element = $(this);
            $(this).css({
                "background-image":"url(../static/image/background_teaser_small.jpg)",
                "background-color":"#0C2635",
                "color":"#fff"
            });
            $(".visual img", element)[0].src = defaul_teaser_small_bg;
        }
        );

/*            
    $('#submit_button').hover(
        function () {
            $(this).css({
                background-image:"url(../static/image/_common/send_button_mouseover.png)",
                color:"#000"
            });
        },
        function () {
            $(this).css({
                background-image:"url(../static/image/_common/send_button.png)",
                color:"#fff"
            });
        }
        );
*/	
    var circlespeed = 3000;
	
    if($('.slideshow') && $('.slideshow').length > 0 ) {
        $('.slideshow').cycle({
            fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
            speed:    circlespeed,
            timeout: 7000
        });
    }

    /* teaser info left */
    $('.teaser .teaser-products .scroll_content .item:even').hover(
        function () {
            $('.item_text',this).animate({
                left:75
            });
            $(this).css('z-index','10');
        },
        function () {
            $('.item_text',this).stop();
            $('.item_text',this).css({
                left:4
            });
            $(this).css('z-index','1');
        }
        );

    /* teaser info right */
    $('.teaser .teaser-products .scroll_content .item:odd').hover(
        function () {
            $(this).css('z-index','10');
            $('.item_text',this).animate({
                left:-66
            });
        },
        function () {
            $('.item_text',this).stop();
            $('.item_text',this).css({
                left:4
            });
            $(this).css('z-index','1');
        }
        );
	
    // initialize scrollable recommended products
    if($('.teaser-products .scrollable') && $('.teaser-products .scrollable').length > 0 ) {
        $(".teaser-products .scrollable").scrollable({
            vertical:true,
            size: 6
        }).mousewheel();
        if($('.teaser-products .scrollable .items .item') && $('.teaser-products .scrollable .items .item').length <=6)
            $('.teaser-products .nextPage').css({
                display:'none'
            });
    }
	
    // initialize scrollable category products
    if($('#big #stage .intro_small .scrollable') && $('#big #stage .intro_small .scrollable').length > 0 ) {
        $("#big #stage .intro_small .scrollable").scrollable({
            vertical:true,
            size: 6
        }).mousewheel();
        if($('#big #stage .intro_small .scrollable .items .item-product') && $('#big #stage .intro_small .scrollable .items .item-product').length <=6)
            $('#big #stage .nextPage').css({
                display:'none'
            });
    }
	
    // initialize scrollable form stage
    
    if($('#big #stage .intro_big .scrollable') && $('#big #stage .intro_big .scrollable').length > 0 ) {
        $("#big #stage .intro_big .scrollable").scrollable({
            vertical:true,
            size: 1
        }).mousewheel();
        if($('#big #stage .intro_big .scrollable .items .form') && $('#big #stage .intro_big .scrollable .items .form').length <=1)
            $('#big #stage .nextPage').css({
                display:'none'
            });
    }
	
    if($('.scroll-pane') && $('.scroll-pane').length > 0) {
        $(function()
        {
            $('.scroll-pane').jScrollPane({
                showArrows: true,
                arrowSize:12,
                scrollbarWidth:17
            });
        });
    }

	
    Cufon.now();
    $('.equal_height').equalHeights(true);
    $(document).pngFix();

    //function GeI(i) { return (x = document.getElementById(i)) ? x : null; }

	
		//short text for teaser ;)
		 $('.item-product .col_content').each(function(){
		   var maxHeight = $(this).height() - $(this).find('.headline_first').height();
		   var myP = $(this).find('p');
		   var myCopy = myP.html();
		   var myCopyWords = myCopy.split(" ");
		   var newCopy = "";
		   myP.css("display","none");
		   
		   for(var i=0; i<myCopyWords.length; i++){
		     newCopy += myCopyWords[i] + " ";
		     myP.html(newCopy + myCopyWords[i+1] + " ...");
		     if(myP.height() > maxHeight){
		       myP.html(newCopy + "...");
		       myP.css("display","block");
		       break;
		     }
		   }
		 });
		 
		
		 if($(window).scrollTop() + $(window).height() > 730){
		   $("#bottom_background").animate( { top:($(window).scrollTop() + $(window).height()- 350) + "px"}, 1, function(){
         $("#bottom_background").css("width", ($(window).scrollLeft() + $(window).width()) + "px");
       });
	   }else{
	      $("#bottom_background").animate( { top:"380px"}, 1, function(){
          $("#bottom_background").css("width", ($(window).scrollLeft() + $(window).width()) + "px");
          $("#bottom_background").css("width", ($(window).scrollLeft() + $(window).width()) + "px");
        });
	   }
		
		$(window).bind("resize scroll", function() {
		  
	   if($(window).scrollTop() + $(window).height() > 730){
		   $("#bottom_background").animate( { top:($(window).scrollTop() + $(window).height()- 350) + "px"}, 1, function(){
         $("#bottom_background").css("width", ($(window).scrollLeft() + $(window).width()) + "px");
       });
	   }else{
	      $("#bottom_background").animate( { top:"380px"}, 1, function(){
          $("#bottom_background").css("width", ($(window).scrollLeft() + $(window).width()) + "px");
        });
	   }

    });

    if ($(window).scrollTop() + $(window).height() > 730) {
        $("#bottom_background").animate({ top: ($(window).scrollTop() + $(window).height() - 350) + "px" }, 1, function() {
            $("#bottom_background").css("width", ($(window).scrollLeft() + $(window).width()) + "px");
        });
    } else {
        $("#bottom_background").animate({ top: "380px" }, 1, function() {
            $("#bottom_background").css("width", ($(window).scrollLeft() + $(window).width()) + "px");
            $("#bottom_background").css("width", ($(window).scrollLeft() + $(window).width()) + "px");
        });
    }

    $(window).bind("resize scroll", function() {

        if ($(window).scrollTop() + $(window).height() > 730) {
            $("#bottom_background").animate({ top: ($(window).scrollTop() + $(window).height() - 350) + "px" }, 1, function() {
                $("#bottom_background").css("width", ($(window).scrollLeft() + $(window).width()) + "px");
            });
        } else {
            $("#bottom_background").animate({ top: "380px" }, 1, function() {
                $("#bottom_background").css("width", ($(window).scrollLeft() + $(window).width()) + "px");
            });
        }

    });

    // Social Bookmarks
    $('#dialog-overlay, #socBookLyr').hide();
    $('#dialog-overlay, #socBookLyrLinks, #socBookLyrClose').click(function() {
        $('#dialog-overlay, #socBookLyr').hide();
        return false;
    });
    //$(window).resize(function () {
    //if (!$('socBookLyr').is(':hidden')) popup();		
    //});	
    urlLink = location.href;
    urlLink = unescape(urlLink);
    $("#locationStr").html();
    $("#locationStr").html(urlLink);
    
    //$('#socBookLyr').hide();
    //$('#socBookLink').hover( function(event) { $('#socBookLyr').show(); GeI('socBookLink').className='socBookOn'; }, function(event) { $('#socBookLyr').hide();GeI('socBookLink').className='';});
    //$('#socBookLyr').hover( function(event) { $('#socBookLyr').show(); GeI('socBookLink').className='socBookOn'; }, function(event) { $('#socBookLyr').hide(); GeI('socBookLink').className='';});

});

//Popup dialog
function popup() {
    $('#dialog-overlay').show();
    $('#socBookLyr').show();
}
function openPage(url) {
    window.location.href=url;
}
function openPage(url, urltarget) {
    if (urltarget && urltarget != '') {
        window.open(url);
    } else {
      window.location.href=url;
    }
}

function PopUp(URL, popupname, b, h, scrollbars) {
    var PopUpName = popupname || 'PopUp';
    var breite = b || 698;
    var hoehe = h || 512;
    var ScrollBars = scrollbars || 'auto';
    var xPos = (screen.availWidth - breite) / 2
    var yPos = (screen.availHeight - hoehe) / 2
    var fenster = window.open(URL, PopUpName, 'width=' + breite + ',height=' + hoehe + ',scrollbars=' + ScrollBars + ',toolbar=no,menubar=no,screenX=' + xPos + ',screenY=' + yPos + ',left=' + xPos + ',top=' + yPos)
    fenster.focus();
}
  
/*-------------------------------------------------------------------- 
 * JQuery Plugin: "EqualHeights"
 * by:	Scott Jehl, Todd Parker, Maggie Costello Wachs (http://www.filamentgroup.com)
 *
 * Copyright (c) 2008 Filament Group
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 *
 * Description: Compares the heights or widths of the top-level children of a provided element 
 		and sets their min-height to the tallest height (or width to widest width). Sets in em units 
 		by default if pxToEm() method is available.
 * Dependencies: jQuery library, pxToEm method	(article: 
		http://www.filamentgroup.com/lab/retaining_scalable_interfaces_with_pixel_to_em_conversion/)							  
 * Usage Example: $(element).equalHeights();
  		Optional: to set min-height in px, pass a true argument: $(element).equalHeights(true);
 * Version: 2.0, 08.01.2008
--------------------------------------------------------------------*/

$.fn.equalHeights = function(px) {
    $(this).each(function(){
        var currentTallest = 0;
        $(this).children().each(function(i){
            if ($(this).height() > currentTallest) {
                currentTallest = $(this).height();
            }
        });
        // for ie6, set height since min-height isn't supported
        if ($.browser.msie && $.browser.version == 6.0) {
            $(this).children().css({
                'height': currentTallest
            });
        }
        $(this).children().css({
            'min-height': currentTallest
        });
    });
    return this;
};


