﻿// JScript File


String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}

var Utils = {
	sfHover: function() {
		var sfEls = document.getElementById("nav").getElementsByTagName("li");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" ieHover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" ieHover\\b"), "");
			}
		}
	}
}

// Load Functions
Event.observe(window, 'load', function() {
	Utils.sfHover();

	// Fix PNGs
	fixPNG();
});


/* Loading PNG Fix */
function fixPNG() {
	if (document.getElementById('logo_bogus'))
	{
		objMyImage1 = new OpacityObject('logo_bogus','/App_Themes/winter/images/logo');
		objMyImage1.setBackground();
	}
}

// Unload Functions
Event.observe(window, 'unload', function() {
});

// Old style popup functions
function openNewWindow(URLtoOpen, windowName, windowFeatures) {
	newWindow = window.open(URLtoOpen, windowName, windowFeatures);
}

function openPhotoPopup(img, w, h) {
	var url = "/detailphotopopup.aspx?img=" + img + "&w=" + w + "&h=" + h;
	openNewWindow(url, img, "resizable=yes,width=460,height=400");
}

function openSlideshow(album) {
	var url = "/slideshowpopup.aspx?h=225&w=575&album=" + album;
	openNewWindow(url, album, "resizable=yes,width=675,height=325");
}

function openVideo(video) {
	var url = "/assets/flv/videopopup.aspx?h=240&w=360&video=" + video;
	openNewWindow(url, video, "resizable=yes,width=480,height=340");
}

function openRegionalMap(region) {
	var url = "/mappopup.aspx?h=400&w=550&region=" + region;
	openNewWindow(url, region, "resizable=yes,width=650,height=500");
}