UniversatileScriptManager=new function(){var g=this;var h=[];this.createNamespace=function(a){var b=a.split('.');var c='window';for(var i=0;i<b.length;i++){c+='.'+b[i];if(eval('!('+c+') || (typeof('+c+') != "object")')){eval(c+' = {}')}}};this.finishInclude=function(a){for(var i=0;i<h.length;i++){if(h[i].url==a){var b=h[i].scriptAfter;b.parentNode.removeChild(b);var c=h[i].callback;h.splice(i,1);if(typeof c=="function"){c()}}}};this.isScriptLoaded=function(a){var b=document.getElementsByTagName('script');for(var i=0;i<b.length;i++){if(b[i].getAttribute('src')==a){return true}}};this.includeScript=function(a,b){if(g.isScriptLoaded(a)){return}var c=document.getElementsByTagName('head')[0];var d=document.createElement('script');d.setAttribute('type','text/javascript');d.setAttribute('src',a);c.appendChild(d);var e=document.createElement('script');e.setAttribute('type','text/javascript');h.push({url:a,callback:b,scriptAfter:e});var f=document.createTextNode('UniversatileScriptManager.finishInclude("'+a+'");');e.appendChild(f);c.appendChild(e)};window.include=this.includeScript}();

UniversatileScriptManager.createNamespace('Universatile.Software.Countdowns');
with (Universatile.Software) {

Universatile.Software.Countdowns.WidowsMightRelease = {
	distributionCode: '<script type="text/javascript" src="http://countdown.schoolsareforfish.net/widows-might-release"></script>',

	setup: function() {
		with (Universatile.Software) {
			CountdownRunner.updateInterval = 1000;
			Countdown('widowsmightrelease', '10/1/2009', '<span style="display: block; height: 14px"></span>%?(%d>0){<b>%d day%?(%d!=1){s}</b>,<br>}<b>%h hour%?(%h!=1){s}</b>,<br><b>%m minute%?(%m!=1){s}</b>,<br>and <b>%s second%?(%s!=1){s}</b> left!', '<span style="font-size:30pt"><b>Now Available!</b></span>');
		}
		
		var head = document.getElementsByTagName('head')[0];
		
		var cdElement = document.createElement('div');
		cdElement.setAttribute('style', 'margin: auto; width: 230px; padding: 4px 0px; text-align: center');
	
		cdElement.innerHTML = '\
			<a href="http://www.godhonoringmovies.com/ghm/?p=2068" style="text-decoration: none; color: white; background: transparent; padding: 0">\
				<span style="display: block; background: url(http://www.godhonoringmovies.com/ghm/wp-content/uploads/2009/09/dvdcdbg.gif); width: 230px; height: 300px; margin-bottom: -3px; color: white">\
					<span style="display: block; color: white; top: 136px; position: relative; text-align: center; vertical-align: middle; font: 12pt Georgia" class="countdown_widowsmightrelease">&nbsp;	</span>\
				</span>\
			</a>\
			<a href="javascript:Universatile.Software.Countdowns.WidowsMightRelease.grabCode();" style="font-size: 9px; font-family: Tahoma, Arial, sans-serif">&#x2191; Grab this countdown!</a>';
		
		var scripts = document.getElementsByTagName('script');
		
		for (var i = 0; i < scripts.length; i ++) {
			var src = scripts[i].getAttribute('src');
			if (src && !scripts[i].countdownInitialized && ((src.indexOf('widowsmightrelease') > -1) || (src.indexOf('widows-might-release') > -1) || (src.indexOf('widows_might_release') > -1)) && (src.indexOf('countdown') > -1) && (src.indexOf('schoolsareforfish.net') > -1)) {
				scripts[i].countdownInitialized = true;
				scripts[i].parentNode.insertBefore(cdElement.cloneNode(true), scripts[i]);
			}
		}
	},

	grabCode: function() {
		var grabCodePopup = document.getElementById('WidowsMightReleaseCountdownGrabber')
		
		if (grabCodePopup) {
			grabCodePopup.style.display = "none";
			grabCodePopup.parentNode.removeChild(grabCodePopup);
		} else {
			grabCodePopup = document.createElement('div');
			grabCodePopup.setAttribute('style', 'position: fixed; margin: auto; text-align: center; z-index: 100000');
			grabCodePopup.setAttribute('id', 'WidowsMightReleaseCountdownGrabber');

			escapedCode = this.distributionCode.replace(/</g, '&lt;').replace(/>/g, '&gt;');

			grabCodePopup.innerHTML = '\
				<div style="font: 12pt Georgia; margin: auto; background: #ECE9D8; border: 2px outset #ECE9D8; padding: 5px 6px 2px 6px; white-space: nowrap; text-align: center">\
					Copy this code to your website or blog.\
					' + ((window.clipboardData && window.clipboardData.setData) ? ' &nbsp;<input type="button" value="Copy" onclick="Universatile.Software.Countdowns.WidowsMightRelease.copyCode();"/>' : '') + ' \
					&nbsp;<input type="button" value="Close" onclick="Universatile.Software.Countdowns.WidowsMightRelease.closeGrabber();" style="position: absolute; right: 6px; margin-top: -2px"/>\
					<div id="WidowsMightReleaseCountdownCode" style="clear: both; font: 10pt monospace; background: Window; color: WindowText; border: 1px inset #ECE9D8; white-space: nowrap; margin: 8px 0 2px 0; padding: 1px 3px" onmouseup="Universatile.Software.Countdowns.WidowsMightRelease.selectAllCode();" onclick="Universatile.Software.Countdowns.WidowsMightRelease.selectAllCode();" onmousedown="Universatile.Software.Countdowns.WidowsMightRelease.selectAllCode();">' + escapedCode + '</div>\
				</div>';

			var centeringContainer = document.createElement('div');
			centeringContainer.setAttribute('style', 'position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: black; opacity: .75; filter: alpha(opacity = 75); z-index: 10000');
			centeringContainer.setAttribute('id', 'WidowsMightReleaseCountdownGrabberBackground');

			var body = document.getElementsByTagName('body')[0];
			body.appendChild(grabCodePopup);
			body.appendChild(centeringContainer);
			
			function centerPopup() {
				var grabCodePopup = document.getElementById('WidowsMightReleaseCountdownGrabber'), size = pageSize();
				grabCodePopup.style.left = ((size.width - grabCodePopup.offsetWidth) / 2) + "px";
				grabCodePopup.style.top = ((size.height - grabCodePopup.offsetHeight) / 2) + "px";
			}

			centerPopup();
			this.selectAllCode();
			addEventHandler(window, 'resize', centerPopup, false);
		}
	},
	
	closeGrabber: function() {
		var grabCodePopup = document.getElementById('WidowsMightReleaseCountdownGrabber');
		
		if (grabCodePopup) {
			grabCodePopup.style.display = "none";
			grabCodePopup.parentNode.removeChild(grabCodePopup);
		}
		
		var grabCodePopupBackground = document.getElementById('WidowsMightReleaseCountdownGrabberBackground');
		
		if (grabCodePopupBackground) {
			grabCodePopupBackground.style.display = "none";
			grabCodePopupBackground.parentNode.removeChild(grabCodePopupBackground);
		}
	},
	
	copyCode: function() {copyToClipboard(this.distributionCode);},
	selectAllCode: function() {selectAll('WidowsMightReleaseCountdownCode');}
}

include("http://www.schoolsareforfish.net/universatile.software.js");
include("http://countdown.schoolsareforfish.net/engine/universatilecountdown1.3.js", Universatile.Software.Countdowns.WidowsMightRelease.setup);
}
