/* * Console logger *  * Message variables *  %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 = arguments[0];
            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);
    
    }
};	// Jquery DOM ready functions	$(document).ready(function(){		// de-obfuscate SPAM-proof email addresses		function deobfuscate(x){			return x.replace("--a@t--","@");		}		$("a").each(function (i){			var h = this.href;			if (h.indexOf("mailto")==0) {				var t = deobfuscate($(this).html());				this.href = deobfuscate(h);				$(this).html(t);			}		});				// tag external links		var pre = "/LINK/";				// prefix to add to URL for GA tracking code		$('a[href^="http://"]')			.addClass('external')			// add CSS class for styling			.attr('target', '_blank')		// open in popup window			.click(function(){				// GA tracking code				var href = $(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);				}				href = encodeURI(href);		// encode URL				$.log(pre + href);			// log href to console				pageTracker._trackPageview(pre + href)	// GA tracker code				//return false;				// cancel link action			})		;				/*  		 * track events with GA		 */				/* cover photo popups */		$("a.cover-thumb").click(function(){			$.log("cover image popup clicked");			pageTracker._trackEvent("Images", "Popup", "Cover photo");		});		// sidebar nav menu animation		var nav_prefix_group = "nav_links_";		var nav_last_group = null;		$("#nav li").not("#" + nav_prefix_group + "home").find("h3 a").click(function(){			var sel;			// get group id			var gid = $(this).parent().parent().attr("id");			gid = gid.replace(nav_prefix_group,"");			$.log("nav heading %o clicked",gid);			// quit if same group as opened			if (gid == nav_last_group){				//$.log("last group same as this group");				return false;			}			nav_select(gid, true);			// cancel default action			return false;		});		function nav_select(gid, action){			// close last group			if (nav_last_group != null) {				sel = "#nav #" + nav_prefix_group + nav_last_group; 				$(sel + " h3").removeClass("selected");				if (action) {					$(sel + " ul").slideUp("fast");				//$(sel + " ul").hide();				} else {					$(sel + " ul").hide();									}				//$.log("hiding group %o (%s)",nav_last_group,sel);			}			// open selected group			sel = "#nav #" + nav_prefix_group + gid; 			$(sel + " h3").addClass("selected");			if (action) {				$(sel + " ul").slideDown("fast");			} else {				$(sel + " ul").show();								}			//$.log("showing group %o (%s)",gid,sel);			// set last group			nav_last_group = gid;			}		// open current group		if (typeof nav_current_group != "undefined"){			nav_select(nav_current_group,false);		} else {			nav_current_group = null;		}				// cover photo error image replacement		$(".cover-gallery img, .issue-cover img").error(function(){			$(this)				.attr("src","/articles/covers/na.gif")				.attr("title","No image available")			;			var link = $(this).parent();			var contents = link.html();			link.replaceWith(contents);		});			});	// send email from SPAM-safe link	   function SafeMailClick (pre, suff) {	       email = pre + "@" + suff;	       url = "mai"+"l"+"to"+":" + email;	       //obj.innerHTML = email;	       document.location=url;	   }// Firefox search plugin	function errorMsg()	{	 alert("Netscape 6 or Mozilla is needed to install a sherlock plugin");	}	function addEngine(name,ext,cat,type)	{	 if ((typeof window.sidebar == "object") && (typeof	 window.sidebar.addSearchEngine == "function"))	 {	   //cat="Web";	   //cat=prompt('In what category should this engine be installed?','Web')	   window.sidebar.addSearchEngine(	     "http://www.agpowermag.com/mozillasearch/"+name+".src",	     "http://www.agpowermag.com/mozillasearch/"+name+"."+ext,	     name,	     cat );	 }	 else	 {	   errorMsg();	 }	}// old page load functions/*	timer_start = 0;	timer_php = 0;	function getmicrotime() {		timer = new Date();		return timer.getTime();	}	function pageLoad() {		if (timer_start) {			timer_stop = getmicrotime();			timer_html = parseInt(timer_stop - timer_start);			if (timer_php) {				timer_php = parseInt(timer_php*1000);				timer_total = parseInt(timer_html + timer_php);			} else {				timer_total = timer_html;			}			timer_total = parseFloat(timer_total / 1000);			t = document.getElementById("timer_label");			t.innerHTML = timer_total;		}		// set focus to first text field if available					// set focus to first text field in first form					focus_set = false;		if (document.forms.length > 0) {						  var field = document.forms[0];			for (i = 1; i < field.length; i++) {								  if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea")) {									    	document.forms[0].elements[i].focus();											focus_set = true;					break;									}	      						}  		}		if (!focus_set) {			// set to sidebar search if no field selected			//document.sidebar_search.searchstr.focus();		}	}*/