



window.addEvent('load', function(){

		function externalLinks() {
			if (!document.getElementsByTagName) return;
			var anchors = document.getElementsByTagName("a");
			for (var i=0; i<anchors.length; i++) {
				var anchor = anchors[i];
				if (
					anchor.getAttribute("href") && ( 
					anchor.getAttribute("rel") == "external" || 
					anchor.getAttribute("rel") == "external nofollow" || 
					anchor.getAttribute("rel") == "nofollow external" )
					)
				anchor.target = "_blank";
			}
		}

		function getWindowHeight() {
			var windowHeight = 0;
			if (typeof(window.innerHeight) == 'container') {
				windowHeight = window.innerHeight;
			}
			else {
				if (document.documentElement && document.documentElement.clientHeight) {
					windowHeight = document.documentElement.clientHeight;
				}
				else {
					if (document.body && document.body.clientHeight) {
						windowHeight = document.body.clientHeight;
					}
				}
			}
			return windowHeight;
		}
		
		
		function setContent() {
			if (document.getElementById) 
			{
				var windowHeight = getWindowHeight();
				
					var headerMainHeight = 150;
					var headerSubHeight = 180;
					var headerHeight = headerMainHeight + headerSubHeight;
					
					var downloadContainer = $('downloadContainer');
					
					var subcontentContainer = document.getElementById('subContentContainer');
					var content = document.getElementById('content');
					
					var downloadContainerHeight = downloadContainer.offsetHeight;
					var subcontentContainerHeight = subcontentContainer.offsetHeight;
					var contentHeight =  content.offsetHeight;					
					
					if (downloadContainer.hasChild('downloadSection'))
					{
						var downloadSectionHeight = downloadContainer.getElement('div').offsetHeight;
					}
					else
					{

						 if (navigator.appName == "Microsoft Internet Explorer") 
						 {
							if (window.XMLHttpRequest)
							{						
								var downloadSectionHeight = 12;
							}
							else
							{
								var downloadSectionHeight = 20;	
							}
						 }
						 else if (window.devicePixelRatio)//Safari
						 {
							 var downloadSectionHeight = 5;
							 
						 }
						 else
						 {
							var downloadSectionHeight = 0;	 
						 }
					}

					
					if (windowHeight > (contentHeight+headerHeight + 20)) 
					{
						 subcontentContainer.style.height = ((windowHeight) - (headerHeight)) - 40 + 'px';
						 if (navigator.appName == "Microsoft Internet Explorer") 
						 {
							if (window.XMLHttpRequest) 
							{//IE7			
								content.style.height = ((windowHeight) - (headerHeight)) - 71 + 'px';
								downloadContainer.style.height = windowHeight - downloadContainerHeight - 159 + downloadSectionHeight - 11 + 'px';	
							}
							else
							{//IE6
								content.style.height = ((windowHeight) - (headerHeight)) - 71 + 'px';
								downloadContainer.style.height = windowHeight - downloadContainerHeight - 159 + downloadSectionHeight - 11 + 'px';									
							}
						 }
						 else if (window.devicePixelRatio)//Safari
						 {
							document.getElementById('nav_main').style.paddingTop = 22 + 'px';
							document.getElementById('nav_sub').style.paddingTop = 80 + 'px';
							
							downloadContainer.style.height = windowHeight - downloadContainerHeight - 170 + downloadSectionHeight  + 'px';
							content.style.height = ((windowHeight) - (headerHeight)) - 80  + "px";
							 
						 }									 
						 else
						 {//Others
							 content.style.height = ((windowHeight) - (headerHeight)) - 70 + 'px';
							 downloadContainer.style.height = windowHeight - downloadContainerHeight - 170 + downloadSectionHeight - 0 + 'px';
						 }
											
					}
					else
					{
						 if (navigator.appName == "Microsoft Internet Explorer") 
						 {
							if (window.XMLHttpRequest) 
							{//IE7								
							downloadContainer.style.height = contentHeight + "px";
							subcontentContainer.style.height = contentHeight + "px";
							content.style.height = contentHeight - 30 + "px";
							}
							else
							{
							downloadContainer.style.height = contentHeight + "px";
							subcontentContainer.style.height = contentHeight + "px";
							content.style.height = contentHeight - 30 + "px";
							}
						 }
						 else if (window.devicePixelRatio)//Safari
						 {
							downloadContainer.style.height = contentHeight + "px";
							subcontentContainer.style.height = contentHeight + "px";
							content.style.height = contentHeight - 40 + "px";
							document.getElementById('nav_main').style.paddingTop = 2.2 + 'em';
							document.getElementById('nav_sub').style.paddingTop = 8 + 'em';							
						 }
						 else
						 {
							downloadContainer.style.height = contentHeight + "px";
							subcontentContainer.style.height = contentHeight + "px";							 
						 } 
					}
			}
		}
		
		setContent();
		externalLinks();

		if($$('.mb').length > 0)//only triggered if 'mb' class found on page
		{
			var initMultiBox = new multiBox('mb', {
				descClassName: 'multiBoxDesc',//the class name of the description divs
				path: 'img/',//path to mp3 and flv players
				useOverlay: true,//use a semi-transparent background. default: false;
				maxWidth: 600,//max width (set to false to disable)
				maxHeight: 400,//max height (set to false to disable)
				addDownload: false,//do you want the files to be downloadable?
				pathToDownloadScript: './Scripts/forceDownload.asp',//if above is true, specify download script
				addRollover: false,//add rollover fade to each multibox link
				addOverlayIcon: false,//adds overlay icons to images within multibox links
				addChain: false,//cycle through all images fading them out then in
				recalcTop: true//subtract the height of controls panel from top position
			});
		};					

});



