/***********************************************************************

Author:     4rn0
URL:        http://www.4rn0.nl/

***********************************************************************/


/* Initialize behaviour on page or DOM load
-------------------------------------------------------------------- */
if (document.addEventListener) { document.addEventListener('DOMContentLoaded',init,null); }
/*@cc_on @*/ /*@if (@_win32) document.write("<script defer src=init.js><"+"/script>"); /*@end @*/   
window.onload = init;

function init() {

	if (arguments.callee.done) {
		return;
	}
	
	arguments.callee.done = true;
	
	if (typeof(document.getElementById) == 'undefined') {
		document.getElementById = function(id) {
			return document.all[id];
		};
	}
	
	initSifr();
	initColumns();
	initElevator();

}

function initSifr() {
	
	if (typeof sIFR == 'function') {
		sIFR.replaceElement(named({sSelector:"div#secondaryContent h4#overview", sFlashSrc:"/wp-content/themes/jubile/swf/tokyo.swf", sColor:"#4e3a01",sWmode:"transparent"}));
		sIFR.replaceElement(named({sSelector:"div#secondaryContent h3", sFlashSrc:"/wp-content/themes/jubile/swf/tokyo.swf", sColor:"#4e3a01",sWmode:"transparent"}));
		sIFR.replaceElement(named({sSelector:"div#destinations h2", sFlashSrc:"/wp-content/themes/jubile/swf/tokyo.swf", sColor:"#4e3a01",sWmode:"transparent"}));
	}

}

function initColumns() {
	
	var content = document.getElementById('content');
	var destinations = document.getElementById('destinations');
	
	if (content && destinations) {
		
		if (content.offsetHeight < destinations.offsetHeight) {
			if (document.all) {
				content.style.height = destinations.offsetHeight + 'px'
			}
			else {
				content.style.minHeight = destinations.offsetHeight + 'px'
			}
		}
		
	}
	
}

function initElevator() {
	
	var elevator = document.getElementById('elevator');
	
	if (elevator) {
		
		window.onscroll = function() {
		
			var s = document.body.scrollTop || (document.documentElement && document.documentElement.scrollTop);

			if (s > 40) {
				elevator.className = 'fixed';
			}
			
			else {
				elevator.className = 'hidden';
			}
		}
		
	}
	
}