/*
*
*  layoutFix 1.0
*  
*  author		: Branimir Sloser - info@emusoft.org
*  inspired by	: Vjekoslav Begović - http://www.vjekoslav.info/col3.htm
*  DomLoaded by : Rob Cherny - http://www.cherny.com/demos/onload/domloaded.js
*
*/

var layoutFix = {
	
	leftElem: 	"navigation",
	rightElem: 	"content",	
	
	left: 	function(){return document.getElementById(layoutFix.leftElem)},
	right: 	function(){return document.getElementById(layoutFix.rightElem)},	
	
	init: function(){
		
		if (typeof layoutFix.left().style.height == 'number'){
			bigest = layoutFix.maximum(parseInt(layoutFix.left().style.height),parseInt(layoutFix.right().style.height));
		}
		else if (typeof layoutFix.left().offsetHeight != "undefined"){
			bigest = layoutFix.maximum(layoutFix.left().offsetHeight,layoutFix.right().offsetHeight);
		}
		else return;
		
		layoutFix.left().style.height	= bigest+'px';
		layoutFix.right().style.height	= bigest+'px';
		
	},
	
	maximum: function(){	
		var first_one=arguments[0];
		var second_one=arguments[1];
		
		if(first_one < second_one) maximum = second_one;
		else maximum = first_one;
				
	return maximum;
	}	
	
}

var DomLoaded = {
	onload: [],
	loaded: function() {
		if (arguments.callee.done) return;
		arguments.callee.done = true;
		for (i = 0;i < DomLoaded.onload.length;i++) DomLoaded.onload[i]();
	},
	load: function(fireThis) {
		this.onload.push(fireThis);
		if (document.addEventListener) document.addEventListener("DOMContentLoaded", DomLoaded.loaded, null);
		if (/KHTML|WebKit/i.test(navigator.userAgent)) { 
			var _timer = setInterval(function() {
				if (/loaded|complete/.test(document.readyState)) {
					clearInterval(_timer);
					delete _timer;
					DomLoaded.loaded();
				}
			}, 10);
		}
		/*@cc_on @*/
		/*@if (@_win32)
		var proto = "src='javascript:void(0)'";
		if (location.protocol == "https:") proto = "src=//0"; document.write("<scr"+"ipt id=__ie_onload defer " + proto + "><\/scr"+"ipt>");
		var script = document.getElementById("__ie_onload");
		script.onreadystatechange = function() {
		    if (this.readyState == "complete") {
		        DomLoaded.loaded();
		    }
		};
		/*@end @*/
	   window.onload = DomLoaded.loaded;
	}
};

window.onload = function() {
	layoutFix.init()
};

window.onresize = function(){
		var left=document.getElementById(layoutFix.leftElem);
		var right=document.getElementById(layoutFix.rightElem);		
		if (typeof left.style.height != "undefined"){
			left.style.height='auto';
			right.style.height='auto';			
			layoutFix.init();
		}
}