

// IE 6 Alert
$(document).ready(function() {
				   
});

function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 

// Make hover state work in IE
$(document).ready(function() {

	$("#mainNav li ul").hide(); 
	$("#mainNav li").hover(
        function () {
		$(this).children("ul").show('slow');
        },function(){
		$(this).children("ul").hide();
	});//hover

});

// Custom Scroll Bars using jScrollPane
$(document).ready(function() {
	$('.pageText').jScrollPane({
		scrollbarWidth: 3,
		ScrollbarMargin: 3,
	});	
});

 
// Buzz panel slide up and down
$(document).ready(function() {
	 $('a#buzzBtn').click(function() {
		
		
		if ((screen.width>=1400) ){

		$("body").css({'overflow':'hidden'});
		}
		
		
if ($('#buzzContent').is(':visible')) {
		$('#buzzContent').animate({marginTop: '0',opacity: 1}, 100)
		$('#buzzContent').hide();

	} else {
		$('#buzzContent').animate({marginTop: '-593px',opacity: 1}, 100)
		$('#buzzContent').show();
		

		}								   
	});
});


	
	
							  
								   



// contact panel slide up and down
/*
$(document).ready(function() {
	 $('#contact').click(function() {
		$('#contactPage')
		.delay(3000).show('fold');
	});
});
*/


// Carreers page
$(document).ready(function() {
	$('.jobsContainer > h4, .jobsContainer h6').addClass('lavender');
	$('.jobsContainer h6').css({
			  'text-transform':'lowercase',
			  'font-family':'FuturaBookRegular',
			  'font-style':'italic',
			  'opacity':'1',
	});
});

// ==== background color change to work with the Flash //
/*
$(document).ready(function() {
	var changeBgColor(newBgColor) {
if ('#flash') {
document.bgColor = newBgColor;
	}
}
});
*/
/*
function changeBgColor(newBgColor) {
if (window.document && window.document.bgColor) {
document.bgColor = newBgColor;
	}
}
*/
////////////////////////////////
// jQuery UI code for Slider //
//////////////////////////////
	$(document).ready(function() {
		//scrollpane parts
		var scrollPane = $( ".scroll-pane" ),
			scrollContent = $( ".scroll-content" );
		
		//build slider
		var scrollbar = $( ".scroll-bar" ).slider({
			slide: function( event, ui ) {
				if ( scrollContent.width() > scrollPane.width() ) {
					scrollContent.css( "margin-left", Math.round(
						ui.value / 100 * ( scrollPane.innerWidth() - scrollContent.innerWidth() )
					) + "px" );
				} else {
					scrollContent.css( "margin-left", 0 );
				}
			}
		});
		
		//append icon to handle
		var handleHelper = scrollbar.find( ".ui-slider-handle" )
		.mousedown(function() {
			scrollbar.width( handleHelper.width() );
		})
		.mouseup(function() {
			scrollbar.width( "100%" );
		})
		.append( "<span class='ui-icon ui-icon-grip-dotted-vertical'></span>" )
		.wrap( "<div class='ui-handle-helper-parent'></div>" ).parent();
		
		//change overflow to hidden now that slider handles the scrolling
		scrollPane.css( "overflow", "hidden" );
		
		//size scrollbar and handle proportionally to scroll distance
		function sizeScrollbar() {
			var remainder = scrollContent.width() - scrollPane.width();
			var proportion = remainder / scrollContent.width();
			var handleSize = scrollPane.width() - ( proportion * scrollPane.width() );
			scrollbar.find( ".ui-slider-handle" ).css({
				width: handleSize,
				"margin-left": -handleSize / 2
			});
			handleHelper.width( "" ).width( scrollbar.width() - handleSize );
		}
		
		//reset slider value based on scroll content position
		function resetValue() {
			var remainder = scrollPane.width() - scrollContent.width();
			var leftVal = scrollContent.css( "margin-left" ) === "auto" ? 0 :
				parseInt( scrollContent.css( "margin-left" ) );
			var percentage = Math.round( leftVal / remainder * 100 );
			scrollbar.slider( "value", percentage );
		}
		
		//if the slider is 100% and window gets larger, reveal content
		function reflowContent() {
				var showing = scrollContent.width() + parseInt( scrollContent.css( "margin-left" ), 10 );
				var gap = scrollPane.width() - showing;
				if ( gap > 0 ) {
					scrollContent.css( "margin-left", parseInt( scrollContent.css( "margin-left" ), 10 ) + gap );
				}
		}
		
		//change handle position on window resize
		$( window ).resize(function() {
			resetValue();
			sizeScrollbar();
			reflowContent();
		});
		//init scrollbar size
		setTimeout( sizeScrollbar, 10 );//safari wants a timeout
	});


//Fly in the boxes on the gallery pages
$(document).ready(function() {
setTimeout(function(){
$("#image1").animate({
    opacity: 1,
    marginTop: '0px',
     }, 500, function() {
    // Animation complete.
  });
},100);
});
	
	$(document).ready(function() {
setTimeout(function(){
$("#image2").animate({
    opacity: 1,
    marginTop: '0px',
   	 }, 500, function() {
    // Animation complete.
  });
},200);
});
	
	
	
$(document).ready(function() {
setTimeout(function(){
$("#image3").animate({
    opacity: 1,
    marginTop: '0px',
     }, 500, function() {
    // Animation complete.
  });
},250);
});


$(document).ready(function() {
setTimeout(function(){
$("#image4").animate({
    opacity: 1,
    marginTop: '0px',
     }, 500, function() {
    // Animation complete.
  });
},300);
});


$(document).ready(function() {
setTimeout(function(){
$("#image5").animate({
    opacity: 1,
    marginTop: '0px',
     }, 500, function() {
    // Animation complete.
  });
},350);
});


$(document).ready(function() {
setTimeout(function(){
$("#image6").animate({
    opacity: 1,
    marginTop: '0px',
     }, 500, function() {
    // Animation complete.
  });
},400);
});



$(document).ready(function() {
setTimeout(function(){
$("#image7").animate({
    opacity: 1,
    marginTop: '0px',
     }, 500, function() {
    // Animation complete.
  });
},450);
});
	
	$(document).ready(function() {
setTimeout(function(){
$("#image8").animate({
    opacity: 1,
    marginTop: '0px',
     }, 500, function() {
    // Animation complete.
  });
},500);
});
	
	
	
$(document).ready(function() {
setTimeout(function(){
$("#image9").animate({
    opacity: 1,
    marginTop: '0px',
     }, 500, function() {
    // Animation complete.
  });
},550);
});


$(document).ready(function() {
setTimeout(function(){
$("#image10").animate({
    opacity: 1,
    marginTop: '0px',
     }, 500, function() {
    // Animation complete.
  });
},600);
});


$(document).ready(function() {
setTimeout(function(){
$("#image11").animate({
    opacity: 1,
    marginTop: '0px',
     }, 500, function() {
    // Animation complete.
  });
},650);
});


$(document).ready(function() {
setTimeout(function(){
$("#image12").animate({
    opacity: 1,
    marginTop: '0px',
     }, 500, function() {
    // Animation complete.
  });
},700);
});


$(document).ready(function() {
setTimeout(function(){
$("#image13").animate({
    opacity: 1,
    marginTop: '0px',
     }, 500, function() {
    // Animation complete.
  });
},750);
});


$(document).ready(function() {
setTimeout(function(){
$("#image14").animate({
    opacity: 1,
    marginTop: '0px',
     }, 500, function() {
    // Animation complete.
  });
},800);
});


$(document).ready(function() {
setTimeout(function(){
$("#image15").animate({
    opacity: 1,
    marginTop: '0px',
     }, 500, function() {
    // Animation complete.
  });
},850);
});


$(document).ready(function() {
setTimeout(function(){
$("#image16").animate({
    opacity: 1,
    marginTop: '0px',
     }, 500, function() {
    // Animation complete.
  });
},90);
});


$(document).ready(function() {
setTimeout(function(){
$("#image17").animate({
    opacity: 1,
    marginTop: '0px',
     }, 500, function() {
    // Animation complete.
  });
},950);
});


$(document).ready(function() {
setTimeout(function(){
$("#image18").animate({
    opacity: 1,
    marginTop: '0px',
     }, 500, function() {
    // Animation complete.
  });
},1000);
});


$(document).ready(function() {
setTimeout(function(){
$("#image19").animate({
    opacity: 1,
    marginTop: '0px',
     }, 500, function() {
    // Animation complete.
  });
},1050);
});


$(document).ready(function() {
setTimeout(function(){
$("#image20").animate({
    opacity: 1,
    marginTop: '0px',
     }, 500, function() {
    // Animation complete.
  });
},1100);
});



