// typical website functions, with jquery goodness

// SPAM EMAIL FILTER
showEml = function() {
	email_adds = $(".elink");
	for (i = 0; i < email_adds.length; i++) {
		eaddr = email_adds[i];
		raw = $(eaddr).text();
		subj = $(eaddr).attr("title");
		addr = raw.replace(" (at) ","@");
		if(subj) {
			addsubj = '?subject=' + subj;
		} else {
			addsubj = '';
		}
		$(eaddr).replaceWith('<a href="mailto:' + addr + addsubj + '">' + addr + '</a>');
	}
}

// reload a text-based XML file from a link
xmlReload = function() {		
	$("#loadx").click(function(event) {
		event.preventDefault();
		$.get('xml.lasso?iter=yes', function(data) {
			$('.xml').html(data);
		});
	});
}

//insert a Flash object with extra params (requires SWFObject)
insertSWFObject = function(filename, where, width, height, bghex) {
	var flashvars = {};
	var params = {};
	params.bgcolor = bghex;
	params.wmode = "opaque";
	var attributes = {};
	swfobject.embedSWF(filename, where, width, height, "8", false, flashvars, params, attributes);
}

// INFO PAGES; though these could be used elsewhere
showInfo = function() {
	$(".anchors").click(function(event){
		unhide = $(this).attr('rel');
		if($(unhide).css("display") != "block") {
			showQs();
			return false;
		} else {
			return true;
			//return false;
		}
	});
}
	
hideQs = function() {
	shortcuts = $(".shortcuts");
	for (i = 0; i < shortcuts.length; i++) {
		$(shortcuts[i]).css("display","none");
	}
}

// to work, needs to be preceded by: unhide = $(this).attr('href');
showQs = function() {
	hideQs();
	$(unhide).css("display","block");
}

//<![CDATA[

function gMapload() {
  if (GBrowserIsCompatible()) {
	var map = new GMap2(document.getElementById("gmap"));
	map.setCenter(new GLatLng(47.646904,-122.33874), 15);
  }
}

//]]>
