jQuery(document).ready(function() {	
	// H1 Replace
	$('.default h1 strong').flash(
		{ 
			src: 'interface/flash/helvetica-neue-condensed.swf',  
			flashvars: { 
				css: [
					'* { color: #ffffff; }',
					'a { color: #ffffff; text-decoration: none; }',
					'a:hover { text-decoration: underline; }'
				].join(' ')
			},
			wmode: "transparent"
		},
		{ version: 7 },
		function(htmlOptions) {
			htmlOptions.flashvars.txt = this.innerHTML;
			this.innerHTML = '<span>'+this.innerHTML+'</span>';
			var $alt = $(this.firstChild);
			htmlOptions.height = $alt.height();
			htmlOptions.width = $alt.width();
			$alt.addClass('alt');
			$(this)
				.addClass('flash-replaced')
				.prepend($.fn.flash.transform(htmlOptions));						
		}
	);
	// H2 backpages
	$('.default .screen h2').flash(
		{ 
			src: 'interface/flash/helvetica-neue-condensed.swf',  
			flashvars: { 
				css: [
					'* { color: #e14826; }',
					'a { color: #e14826; text-decoration: none; }',
					'a:hover { text-decoration: underline; }'
				].join(' ')
			},
			wmode: "transparent"
		},
		{ version: 7 },
		function(htmlOptions) {
			htmlOptions.flashvars.txt = this.innerHTML;
			this.innerHTML = '<span>'+this.innerHTML+'</span>';
			var $alt = $(this.firstChild);
			htmlOptions.height = $alt.height();
			htmlOptions.width = $alt.width();
			$alt.addClass('alt');
			$(this)
				.addClass('flash-replaced')
				.prepend($.fn.flash.transform(htmlOptions));						
		}
	);
	// H2 Homepage
	$('.home .content h2 strong').flash(
		{ 
			src: 'interface/flash/helvetica-neue-condensed.swf',  
			flashvars: { 
				css: [
					'* { color: #ffffff; }',
					'a { color: #ffffff; text-decoration: none; }',
					'a:hover { text-decoration: underline; }'
				].join(' ')
			},
			wmode: "transparent"
		},
		{ version: 7 },
		function(htmlOptions) {
			htmlOptions.flashvars.txt = this.innerHTML;
			this.innerHTML = '<span>'+this.innerHTML+'</span>';
			var $alt = $(this.firstChild);
			htmlOptions.height = $alt.height();
			htmlOptions.width = $alt.width();
			$alt.addClass('alt');
			$(this)
				.addClass('flash-replaced')
				.prepend($.fn.flash.transform(htmlOptions));						
		}
	);
	
	
	// Flash
	$("#mainFeature").flash({
	    src: 'interface/flash/main-feature.swf',
	    width: 651,
	    height: 240
	},
	{
		expressInstall: true,
		version: '9'
	});	
	
	// Cycles
	//var browserFX = ($.browser.msie && $.browser.version<7 ? 'scrollVert' : 'fade');
	var browserFX = ($.browser.msie ? 'scrollVert' : 'fade');
	$("#cycleFeature").cycle({ 
		fx:     browserFX, 
	    speed:   200, 
	    timeout: 4000, 
	    pause:   1, 
        next:   '#next',
        prev:   '#prev'
	});
    $('#playpause').click(function() { $('#cycleFeature').cycle('pause'); return false; });
	$("#newsCycle").cycle({ 
		fx:     browserFX, 
	    speed:   200, 
	    timeout: 4800, 
	    pause:   1, 
        next:   '#newsCycleNext',
        prev:   '#newsCyclePrev'
	});
    $('#newsCyclePlaypause').click(function() { $('#newsCycle').cycle('pause'); return false; });
		
	// Form Validation	
	if($(".validate").length==1) {
		formRef = $(".validate");
		formRef.prepend('<div id="validationErrorContainer"><ol style="display: none;"></ol></div>');
		containerRef = $("#validationErrorContainer");
		formRef.validate({
			errorLabelContainer: containerRef,
			errorLabelContainer: $("ol", containerRef),
			wrapper: 'li'
		});
	}
});

function printPage() {
	if (window.print) {
		window.print() ;
	} else {
		var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
		document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
		WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = "";
	}
}