// WINDOW.LOG

window.log = function(){
  log.history = log.history || [];  
  log.history.push(arguments);
  arguments.callee = arguments.callee.caller;  
  if(this.console) console.log( Array.prototype.slice.call(arguments) );
};
(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();)b[a]=b[a]||c})(window.console=window.console||{});


// GOOGLE ANALYTICS SNIPPET

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25848496-1']);
_gaq.push(['_trackPageview']);
_gaq.push(['_setAccount', 'UA-16846952-1']);
_gaq.push(['_trackPageview']);

(function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	window.log("Google Analytics run.");
})();

// QUERY STRING PARSER (written by ardms.org IT; for Contact Us pages)

querySt = function querySt(ji) {
   var hu = window.location.search.substring(1);
   var gy = hu.split('&');
   for (var i = 0; i < gy.length; i++) {
      var ft = gy[i].split('=');
      if (ft[0] == ji) {
         return ft[1];
      }
   }
   return '';
}


// HASH STRING PARSER (replaces query string parser - for Contact Us pages)

hashSt = function hashSt(ji) {
	if (window.location.hash.length > 1) {   
		var hu = window.location.hash;
		if (hu.search('\\?') > -1) {
			hu = (hu.split("?"))[1];
			window.log("?: "+hu);
		}
		else {
			hu = hu.substring(1);
			window.log("#: "+hu);
		}
		var gy = hu.split("&");	
		window.log("gy: "+gy);
		for (var i = 0; i < gy.length; i++) {
			var ft = gy[i].split("=");
			if (ft[0] == ji) {
				return ft[1];
			}
		}
	}
	return '';
}


// FIX FOR SEARCH BOX PLACEHOLDER IN OLD IE

oldie_set_placeholder = function oldie_set_placeholder(s, t) {

	$(".oldie " + s).val(t)
	.bind("focus",function(e){
		if ( $(this).val() == t ){$(this).val("");}
	})
	.bind("blur",function(e){
		if ( $(this).val() == "" ){$(this).val(t);}
	});

}
