		function initiateClass(className, inlineData) {
			if (className) var objs = document.getElementsByClassName(className);
			else {
				var objs = document.getElementsByClassName('js');
				if (typeof(objs) == typeof({})) {
					var lastObjs = document.getElementsByClassName('js-last');
				}
				else {
					var objs = $$(".js");
					var lastObjs = $$(".js-last");
				}
				objs = objs.concat(lastObjs);
			}
			objs.each(function(item) {
				if (!className) {
					item.removeClassName('js');
					item.removeClassName('js-last');
					tempClassName = item.className.split(' ')[0];
					Object.extend(item,Classes[tempClassName]);
					delete tempClassName;
				}
				else Object.extend(item,Classes[className]);
				if (item['extend']) item['extend']();
				if (inlineData && item[inlineData]) {
					inlineObj = item[inlineData]();
					for (i in inlineObj) item[i] = inlineObj[i];
					delete inlineObj;
					item[inlineData] = null;
				}
				if (item['initiate']) item['initiate']();
			});
		}
		
		function initiateClasses() {
			initiateClass(null, 'ondblclick');
		}
		
		 var Query = window.location.toString().toQueryParams();
		 
		 var Cookie = {
			season: null,
			createCookie: function(name,value,days) {
			  if (days) {
			    var date = new Date();
			    date.setTime(date.getTime()+(days*24*60*60*1000));
			    var expires = "; expires="+date.toGMTString();
			  }
			  else expires = "";
			  document.cookie = name+"="+value+expires+"; path=/";
			},
			readCookie: function(name) {
			  var nameEQ = name + "=";
			  var ca = document.cookie.split(';');
			  for(var i=0;i < ca.length;i++) {
			    var c = ca[i];
			    while (c.charAt(0)==' ') c = c.substring(1,c.length);
			    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
			  }
			  return false;
			}
		}
		
		var Events = {
			add: function(obj,type,fn) {
			  if (obj.addEventListener){
			    obj.addEventListener(type, fn, false);
				return true;
			  }
			  else if (obj.attachEvent){
				var r = obj.attachEvent("on"+type, fn);
			    return r;
			  }
			  else {
				return false;
			  }
			},
			remove: function(obj,type,fn) {
			  if (obj.removeEventListener){
			    obj.removeEventListener(type, fn, false);
				return true;
			  }
			  else if (obj.detachEvent){
				var r = obj.detachEvent("on"+type, fn);
			    return r;
			  }
			  else {
				return false;
			  }	
			}
		};
		
		function popUp(url, width, height) {
			switch(url)
			{
			case "interactivemap":
				url = "/TheMountain/interactivemap/index.html";
				width = "755";
				height = "480";
			break;
			case "interactivetour":
				url = "/TheMountain/interactivemap/index.html";
				width = "755";
				height = "480";
			break;
			case "video":
				flv = width;
				url = "/popUpVideo/index.html?url=" + flv;
				width = "440";
				height = "365";
			break;
			case "golftour":
				url = "/Golf/golftour/index.html";
				width = "740";
				height = "530";
			break;
			case "golfscorecard":
				url = "/Golf/golfscorecard.html";
				width = "415";
				height = "610";
			break;
			case "slideshow":
				swf = width;
				url = "/TheMountain/MountainReport/SlideShows/" + swf;
				width = "640";
				height = "480";
			break;
			default:
			}		
			day = new Date();
			id = day.getTime();
			var winl = (screen.width - width) / 2;
			var wint = (screen.height - height) / 2;
			window.open(url,id,"toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+width+",height="+height+",left = "+winl+",top = "+wint);
		}
		
		function MM_openBrWindow(url,winName,features) {
			window.open(url,winName,features);
		}
		
		function getUrl(url) {
			window.location = url;
		}
		
		function jsPopUp (url,name,height,width) {
			newwindow=window.open(url,name,'height='+height+',width='+width);
			if (window.focus) {newwindow.focus()}
		}
		
		function trackForm(value) {
			trackas = '/googlesearch/' + value;
			urchinTracker(trackas);
		}
		
		var Detect = {
			Mac: function() {return !(navigator.appVersion.indexOf('Mac') == -1);},
			IE: function() {return !(navigator.appName.indexOf('Microsoft') == -1);},
			IE6: function() {return (this.IE() ? !(navigator.appVersion.indexOf('MSIE 6.0') == -1) : false);}
		}
		
		function season(season) {
			var newStyle = (season === "Summer") ? "/GlobalAssets/css/summer.css" : "/GlobalAssets/css/winter.css";
			document.write('<link rel="stylesheet" type="text/css" href="' + newStyle + '" title="season" />');
		}
		
		/* OLD VERSION -- BEFORE SAFARI ISSUES
		function season(season) {
			Stylesheet.setActiveStyleSheet(season);
		}*/

		// This CSS style switcher courtesy of Paul Snowden
		// adaptded from (http://www.alistapart.com/stories/alternate/)

		var Stylesheet = {
			setActiveStyleSheet: function(title) {
			  var i, a, main;
			  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
			    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
			      a.disabled = true;
			      if(a.getAttribute("title") == title) a.disabled = false;
			    }
			  }
			},
			getActiveStyleSheet: function() {
			  var i, a;
			  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
			    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
			  }
			  return null;
			},
			getPreferredStyleSheet: function() {
			  var i, a;
			  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
			    if(a.getAttribute("rel").indexOf("style") != -1
			       && a.getAttribute("rel").indexOf("alt") == -1
			       && a.getAttribute("title")
			       ) return a.getAttribute("title");
			  }
			  return null;
			}
		}

		//window.onload = function(e) {
		  var stylesheetCookie = Cookie.readCookie("stylesheet");
		  var stylesheetTitle = stylesheetCookie ? stylesheetCookie : Stylesheet.getPreferredStyleSheet();
		  Cookie.season = stylesheetTitle;
		  Stylesheet.setActiveStyleSheet(stylesheetTitle);
		//}

		window.onunload = function(e) {
		  var stylesheetCookie = Stylesheet.getActiveStyleSheet();
		  Cookie.createCookie("stylesheet", stylesheetCookie, 365);
		}
