jQuery.preloadImages = function()
	{
	  for(var i = 0; i<arguments.length; i++)
	  {
		jQuery("<img>").attr("src", arguments[i]);
	  }
}
// END PRELOAD IMAGES

$(document).ready(function(){
	
	//hide the contact window
	$("#hideme").click(function () { 
		$(this).fadeOut()
		$("#contactinfo").slideUp()
		$("#contact").removeClass("on");
		return false;
    });
	
	// show contact window
	$("#contact").click(function () { 
		$("#hideme").fadeIn()						  
		$(this).toggleClass("on")
		$("#contactinfo").slideToggle(500);
		return false;
	});
	
	// sidebar nav 
	$("#sidebar a").mouseover(function() {
		$(this).stop().animate({ backgroundColor: "#F47B20"}, 200);
	});
	$("#sidebar a").mouseout(function() {
		$(this).stop().animate({ backgroundColor: "#000"}, 500);
		
	});
	//
	// sidebar nav 
	$(".download a").mouseover(function() {
		$(this).stop().animate({ color: "#F47B20" }, 500);
	});
	$(".download a").mouseout(function() {
		$(this).stop().animate({ color: "#FFFFFF" }, 200);
		
	});
	// END SIDEBAR 
	//workday menu
	$("li #workday").mouseover(function() {
		$("ul #workdaySub").slideToggle();
	});
	//

});
/* START POP image desc
$(function(){

	$('.images')
		.css( {backgroundPosition: "0 0px"} )
		.mouseover(function(){
			$("#thumbs .desc").stop().animate({ backgroundColor: "#111213", opacity: "0.95", zindex: "1000" }, 200);
			
		})
		.mouseout(function(){
			$("#thumbs .desc").stop().animate({ backgroundColor: "#111213", opacity: "0", zindex: "1"}, 500);
		})
});
*/
// START TOP MENU EFFECT
$(function(){

	$('#menu a')
		.css( {backgroundPosition:"0 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 -10px)"}, {duration:200})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:200})
		})
});

$(document).ready(function(){
  var currentPosition = 0;
  var slideWidth = 710;
  var slides = $('.slide');
  var numberOfSlides = slides.length;

  // Remove scrollbar in JS
  $('#slidesContainer').css('overflow', 'hidden');

  // Wrap all .slides with #slideInner div
  slides
    .wrapAll('<div id="slideInner"></div>')
    // Float left to display horizontally, readjust .slides width
	.css({
      'float' : 'left',
      'width' : slideWidth
    });

  // Set #slideInner width equal to total width of all slides
  $('#slideInner').css('width', slideWidth * numberOfSlides);

  // Insert controls in the DOM
  $('#slideshow')
    .prepend('<span class="control" id="leftControl">&lt;</span>')
    .append('<span class="control" id="rightControl">&gt;</span>');

  // Hide left arrow control on first load
  manageControls(currentPosition);

  // Create event listeners for .controls clicks
  $('.control')
    .bind('click', function(){
    // Determine new position
	currentPosition = ($(this).attr('id')=='rightControl') ? currentPosition+1 : currentPosition-1;
    
	// Hide / show controls
    manageControls(currentPosition);
    // Move slideInner using margin-left
    $('#slideInner').animate({
      'marginLeft' : slideWidth*(-currentPosition)
    });
  });

  // manageControls: Hides and Shows controls depending on currentPosition
  function manageControls(position){
    // Hide left arrow if position is first slide
	if(position==0){ $('#leftControl').hide() } else{ $('#leftControl').show() }
	// Hide right arrow if position is last slide
    if(position==numberOfSlides-1){ $('#rightControl').hide() } else{ $('#rightControl').show() }
  }	
});

// END SLIDESHOW
//POPUP WINDOW
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
// END POP UP WINDOW


