  $(document).ready(function(){
    $('#networkSearchContents').remove();
    var imageDir = '../images/netzwerk/';
    var companies = {
          'Braintrain': {
            'active': '1',
            'name': 'Braintrain',
            'subtitle': 'Braintrain AG',
            'image': 'braintrain.gif',
            'logo': 'logo_braintrian.gif',
            'office': {
              0: {
                'street': 'Rain 67',
                'zipCity': '5001 Aarau',
                'contactPerson': 'Account Executive:<br>Gregor Meyer',
                'phone': '+41 (0)62 824 50 00',
                'fax': '+41 (0)62 824 02 01',
                'mail': 'info@braintrain.ch',
                'web': ['www.braintrain.ch']
              }
            }},
         'CMS Serbia': {
            'active': '1',
            'name': 'CMS Serbia',
            'subtitle': 'Corporate Media Serbia',
            'image': 'serbia.gif',
            'logo': 'logo_cm.gif',
            'office': {
              0: {  
                'street': 'Dragoslava Jovanovića 13/I',
                'zipCity': '11000 Belgrad',
                'contactPerson': 'CEO:<br>Nataša Andrejić',
                'phone': '+381 (0)11 3240 134<br />Tel. +381 (0)11 3348 918',
                'fax': '+381 (0)11 3348 917',
                'mail': 'info@cmserbia.com',
                'web': ['www.cmserbia.com']
              }
            }},
         'Eckart & Partner': {'active': '1',
            'name': 'Eckart & Partner',
            'subtitle': 'Eckart & Partner GmbH'
            ,'image': 'eckart.gif',
            'logo': 'logo_eckhart.gif',
            'office': {
              0: { 
                'street': 'Rudolf-Diesel-Straße 14',
                'zipCity': '85521 Ottobrunn',
                'contactPerson': 'Geschäftsführung:<br>Stefan Eckart',
                'phone': '+49 (0)89 62 98 93-0',
                'fax': '+49 (0)89 62 98 93-30',
                'mail': 'eckart@eckart-partner.de',
                'web': ['www.eckart-partner.de']
              }
            }},
          'Energie & Medien Verlag': {'active': '1',
            'name': 'Energie & Medien Verlag',
            'subtitle': 'Energie & Medien Verlag GmbH',
            'image': 'emv.gif',
            'logo': 'logo_emv.gif',
            'office': {
              0: { 
                'street': 'Gustav-Siegle-Straße 16',
                'zipCity': '70193 Stuttgart',
                'contactPerson': 'Geschäftsführung:<br>Peter Hammerschmidt',
                'phone': '+49 (0)711 25 35 90-0',
                'fax': '+49 (0)711 25 35 90-28',
                'mail': 'info@energie-medien-verlag.de',
                'web': ['www.energie-medien-verlag.de']
              }
            }},
          'KOMMIT Medien': {
            'active': '1',
            'name': 'KOMMIT Medien',
            'subtitle': '',
            'image': 'kommitmedien.gif',
            'logo': 'logo_kommitmedien.gif',
            'office': {
              0: {
                'street': 'Harheimer Stadtweg 2a',
                'zipCity': '60437 Frankfurt am Main',
                'contactPerson': 'Geschäftsführung:<br>Hans C. Meister',
                'phone': '+49 (0)6101 40 93-0',
                'fax': '+49 (0)6101 40 93-13',
                'mail': 'info@kommit-medien.de',
                'web': ['www.kommit-medien.de'] 
              },
              1: {
                'street': 'Dortmunder Landstraße 65',
                'zipCity': '58313 Herdecke',
              }
            }},
         'KOMMIT Medien Dortmund': {
         'active': '0',
         'name': 'KOMMIT Medien',
         'subtitle': 'KOMMIT Medien GmbH',
         'image': 'kommitmedien.gif',
         'logo': 'logo_kommitmedien.gif', 
          'office': {   
             0: {   
               'street': 'Dortmunder Landstraße 65',
               'zipCity': '58313 Herdecke',
               'contactPerson': 'Geschäftsführung:<br>Hans C. Meister<br>Dr. Jürgen Bermes',
               'phone': '+49 (0)2330 80 08-0',
               'fax': '+49 (0)2330 80 08-22',
               'mail': 'info@kommit-medien.de',
               'web': ['www.kommit-medien.de']
              }
            }},
         'KOMMIT Medien Frankfurt': {
           'active': '0',
           'name': 'KOMMIT Medien',
           'subtitle': 'KOMMIT Medien GmbH',
           'image': 'kommitmedien_frankfurt.gif',
           'logo': 'logo_kommitmedien.gif',
           'office': {
             0: {   
               'street': 'Harheimer Stadtweg 2a',
               'zipCity': '60437 Frankfurt am Main',
               'contactPerson': 'Geschäftsführung:<br>Hans C. Meister',
               'phone': '+49 (0)6101 40 93-0',
               'fax': '+49 (0)6101 40 93-13',
               'mail': 'info@kommit-medien.de',
               'web': ['www.kommit-medien.de']
              }
            }},
         'makandra': {'active': '1',
            'name': 'makandra',
            'subtitle': 'makandra GmbH',
            'image': 'makandra.gif',
            'logo': 'logo_makandra.gif',
            'office': {
              0: {   
                'street': 'Werner-von-Siemens-Str. 6',
                'zipCity': '86159 Augsburg',
                'contactPerson': 'Geschäftsführung:<br>Robert Sonnberger,<br>Henning Koch,<br>Thomas Eisenbarth',
                'phone': '+49 (0)821 58 866 188',
                'fax': '+49 (0)821 58 866 199',
                'mail': 'info@makandra.de',
                'web': ['www.makandra.de']
              }
            }},
         'Medien Werkstatt Nord': {'active': '1',
            'name': 'Medien Werkstatt Nord',
            'subtitle': 'Medienwerkstatt Nord GmbH',
            'image': 'mwn.gif',
            'logo': 'logo_medienwerkstatt.gif',
            'office': {
              0: {  
                'street': 'Friesenweg 5/1',
                'zipCity': '22763 Hamburg',
                'contactPerson': 'Geschäftsleitung:<br>Michael Habel',
                'phone': '+49 (0)40 40 17 50-25',
                'fax': '+49 (0)40 40 17 50-11',
                'mail': 'info@medienwerkstatt-nord.de',
                'web': ['www.medienwerkstatt-nord.de']
              }
            }},
          'Pressewerk': {'active': '1',
            'name': 'Pressewerk',
            'subtitle': 'Pressewerk GmbH',
            'image': 'pressewerk.gif',
            'logo': 'logo_pressewerk.gif',
            'office': {
              0: {  
                'street': 'Kohlstetter Str. 9',
                'zipCity': '72829 Engstingen',
                'contactPerson': 'Geschäftsführung:<br>Barbara Schwerdtle',
                'phone': '+49 (0)7129 938 26-0',
                'fax': '+49 (0)7129 938 26-10',
                'mail': 'info@pressewerk.com',
                'web': ['www.pressewerk.com']
              }
            }},
         'Publishers Factory': {'active': '1',
            'name': 'Publishers Factory',
            'subtitle': 'Publishers Factory GmbH',
            'image': 'publishers.gif',
            'logo': 'logo_pf.gif',
            'office': {
              0: {  
                'street': 'Putzbrunner Str. 36',
                'zipCity': '85521 Ottobrunn',
                'contactPerson': 'Geschäftsleitung:<br>Britta Rüsting,<br>Verena Wörle',
                'phone': '+49 (0)89 89 82 26-50',
                'fax': '+49 (0)89 89 82 26-44',
                'mail': 'info@publishers.de',
                'web': ['www.publishers.de']
              }
            }},
          'Successnet': {'active': '1',
            'name': 'Successnet',
            'subtitle': 'Successnet AG',
            'image': 'successnet.gif',
            'logo': 'logo_successnet.gif',
            'office': {
              0: { 
                'street': 'Balanstr. 73 / Haus 10',
                'zipCity': '81541 München',
                'contactPerson': 'Vorstand Marketing und Vertrieb:<br>André Link',
                'phone': '+49 (0)89 60 86 65-0',
                'fax': '+49 (0)89 60 86 65-55',
                'mail': 'info@successnet.de',
                'web': ['www.successnet.de','www.twitter.com/successnet_ag']
              }
            }},
         'Trurnit Filmmedien': {'active': '1',
            'name': 'Trurnit Filmmedien',
            'subtitle': 'Frank Trurnit & Partner Verlag GmbH',
            'image': 'trurnit_filmmedien.gif',
            'logo': 'logo_trurnit_filmmedien.gif',
            'office': {
              0: {
                'street': 'Balanstraße 73 / Haus 10',
                'zipCity': '81541 München',
                'contactPerson': 'Geschäftsleitung:<br>Claudia Görgen',
                'phone': '+49 (0)89 60 86 65-321',
                'fax': '+49 (0)89 60 86 65-310',
                'mail': 'info@trurnit-filmmedien.de',
                'web': ['www.trurnit-filmmedien.de']
              }
            }},
          'Trurnit Leipzig': {'active': '1',
            'name': 'Trurnit Leipzig',
            'subtitle': 'Trurnit Leipzig GmbH',
            'image': 'trurnitleipzig.gif',
            'logo': 'logo_trurnitleipzig.gif',
            'office': {
              0: { 
                'street': 'Uferstr. 21',
                'zipCity': '04105 Leipzig',
                'contactPerson': 'Geschäftsleitung:<br>Jochen Kasper',
                'phone': '+49 (0)341 25 39 78-15',
                'fax': '+49 (0)341 25 39 78-77',
                'mail': 'Kasper.Jochen@trurnit.de',
                'web': ['']
              }
            }},
          'Trurnit Media Solutions': {'active': '1',
            'name': 'Trurnit Media Solutions',
            'subtitle': 'Frank Trurnit & Partner Verlag GmbH',
            'image': 'trurnit_media_solutions.gif',
            'logo': 'logo_media_solutions.gif',
            'office': {
              0: { 
                'street': 'Putzbrunner Straße 38',
                'zipCity': '85521 Ottobrunn',
                'contactPerson': 'Geschäftsleitung:<br>Leif Küpper',
                'phone': '+49 (0)89 60 80 01-69',
                'fax': '+49 (0)89 60 80 01-30',
                'mail': 'kuepper.leif@trurnit.de',
                'web': ['www.trurnit.de']
              }
            }},
         'Trurnit München': {'active': '1',
            'name': 'Trurnit München',
            'subtitle': 'Frank Trurnit & Partner Verlag GmbH',
            'image': 'trurnitmuenchen.gif',
            'logo': 'logo_trurnit.gif',
            'office': {
              0: {                        
                'street': 'Balanstraße 73/10',
                'zipCity': '81541 München',
                'contactPerson': 'Geschäftsleitung:<br>Dagmar Odenwald',
                'phone': '+49 (0)89 60 86 65-301',
                'fax': '+49 (0)89 60 86 65-310',
                'mail': 'odenwald.dagmar@trurnit.de',
                'web': ['www.trurnit.de'] 
              }             
            }},
          'Trurnit & Partner Verlag': {'active': '1',
            'name': 'Trurnit & Partner Verlag',
            'subtitle': 'Frank Trurnit & Partner Verlag GmbH',
            'image': 'ftp.gif',
            'logo': 'logo_trurnit.gif',
            'office': {
              0: { 
                'street': 'Putzbrunner Straße 38',
                'zipCity': '85521 Ottobrunn',
                'contactPerson': 'Leiter Marketing und Vertrieb:<br>Franz Schlick',
                'phone': '+49 (0)89 60 80 01-34',
                'fax': '+49 (0)89 60 80 01-30',
                'mail': 'schlick.franz@trurnit.de',
                'web': ['www.twitter.com/trurnit_gruppe']
              }
            }},
          'zabeo Marketing Partner': {'active': '1',
            'name': 'zabeo Marketing Partner',
            'subtitle': '',
            'image': 'zabeo.gif',
            'logo': 'logo_zabeo.gif',
            'office': {
              0: {  
                'street': 'Maybachstr. 50',
                'zipCity': '70469 Stuttgart',
                'contactPerson': 'Geschäftsführung:<br>Axel Banoth',
                'phone': '+49 (0)711 993 396-0',
                'fax': '+49 (0)711 993 396-11',
                'mail': 'axel.banoth@zabeo.de',
                'web': ['www.zabeo.de'] 
              },
              1: {
                'street': 'Wilhelmstraße 62',
                'zipCity': '65183 Wiesbaden'
              }
            }},
          'zabeo Marketing Partner Wiesbaden': {'active': '0',
                'name': 'zabeo Marketing Partner',
                'subtitle': 'zabeo MarketingPartner GmbH',
                'image': 'zabeo.gif',
                'logo': 'logo_zabeo.gif',
                'office': {
                  0: {  
                    'street': 'Wilhelmstraße 62',
                    'zipCity': '65183 Wiesbaden',
                    'contactPerson': 'Geschäftsführung:<br>Axel Banoth',
                    'phone': '+49 (0)611 341 56-0',
                    'fax': '+49 (0)611 341 56-59',
                    'mail': 'axel.banoth@zabeo.de',
                    'web': ['www.zabeo.de']
                  }
            }},
          'zabeo Marketing Partner Stuttgart': {'active': '0',
                'name': 'zabeo Marketing Partner',
                'subtitle': 'zabeo MarketingPartner GmbH',
                'image': 'zabeo.gif',
                'logo': 'logo_zabeo.gif',
                'office': {
                  0: {  
                    'street': 'Maybachstr. 50',
                    'zipCity': '70469 Stuttgart',
                    'contactPerson': 'Geschäftsführung:<br>Axel Banoth',
                    'phone': '+49 (0)711 993 396-0',
                    'fax': '+49 (0)711 993 396-11',
                    'mail': 'axel.banoth@zabeo.de',
                    'web': ['www.zabeo.de']
                  }
            }},
          'Zahl + Zeichen': {'active': '1',
            'name': 'Zahl + Zeichen',
            'subtitle': 'Zahl + Zeichen Corporate Communications GmbH',
            'image': 'zahlzeichen.gif',
            'logo': 'logo_zahlzeichen.gif',
            'office': {
              0: { 
                'street': 'Novalisstraße 10',
                'zipCity': '10115 Berlin',
                'contactPerson': 'Geschäftsführer:<br>Harald Burghardt',
                'phone': '+49 (0)30 24 62 94-46',
                'fax': '+49 (0)30 24 62 94-11',
                'mail': 'info@zahl-zeichen.de',
                'web': ['www.zahl-zeichen.de']
              }
            }},
          'Zeit & bild Verlag': {'active': '1',
            'name': 'Zeit & bild Verlag',
            'subtitle': 'Zeit & bild Verlag GmbH',
            'image': 'zeitbild.gif',
            'logo': 'logo_zeitbild.gif',
            'office': {
              0: {
                'street': 'Häusserstr. 36',
                'zipCity': '69115 Heidelberg',
                'contactPerson': 'Geschäftsführung:<br>Frank Holst',
                'phone': '+49 (0)6221 90 13-0',
                'fax': '+49 (0)6221 90 13-41',
                'mail': 'holst.frank@zeit-bild-verlag.de',
                'web': ['www.zeit-bild-verlag.de'] 
              }
            }}
    };

    var elementsData = {
      'orte': {
         1: { 'name': 'München', 'company': 'Trurnit & Partner Verlag', 'eImage': 'label_muenchen.gif', 'highlight': 'big', 'x': 330, 'y': 310 },
         2: { 'name': 'Dortmund', 'company': 'KOMMIT Medien Dortmund', 'eImage': 'label_dortmund.gif', 'highlight': 'small', 'x': 87, 'y': 52 },
         3: { 'name': 'Hamburg', 'company': 'Medien Werkstatt Nord', 'eImage': 'label_hamburg.gif', 'highlight': 'small', 'x': 293, 'y': 38 },
         4: { 'name': 'Berlin', 'company': 'Zahl + Zeichen', 'eImage': 'label_berlin.gif', 'highlight': 'small', 'x': 462, 'y': 65 },
         5: { 'name': 'Leipzig', 'company': 'Trurnit Leipzig', 'eImage': 'label_leipzig.gif', 'highlight': 'small', 'x': 392, 'y': 142 },
         6: { 'name': 'Belgrad', 'company': 'CMS Serbia', 'eImage': 'label_belgrad.gif', 'highlight': 'small', 'x': 438, 'y': 371 },
         7: { 'name': 'Aarau', 'company': 'Braintrain', 'eImage': 'label_aarau.gif', 'highlight': 'small', 'x': 245, 'y': 383 },
         8: { 'name': 'Augsburg', 'company': 'makandra', 'eImage': 'label_augsburg.gif', 'highlight': 'small', 'x': 198, 'y': 344 },
         9: { 'name': 'Engstingen', 'company': 'Pressewerk', 'eImage': 'label_engstingen.gif', 'highlight': 'small', 'x': 122, 'y': 310 },
        10: { 'name': 'Stuttgart', 'company': 'Energie & Medien Verlag', 'eImage': 'label_stuttgart.gif', 'highlight': 'small', 'x': 73, 'y': 260 },
        11: { 'name': 'Heidelberg', 'company': 'Zeit & bild Verlag', 'eImage': 'label_heidelberg.gif', 'highlight': 'small', 'x': 97, 'y': 222 },
        12: { 'name': 'Wiesbaden', 'company': 'zabeo Marketing Partner', 'eImage': 'label_wiesbaden.gif', 'highlight': 'small', 'x': 76, 'y': 166 },
        13: { 'name': 'Frankfurt', 'company': 'KOMMIT Medien', 'eImage': 'label_frankfurt.gif', 'highlight': 'small', 'x': 110, 'y': 142 }
      },
      'leistungen': {
        1: { 'name': 'Print', 'company': 'Trurnit München', 'eImage': 'label_print.gif', 'highlight': 'small', 'x': 187, 'y': 52 },
        2: { 'name': 'Online', 'company': 'Successnet', 'eImage': 'label_online.gif', 'highlight': 'small', 'x': 449, 'y': 75 },
        3: { 'name': 'Consulting', 'company': 'Eckart & Partner', 'eImage': 'label_consulting.gif', 'highlight': 'small', 'x': 419, 'y': 342 },
        4: { 'name': 'Film', 'company': 'Trurnit Filmmedien', 'eImage': 'label_film.gif', 'highlight': 'small', 'x': 155, 'y': 351 },
        5: { 'name': 'Werbung', 'company': 'zabeo Marketing Partner', 'eImage': 'label_werbung.gif', 'highlight': 'small', 'x': 82, 'y': 242 },
        6: { 'name': 'Pressearbeit', 'company': 'Pressewerk', 'eImage': 'label_pressearbeit.gif', 'highlight': 'small', 'x': 92, 'y': 111 }
      }
    };

    var highlights = {
      'orte': {
        'small': { 'w': 24, 'h': 24, 'url': 'highlight_small.gif' },
        'big': { 'w': 41, 'h': 41, 'url': 'highlight_big.gif' }
      },
      'leistungen': {
        'small': { 'w': 41, 'h': 41, 'url': 'highlight_small.gif' }
      }
    };

    loadGridData('firmen');
    loadMapData('orte');
    loadMapData('leistungen');

    function loadMapData(name){
      $.each(elementsData[name], function(i,o){
        var eID = name + i;

        $('<div/>').addClass('elementHighlight').attr('id', eID + '-highlight').css({
          top: o.y-((highlights[name][o.highlight].h-18)/2),
          left: o.x-highlights[name][o.highlight].w-5,
          height: highlights[name][o.highlight].h,
          width: highlights[name][o.highlight].w,
          background: 'transparent url(' + imageDir + name + '/' + highlights[name][o.highlight].url + ') no-repeat center center'
        }).hide().appendTo('#'+name);

        $('<div/>').addClass('elementLabel').attr('id', eID + '-label').css({
          top: o.y,
          left: o.x,
          'background-image': 'url(' + imageDir + name + '/' + o.eImage + ')'
        }).click(function(){
          $('#' + name + ' .elementHighlight').removeClass('active').hide();
          $('#' + name + ' .elementLabel').removeClass('active').css('background-position', '0 0');

          $('#' + name + ' .elementHighlight[id|=' + eID + ']').addClass('active').show();
          $('#' + name + ' .elementLabel[id|=' + eID + ']').addClass('active').css('background-position', '0 -18px');
          setElementContent(companies[o.company], name);
        }).appendTo('#'+name);

      });

      $('#'+name).children('canvas, .elementLabel').fadeIn(50);

      /* Load initdata and set the active state */
      //$('#' + name + ' .elementLabel').eq(0).addClass('active').css('background-position', '0 -18px');
      //$('#' + name + ' .elementHighlight').eq(0).addClass('active').show();
      //setElementContent(companies[elementsData[name][1].company], name);
    }

    function loadGridData(name){
      $('<div/>').addClass('loadingGrid').fadeTo('fast', 0.7).prependTo('#grid');
      $.each(companies, function(i,o){ 
            var intActive = parseInt(o.active);
        if (intActive == 1) {
               var cube = $('<div/>').addClass('cube');
               $('<img/>').attr({src: imageDir + name + '/' + o.logo, alt: o.name}).appendTo(cube);
               $('<div/>').addClass('cubeTOuter').append($('<div/>').addClass('cubeTInner').append($('<a/>').attr('href', '#').text(o.name))).appendTo(cube);

               cube.click(function(){
                     $('<div/>').addClass('loadingContent').fadeTo('fast', 0.7).prependTo('#' + name);
                     $('.cube').children('img:not(:animated)').removeClass('active').animate({
                        top: -88
                     }, 250);
                     $(this).children('img').addClass('active').stop().animate({
                        top: 0
                     }, 500, 'easeOutBounce');
                         
                  setElementContent(o, name);
                  $('.loadingGrid').fadeTo('fast', 0, function(){
                     $(this).remove();
                  });
               }).appendTo('#grid');
            }
      });

      /* Load startdata and set the active state */
      /*$('.cube').children('img').eq(0).addClass('active').animate({
        top: 0
      }, 500, 'easeOutBounce');
      setElementContent(companies[14], 'firmen');
      */
      $('.loadingGrid').fadeTo('fast', 0, function(){
        $(this).remove();
      });
    }

    function setElementContent(data, targetName){
    
      $('<div/>').addClass('loadingContent').fadeTo('fast', 0.7).prependTo('#' + targetName);

      if($('#' + targetName + ' .elementContentBox').length){
        $('#' + targetName + ' .elementContentBox').remove();
      }

      var elementContentBox = $('<div/>').addClass('elementContentBox');
      var elementContentBoxHeader = $('<h1/>').append($('<img/>').attr({ src: imageDir + targetName + '/' + data.image, alt: data.name })).appendTo(elementContentBox);
      var elementContentBoxContent = $('<div/>').appendTo(elementContentBox);
      var companyAdress = '';
      var companyCEO = '';
      var companyContact = '';
      

      $('<h2/>').text(data.subtitle).appendTo(elementContentBoxContent);
      
      $.each(data.office, function(i, office){
        companyAdress += '<p>' + office.street + '<br>' + office.zipCity + '</p>';
        companyCEO += (office.contactPerson)?'<p>' + office.contactPerson + '</p>':'';
        
        if(office.web){
          var webLinks = '';
          $.each(office.web, function(ii, url){
            webLinks += '<br><a href="' + ((url.search(/(http:\/\/|https:\/\/)/) > -1)?url:'http://'+url) + '" target="_blank">' + url + '</a>';  
          });
        }
        
        if(office.phone || office.fax || office.mail || webLinks)
        companyContact += '<p>' + ((office.phone != '')?('Tel. ' + office.phone):'') + ((office.fax != '')?('<br>Fax ' + office.fax):'') + '<br><a href="mailto:' + office.mail + '" target="_blank">' + office.mail + '</a>' + webLinks + '</p>';
      });
      
      elementContentBoxContent.append(companyAdress + companyCEO + companyContact);
      
      elementContentBox.prependTo($('#' + targetName));

      $('.loadingContent').remove();
    }

    $('.elementLabel').css('cursor', 'pointer').live('mouseenter mouseleave',function(event){
      if(event.type == 'mouseenter'){
        //alert($(this).attr('id'));
        $(this).css('background-position', '0 -18px');
        $('.elementHighlight').eq($('.elementLabel').index(this)).show();
      }
      if(event.type == 'mouseleave'){
        if(!$(this).hasClass('active')){
          $(this).css('background-position', '0 0');
        }
        if(!$('.elementHighlight').eq($('.elementLabel').index(this)).hasClass('active')){
          $('.elementHighlight').eq($('.elementLabel').index(this)).hide();
        }
      }
    });

    $('.elementHighlightSense').css('cursor', 'pointer').live('mouseenter mouseleave',function(event){
      if(event.type == 'mouseenter'){
        $('.elementLabel').eq($('.elementHighlightSense').index(this)).css('background-position', '0 -18px');
        $('.elementHighlight').eq($('.elementHighlightSense').index(this)).show();
      }
      if(event.type == 'mouseleave'){
        if(!$('.elementHighlight').eq($('.elementHighlightSense').index(this)).hasClass('active')){
          $('.elementHighlight').eq($('.elementHighlightSense').index(this)).hide();
        }
        if(!$('.elementLabel').eq($('.elementHighlightSense').index(this)).hasClass('active')){
          $('.elementLabel').eq($('.elementHighlightSense').index(this)).css('background-position', '0 0');
        }
      }
    });

    $('.cube').css('cursor', 'pointer').live('mouseenter mouseleave',function(event){
      if(event.type == 'mouseenter'){
        $(this).children('img').stop().animate({
          top: 0
        }, 500, 'easeOutBounce');
      }
      if(event.type == 'mouseleave'){
        if(!$(this).children('img').hasClass('active')){
          $(this).children('img').stop().animate({
            top: -88
          }, 250);
        }
      }
    });
  });

