var params = { menu: "false", wmode: "transparent"}; 
swfobject.embedSWF("/assets/flash/spinning_earth_globe_vedp.swf", "globe", "84", "100", "8.0.0" , params);

// on dom ready
$(function() {

  var winW = $(window).width();
  $('div#exporting101-slideshow').css('left', winW/2-$('#exporting101-slideshow').width()/2);

  //menu
  $('ul#navigation li:not(#home)').hover(
    function () {
      $(this).addClass('menu-active');
    }, 
    function () {
      $(this).removeClass('menu-active');
    }
  );

  $('ul#navigation li ul').mouseover(
    function () {
      $(this).parents('li').addClass('menu-active');
    }
  );

  //trade manager map
  $('#trade-managers-map area').hover(
    function () {
      var thisId = $(this).attr('id');
      $('div.' + thisId).show();
    }, 
    function () {
      $('div.trade-manager-popup').hide();
    }
  );

  //export 101
  $('div#exporting-101 a').click(function() {
    $('#slideshow-moda').show();

    //Get the screen height and width  
    var maskHeight = $(document).height();  
    var maskWidth = $(window).width();  

    //Set height and width to mask to fill up the whole screen  
    $('#slideshow-modal').css({'width':maskWidth,'height':maskHeight});  

    //Get the window height and width  
    var winH = $(window).height();  
    var winW = $(window).width();  

    //Set the popup window to center  
    $('#slideshow-modal').css('top',  winH/2-$('#slideshow-modal').height()/2);  
    $('#slideshow-modal').css('left', winW/2-$('#slideshow-modal').width()/2).show(); 

    $('div#exporting101-slideshow').css('z-index' , '99999');
    $('div#exporting101-slideshow').css('left', winW/2-$('#exporting101-slideshow').width()/2);

    $('#globe').hide();

    return false;
  });

  if ($('div#slides').length > 0) {
    $('div#slides').cycle({ 
      fx:    'fade',
      timeout: 10000, 
      speed:  2500
    });
  };

  $('a#close-button').click(function() {
    $('div#exporting101-slideshow').css('z-index','-1');
    $('#slideshow-modal').hide();
    $('#globe').show();
    return false;
  });

  if ($('div#exporting101-slideshow').length>0) {
    $('div#exporting101-slideshow div#slide-wrapper').cycle({
      fx:      'fade',
      timeout:  0,
      prev:    'a#slide-prev',
      next:    'a#slide-next',
      pager: '#slide-nav',
      pagerAnchorBuilder: pagerFactory
    });
  };

  function pagerFactory(idx, slide) {
    return '<a href="#">'+(idx+1)+'</a> ... ';
  };

});