$(function() {
	$('a[rel*=external]').click( function() {
		window.open(this.href);
		return false;
	});
	
	if ($("#newsTicker").length > 0){
		$('#js-news').ticker({
			controls: true,
			titleText: 'Latest News:',
			displayType: 'reveal'
		});
	}

	$('nav ul').superfish({
		delay: 400,
		animation: {opacity:'show'},
		speed: 200,   
		autoArrows: false,
		dropShadows: false,
		disableHI: true    
	});
	
	$('input[type=text], input[type=password]').each(function() {
		$(this).addClass('dim');
		var default_value = this.value;
		$(this).focus(function(){
			if(this.value == default_value) {
				this.value = '';
			}
			$(this).removeClass('dim');
		});
		$(this).blur(function(){
			if(this.value == '') {
			   this.value = default_value;
			   $(this).addClass('dim');
			}
		});
	});
	
});

$(document).ready(function(){

	// Plant detail hovers
	var orig = $(".plantImage img").attr("src");
	
	$(".linker a").hover(
		function () {
			var link = $(this).attr("href");
			var linktext = $(this).text();
			$('.plantImage img').attr("src", link);
			$('.plantTitle').text(linktext);
			$('.plantInfo').text('');
			$(this).parent().prev().find('.planttext').clone().appendTo('.plantInfo');
		}
	);
	
	$(".hoverer").click(function() {
		return false;
	});
	
	// Cross-browser
	$('#video iframe:nth-child(2)').addClass('firstvid');

});
