// Fix the bad form tag at the start of the wrapper:
document.write("</form>");
document.write("<style> div#foot { margin-top: -40px; } div#footseal { display: none; } * html #page-head { background-image: none; background-color: #ffffff; } * html #wrapper { background-image: none; } div[style=\"height: 60px;\"], div[style=\"height: 10px;\"] { display: none; } </style>");
document.body.style.marginTop = "-16px";

// Try to fix the page now
try
{
	document.getElementsByTagName("h1")[0].getElementsByTagName("img")[0].src = "http://secure3.convio.net/humane/images/content/pagebuilder/19072.gif";
	document.getElementsByTagName("h1")[0].getElementsByTagName("img")[0].height = "91";
	document.getElementsByTagName("h1")[0].getElementsByTagName("img")[0].width = "216";
	document.getElementById("colrightsubtitle").innerHTML = "What will you do when Canada ends the hunt?";
}
catch (e) { }

// Just in case we couldn't, re-fix:
function fixFn()
{
	document.getElementsByTagName("h1")[0].getElementsByTagName("img")[0].src = "http://secure3.convio.net/humane/images/content/pagebuilder/19072.gif";
	document.getElementsByTagName("h1")[0].getElementsByTagName("img")[0].height = "91";
	document.getElementsByTagName("h1")[0].getElementsByTagName("img")[0].width = "216";
	document.getElementById("colrightsubtitle").innerHTML = "What will you do when Canada ends the hunt?";
}

if (window.attachEvent)
	window.attachEvent("onload", fixFn);  // IE 6+
else if (document.addEventListener)
	document.addEventListener("DOMContentLoaded", fixFn, false);  // Firefox 1.5+, Safari 3+, Chrome 1+, and Opera 9+

/**ws.js
 *
 * Watershed Common Functions
 * Copyright © 2010
 * Tom Giordano
 * Watershed Company
 * www.watershedcompany.com
 * 
 * Supported On:
 * IE 6+ (both Quirks and Standard Mode), Safari 2+, Opera 9+, Firefox 1.5+
 * Note: No rounded corners on Safari 2, Opera 9 - 10.10
 *
 */

var ws = {
	Version: 1.20100405
};

ws.Browser = {
	isIE: document.all && !window.opera,
	isCSS3IE: document.all && !window.opera && /Trident/i.test(navigator.userAgent) && !/Trident\/4\./i.test(navigator.userAgent),
	isOldIE: document.all && !window.opera && /MSIE [56]/.test(navigator.userAgent) && !/Trident/i.test(navigator.userAgent),
	isMobileSafari: /AppleWebKit\/.+Mobile\//.test(navigator.userAgent),
	isOldFirefox: /Firefox[\/\s][12]\./.test(navigator.userAgent),
	isLegacyMode: !/CSS/i.test(document.compatMode)
};

ws.Dialog = function()
{
	if (ws.Dialog.initialized)
		return;
	
	if (ws.Browser.isIE && !ws.Browser.isCSS3IE)
	{
		if (!document.namespaces.v)
			document.namespaces.add("v", "urn:schemas-microsoft-com:vml");
		
		var vmlCSS = document.createStyleSheet();
		vmlCSS.addRule("v\\:roundrect", "behavior: url(#default#VML)");
		vmlCSS.addRule("v\\:roundrect", "background-color: transparent !important");
		vmlCSS.addRule("v\\:roundrect", "border: none !important");
	}
	ws.Dialog.initialized = true;
};

ws.Dialog.prototype = {
	defaultBackgroundColor: "#003049",
	/*
	 * Function creates and populates a in-DOM popup dialog
	 */
	Show: function(msgTitle, msgInfo, msgButton, widthOfPopup, heightOfPopup)
	{
		this.widthOfPopup = widthOfPopup;
		this.heightOfPopup = heightOfPopup;
		
		// Setup inner content
		this.contentDiv = document.createElement("div");
		this.contentDiv.className = "ws_dialog_content";
		this.contentDiv.style.position = "relative";
		this.contentDiv.style.width = this.widthOfPopup + "px";
		this.contentDiv.style.height = this.heightOfPopup + "px";
		this.contentDiv.style.marginLeft = "auto";
		this.contentDiv.style.marginRight = "auto";
		
		var contentElm;
		if (ws.Browser.isIE && !ws.Browser.isCSS3IE)
		{
			// An added benefit to using VML is that the text won't look weird in fade-ins and outs on IE6!
			contentElm = document.createElement("v:roundrect");
			contentElm.arcsize = ".03";
			contentElm.fillcolor = "#464646";
			contentElm.strokecolor = "#ffffff";
			contentElm.strokeweight = "2px";
		}
		else
		{
			contentElm = document.createElement("div");
		}
		
		contentElm.style.width = this.widthOfPopup + "px";
		contentElm.style.height = this.heightOfPopup + "px";
		contentElm.style.fontFamily = "arial, helvetica, sans-serif";
		contentElm.style.fontSize = "14px";
		contentElm.style.display = "block";
		contentElm.style.width = this.widthOfPopup + "px";
		contentElm.style.height = this.heightOfPopup + "px";
		contentElm.style.backgroundColor = "#464646";
		contentElm.style.border = "2px solid #ffffff";
		contentElm.style.MozBorderRadius = "10px";
		contentElm.style.webkitBorderRadius = "10px";
		contentElm.style.borderRadius = "10px";
		contentElm.innerHTML = '<div style="padding: 30px 30px 20px 30px; text-align: left; color: #ffffff;"><span style="display: block; position: absolute;' + ((ws.Browser.isOldIE && !ws.Browser.isLegacyMode) ? ' ' : 'left: 0px; right: 0px; ') + 'bottom: 30px; width: 100%; cursor: pointer; text-decoration: underline; font-size: 115%; text-align: center;" class="ws_dialog_close_button">' + msgButton + '</span><strong style="display: block; text-align: center;">' + msgTitle + '</strong>' + msgInfo + '</div>';
		
		///if (ws.Browser.isIE)
		///	this.contentDiv.innerHTML = '<v:roundrect arcsize=".03" fillcolor="#464646" strokecolor="#ffffff" strokeweight="2px" style="font-family: arial, helvetica, sans-serif; font-size: 14px; display: block; width: 100%; height: 100%; background-color: #464646; border: 2px solid #ffffff; border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px;"><div style="padding: 30px 30px 20px 30px; text-align: left; color: #ffffff;"><span style="display: block; position: absolute;' + ((ws.Browser.isOldIE && !ws.Browser.isLegacyMode) ? ' ' : 'left: 0px; right: 0px; ') + 'bottom: 30px; width: 100%; cursor: pointer; text-decoration: underline; font-size: 115%; text-align: center;" class="ws_dialog_close_button">' + msgButton + '</span><strong style="display: block; text-align: center;">' + msgTitle + '</strong>' + msgInfo + '</div></v:roundrect>';
		///else  // But this way we can support Firefox 1.5 - 2
		///	this.contentDiv.innerHTML = '<div style="font-family: arial, helvetica, sans-serif; font-size: 14px; display: block; width: 100%; height: 100%; background-color: #464646; border: 2px solid #ffffff; border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px;"><div style="padding: 30px 30px 20px 30px; text-align: left; color: #ffffff;"><span style="display: block; position: absolute; left: 0px; right: 0px; bottom: 30px; width: 100%; cursor: pointer; text-decoration: underline; font-size: 115%; text-align: center;" class="ws_dialog_close_button">' + msgButton + '</span><strong style="display: block; text-align: center;">' + msgTitle + '</strong>' + msgInfo + '</div></div>';
		
		this.contentDiv.appendChild(contentElm);
		
		// Setup the close handler (note that the close button is in our first span, since message content and title follow it.)
		// Note that we have to store "this" so that we don't lose reference to it (so the hide function knows what to call)
		var thisDialog = this;
		this.contentDiv.getElementsByTagName("span")[0].onclick = function()
		{
			// If we wanted to add another function to be called, let's say it's in the 
			// parameter for the Show() function named fnOnCloseAlsoDo, we could call
			// it here like so:
			// fnOnCloseAlsoDo();
			thisDialog.Hide();
		};
		
		this._build();
	},
	ShowHTML: function(html, widthOfPopup, heightOfPopup)
	{
		this.widthOfPopup = widthOfPopup;
		this.heightOfPopup = heightOfPopup;
		
		var backgroundColor = this.defaultBackgroundColor;
		if (arguments.length == 4)
			backgroundColor = arguments[3];
		
		// Setup inner content
		this.contentDiv = document.createElement("div");
		this.contentDiv.className = "ws_dialog_content ws_dialog_custom_content";
		this.contentDiv.style.position = "relative";
		this.contentDiv.innerHTML = html;
		this.contentDiv.style.width = this.widthOfPopup + "px";
		this.contentDiv.style.height = this.heightOfPopup + "px";
		this.contentDiv.style.marginLeft = "auto";
		this.contentDiv.style.marginRight = "auto";
		
		var thisDialog = this;
		var contentDivSpans = this.contentDiv.getElementsByTagName("span");
		for (var i = 0; i < contentDivSpans.length; i++)
		{
			if (contentDivSpans[i].className == "ws_dialog_close_button")
			{
				contentDivSpans[i].onclick = function()
				{
					// If we wanted to add another function to be called, let's say it's in the 
					// parameter for the Show() function named fnOnCloseAlsoDo, we could call
					// it here like so:
					// fnOnCloseAlsoDo();
					thisDialog.Hide();
				};
			}
		}
		
		this._build(backgroundColor);
	},
	/*
	 * Function begins removal of an in-DOM popup dialog
	 */
	Hide: function()
	{
		 // Prevent hide function from being called twice (i.e. user double-clicks background)
		if (this.hideCalled)
			return;
		
		this.hideCalled = true;
		
		window.onresize = this._previousOnResize;
		
		// See if Fx library is loaded		
		if (typeof(Fx) == "object")
		{
			this.backgroundDiv.mooFx = new Fx.Style(this.backgroundDiv, 'opacity', {duration: 300});
			this.backgroundDiv.mooFx._start(0.5, 0.01);
			
			var thisDialog = this;
			this.popupDiv.mooFx = new Fx.Style(this.popupDiv, 'opacity', {duration: 300, onComplete: function()
			{
				// We would lose reference to the dialog during callback functions too, so store "this" in thisDialog
				thisDialog._hideComplete();
			}});
			this.popupDiv.mooFx._start(1.0, 0.01);
		}
		else
		{
			this._hideComplete();
		}
	},
	/*
	 * Function removes an in-DOM popup dialog
	 */
	_hideComplete: function()
	{
		this.backgroundDiv.parentNode.removeChild(this.backgroundDiv);
		this.popupDiv.parentNode.removeChild(this.popupDiv);
		if (ws.Browser.isOldIE && this.hiddenSelects)
		{
			for (var i = 0; i < this.hiddenSelects.length; i++)
				this.hiddenSelects[i].style.visibility = "visible";
		}
		if (ws.Browser.isLegacyMode && ws.Browser.isIE)
		{
			document.body.scroll = "yes"; // Re-enable scrolling in IE
			document.body.style.marginRight = (parseInt(document.body.currentStyle.marginRight) - this.scrollBarSize) + "px";
		}
	},
	_sizeDialog: function()
	{
		var marginOffset = 0;
		
		if (ws.Browser.isMobileSafari)
		{
			this.backgroundDiv.style.width = document.body.clientWidth + "px";
			this.backgroundDiv.style.height = document.body.clientHeight + "px";
			// We have to factor in scroll offset on Mobile Safari since there is no CSS fixed positioning
			marginOffset = ((window.innerHeight - this.heightOfPopup) / 2) + window.pageYOffset;
		}
		else if (ws.Browser.isLegacyMode && ws.Browser.isIE)
		{
			this.backgroundDiv.style.height = document.body.clientHeight + "px";
			this.backgroundDiv.style.width = document.body.clientWidth + "px";
			marginOffset = ((document.body.clientHeight - this.heightOfPopup) / 2) + document.body.scrollTop;
		}
		else if (ws.Browser.isOldIE)
		{
			// We have to factor in scroll offset on old IE since there is no CSS fixed positioning
			marginOffset = ((document.documentElement.clientHeight - this.heightOfPopup) / 2) + document.documentElement.scrollTop;
			
			// Include page margins on Old IE:
			this.backgroundDiv.style.width = document.body.clientWidth + parseInt(document.body.currentStyle.marginLeft) + parseInt(document.body.currentStyle.marginRight) + "px";

			// If page content is shorter than browser height, use browser height:
			var backgroundHeight;
			if (document.body.clientHeight < document.documentElement.clientHeight)
				backgroundHeight = document.documentElement.clientHeight;
			else
				backgroundHeight = document.body.clientHeight + parseInt(document.body.currentStyle.marginTop) + parseInt(document.body.currentStyle.marginBottom);
			
			if ((this.heightOfPopup + marginOffset) > backgroundHeight)
				backgroundHeight = this.heightOfPopup + marginOffset;
			
			this.backgroundDiv.style.height = backgroundHeight + "px";
		}
		else if (ws.Browser.isIE)
		{
			marginOffset = ((document.documentElement.clientHeight - this.heightOfPopup) / 2);
		}
		else
		{
			marginOffset = ((window.innerHeight - this.heightOfPopup) / 2);
		}
		
		if (marginOffset < 0)
			marginOffset = 0;
						
		this.popupDiv.style.marginTop = marginOffset + "px";
	},
	/*
	 * Function builds the elements for an in-DOM popup dialog
	 * Pass an html color as a string to change the default background color
	 */
	_build: function()
	{
		var backgroundColor = this.defaultBackgroundColor;
		if (arguments.length == 3)
			backgroundColor = arguments[2];
		
		// Create a translucent background div to go behind popup div
		this.backgroundDiv = document.createElement("div");
		this.backgroundDiv.style.top = "0px";
		this.backgroundDiv.style.right = "0px";
		this.backgroundDiv.style.bottom = "0px";
		this.backgroundDiv.style.left = "0px";
		this.backgroundDiv.style.backgroundColor = backgroundColor;
		this.backgroundDiv.style.opacity = "0.01";
		this.backgroundDiv.style.filter = "alpha(opacity=1)";
		this.backgroundDiv.style.zIndex = "10";  // Make sure it is above other elements
		this.backgroundDiv.className = "ws_dialog_background";
		
		var thisDialog = this;
		this.backgroundDiv.onclick = function()
		{
			thisDialog.Hide();
		};
		
		// Create the popup div
		this.popupDiv = document.createElement("div");
		this.popupDiv.style.marginLeft = "auto";
		this.popupDiv.style.marginRight = "auto";
		this.popupDiv.style.textAlign = "center";
		this.popupDiv.style.top = "0px";
		this.popupDiv.style.right = "0px";
		this.popupDiv.style.bottom = "0px";
		this.popupDiv.style.left = "0px";
		this.popupDiv.style.zIndex = "20"; // Make sure it is above background
		this.popupDiv.className = "ws_dialog_popup";
		this.popupDiv.style.opacity = "0.01";
		this.popupDiv.style.filter = "alpha(opacity=1)";
					
		// Perform some browser-specific things:
		if (ws.Browser.isOldIE || (ws.Browser.isLegacyMode && ws.Browser.isIE) || ws.Browser.isMobileSafari)
		{
			this.backgroundDiv.style.position = "absolute";
			this.popupDiv.style.position = "absolute";
			this.popupDiv.style.width = "100%"; // We don't need to set a height for this, since we compute a top margin
			
			if (ws.Browser.isOldIE)
			{
				// Need to hide all the SELECT elements in the DOM, since IE6 has a Z-order bug:
				this.hiddenSelects = Array();
				var selectsToHide = document.getElementsByTagName("select");
				for (var i = 0; i < selectsToHide.length; i++)
				{
					if (selectsToHide[i].style.visibility.toLowerCase() != "hidden")
					{
						selectsToHide[i].style.visibility = "hidden";
						this.hiddenSelects.push(selectsToHide[i]);
					}	
				}
			}
			
			if ((ws.Browser.isLegacyMode && ws.Browser.isIE))
			{
				var sizeWithScrollBar = document.body.clientWidth;
				window.scroll(0, 0);
				document.body.scroll = "no";
				this.scrollBarSize = document.body.clientWidth - sizeWithScrollBar;  // Compute scroll bar width
				// Adjust margin to compensate for change
				document.body.style.marginRight = (parseInt(document.body.currentStyle.marginRight) + this.scrollBarSize) + "px";
			}
		}
		else
		{
			// Set top margin so that image displays centered, unless window is too short
			this.backgroundDiv.style.position = "fixed";
			this.popupDiv.style.position = "fixed";
		}
		
		this._sizeDialog();  // Size and position the dialog
		
		// Setup window onresize event to handle popup position and background size on browser size change:
		if (typeof(window.onresize) == "function")
			this._previousOnResize = window.onresize;
		if (typeof(window.onscroll) == "function")
			this._previousOnScroll = window.onscroll;
		window.onresize = function()
		{
			thisDialog._previousOnResize();
			thisDialog._sizeDialog();
		};
		window.onscroll = window.onresize;
		
		document.body.appendChild(this.backgroundDiv);
		this.popupDiv.appendChild(this.contentDiv);
		document.body.appendChild(this.popupDiv);
		
		// See if Fx library is loaded:
		if (typeof(Fx) == "object")
		{
			this.backgroundDiv.mooFx = new Fx.Style(this.backgroundDiv, 'opacity', {duration: 750});
			this.backgroundDiv.mooFx._start(0.01, 0.5);
			this.popupDiv.mooFx = new Fx.Style(this.popupDiv, 'opacity', {duration: 500});
			this.popupDiv.mooFx._start(0.01, 1.0);
		}
		else
		{
			this.backgroundDiv.style.opacity = "0.5";
			this.backgroundDiv.style.filter = "alpha(opacity=50)";
			this.popupDiv.style.opacity = "1";
			this.popupDiv.style.filter = "alpha(opacity=100)";
		}
	},
	_previousOnResize: function() { },
	_previousOnScroll: function() { }
};

/* EOF */