/*
The effect parameter can be any of the following:

    * sliceDown
    * sliceDownLeft
    * sliceUp
    * sliceUpLeft
    * sliceUpDown
    * sliceUpDownLeft
    * fold
    * fade
    * random

*/

$(window).load(function() {
	$('#slider').nivoSlider({
		effect:'fold', //Specify sets like: 'fold,fade,sliceDown'
		slices:5,
		animSpeed:1000, //Slide transition speed
		pauseTime:4500,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:false, //Next & Prev
		directionNavHide:true, //Only show on hover
		controlNav:false, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
    controlNavThumbsFromRel:false, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:false, //Use left & right arrows
		pauseOnHover:false, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});
	$("a[href^=http]").attr("target","_blank");
	
});

$(function () { 
    
  //news  
  $("#pressReleases").accordion({ 
    header: '.pressHeader',
    collapsible: true,
    active: false,
    fillSpace: true, 
    clearStyle: true,
    animated:false });
    
  // required fields for forms
	$("#commentForm").validate();

	// sales map
	$('#sales-map').addClass($('.rd a.selected').attr('id'));
	
	$('.salesBoxes.rd a').mouseover(function() {  
	    var currentMap = $('#sales-map').attr("class");
	    $('#sales-map').removeClass(currentMap).addClass($(this).attr('id'));
  });
  
  $('.salesBoxes.rd').mouseout(function() {  
       var currentMap = $('#sales-map').attr("class");
	    $('#sales-map').removeClass(currentMap).addClass($('.salesBoxes a.selected').attr('id'));
	    
  });


  // sales specialists
  $('.salesBoxes.specialists a').mouseover(function() {  
      var currentMap = $('#sales-map').attr("class");
      $('.department').addClass('org');
	    $('.department').text($(this).attr('title'));
	    $('#sales-map').removeClass(currentMap);
  });
  
  
  $('.salesBoxes.specialists a').mouseout(function() {
  
    $('.department').removeClass('org');
    
  });
  
  
  $('.salesBoxes.specialists').mouseout(function() {  
	    $('.department').text("department");
	    
	    $('.department').text($('.specialists a.selected').attr('title'));
	    $('#sales-map').addClass($('.rd a.selected').attr('id'));
  });
	
  var specialSelected = $('.specialists a.selected').attr('title');
  
  $('.department').text(specialSelected);
  $('.department').addClass('org');
  
  // management title on hover
  $('.management-bios a').mouseover(function() {  
	    $('a#sales span').text($(this).attr('title'));
	    $('a#sales').addClass('org');
  });
  $('.management-bios').mouseout(function() {  
	    $('a#sales span').text('');
	    $('a#sales').removeClass('org');
  });
  

  
});


