window.addEvent('domready',function(){
	$$('.nojs').setStyle('display','none');
	$$('.jsenabled').removeClass('jsenabled');
	
	Browser.scanForPngs('content');
	$$('.fixPNG').each(function(png) {Browser.fixPNG(png);});

	
	//add open in new window function to anchors of class "open-new-win"
	$$('a.open-new-win').addEvents({
		'click':function(){
			window.open(this.href);
			return false;
		},
		'keypress':function(){
			window.open(this.href);
			return false;
		}
	});
});

window.addEvents({
	'domready':function(){
	
		//Page sliders for content managed areas
		var InlineSlides=new Sliders({
			button:'.slide-toggle',
			slideClass:'.slide',
			autoHide:true,
			openFirst:false,
			imageClass:'',
			hideText:'Read less...',
			showText:'Read more...',
			textClass:'.slide-toggle'
		});
	
		var viewportheight;		

		if (typeof window.innerWidth != 'undefined'){
			// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
			viewportheight = window.innerHeight;
		}else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0){				  
		// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
			viewportheight = document.documentElement.clientHeight;
		}else{
			viewportheight = document.getElementsByTagName('body')[0].clientHeight;
		}
		
		var size = $('page-container').getSize();
		if(size.y < viewportheight){
			var newHeight = viewportheight - 190;
			$('page-container').setStyles({
				'min-height':newHeight,
				'height':'auto !important',
				'height':newHeight
			});				
		}
	},
	'resize':function(){				
		var viewportheight;		

		if (typeof window.innerWidth != 'undefined'){
			// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
			viewportheight = window.innerHeight;
		}else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0){				  
		// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
			viewportheight = document.documentElement.clientHeight;
		}else{
			viewportheight = document.getElementsByTagName('body')[0].clientHeight;
		}
		
		var size = $('page-container').getSize();
		if(size.y < viewportheight){
			var newHeight = viewportheight - 190;
			$('page-container').setStyles({
				'min-height':newHeight,
				'height':'auto !important',
				'height':newHeight
			});				
		}
	}

});
