// JavaScript Document

$(document).ready(function() {
   
   $("#img"+$('.currNavTd').index(".navTd")+"_bottom").css('visibility', 'visible');
   
   $(".navTd").not(".currNavTd").hover(function(){
   	$("#img"+$(".navTd").index(this)+"_bottom").css('visibility', 'visible');
	$(this).css("cursor", "pointer");
   },
   function(){
   	$("#img"+$(".navTd").index(this)+"_bottom").css('visibility', 'hidden');
   });
   $(".navTd").click(function(){
	window.location = $(this).find("a").attr('href'); return false;					  
	});
	
   $("#regBtn").hover(function(){
   $(this).attr('src','http://futureofbothell.com/images/register-over.gif');
   },
   function(){
   $(this).attr('src','http://futureofbothell.com/images/register.gif');
   });
   
   function setRecipient(){
		if($('#typeselect').val() == 'developer'){
			$('#recipients').val('terrie.battuello_*_ci.bothell.wa.us');
		}
		else {
			$('#recipients').val('downtownplan_*_ci.bothell.wa.us');
			
		}
	}
   $("#typeselect").change(function(){
		if($('#typeselect').val() != 'other'){
			$('#otherfield').hide();
		}
		else {
			$('#otherfield').show();
		}
		setRecipient();
	});
	
   (function($) {
   	var cache = [];
	$.preLoadImages = function() {
	var args_len = arguments.length;
	for (var i = args_len; i--;) {
	  var cacheImage = document.createElement('img');
	  cacheImage.src = arguments[i];
	  cache.push(cacheImage);
	  }
	}
   })(jQuery); 
   
jQuery.preLoadImages('http://futureofbothell.com/images/register-over.gif');

})
function externalLinks() {  
	if (!document.getElementsByTagName) return;  
	var anchors = document.getElementsByTagName("a");  
	for (var i=0; i<anchors.length; i++) {  
		var anchor = anchors[i];  
			if (anchor.getAttribute("href") &&  anchor.getAttribute("rel") == "external")  anchor.target = "_blank";  
		}  
}
window.onload = externalLinks; 
