		
/*
 * Console logger
 *  %s	String
 *  %d, %i	Integer (numeric formatting is not yet supported)
 *  %f	Floating point number (numeric formatting is not yet supported)
 *  %o	Object hyperlink
 * 
 *  only logs if globalVars.log = true
 */

	$.log = function() {
	  	if(window.console) {
			if($.browser.safari){
				// Safari console
				var args = "";
				$.each(arguments,function(i,val){
					args += " " + val;
				});
				window.console.log(args); // fix to show args, Safari doesn't like .apply
			}
			if ($.browser.mozilla) {
				// Firefox with firebug
				window.console.log.apply(this, arguments);
			}
	  	} else {
	  		// no Firebug
	    	//alert(message);
		}
	};

/* 
 *  fix IE6 link background image flicker bug
 */
		
	try {  document.execCommand("BackgroundImageCache", false, true); } catch(err) {} 

/*
 *  preload images
 */

		var preloads = [
			"/images/ajax-loading.gif"
		];
		$.each(preloads,function(i,img){
			var x = new Image;
			x.src = img;
		});

/* External link tagger plugin
 *   adds class="external"
 *   adds target="_blank"
 *   binds Google Analytics track page view to links onClick
 *   
 *   Add later: https, don't include URLs that match current domain
 */

	jQuery.externalLinks = function(selector,options){
		var settings = jQuery.extend({
		     cssClass: "external",
			 target: "_blank",
		     gaPrefix: "/LINK/",
		     gaTracking: true
		 }, options);
		 var links = selector.find('[href^="http://"]');		
		// bind click for GA tracking code
		if(settings.gaTracking){
			links.click(function(){
				var href = jQuery(this).attr("href");
				href = href.substr(7,9999);	// trim off http://
				var i = href.indexOf("www.");	// trim off www.
				if (i===0){
					href = href.substr(4,9999);
				}
				url = settings.gaPrefix + encodeURI(href);		// encode URL
				//jQuery.log(pre + href);			// log href to console
				//urchinTracker(url)	// old GA tracker code
				//$.log(url)
				pageTracker._trackPageview(url)	// GA tracker code
				//return false;				// cancel link click action
			});			
		}
		// add CSS class for styling
		if(settings.cssClass){
			links.addClass(settings.cssClass);
		}
		// add target to load in popup window
		if(settings.target){
			links.attr('target', settings.target);
		}
	}
	
$(document).ready(function(){
	
	$.externalLinks($("body"));
	
	// header image rotator
	$("#photo-rotator").html("<img src=\"images/random/image01.jpg\" alt=\"Access Spokane\"/>");
	
	// signup form
		// change text on focus
		$("#signup .email").focus(function(){
			$(this).val("");
		})

});

// rounded corners
	window.onload = function(){
	    Nifty("div.box");
	};

