// getBrowserHeight is adapted from The Man in Blue Resolution Dependent Layout Script
// http://www.themaninblue.com/experiment/ResolutionLayout/
	function getBrowserHeight(){
		if (window.innerHeight){
			return window.innerHeight;}	
		else if (document.documentElement && document.documentElement.clientHeight != 0){
			return document.documentElement.clientHeight;	}
		else if (document.body){return document.body.clientHeight;}		
			return 0;
	}

// dynamicLayout adapted from Kevin Hale
//http://particletree.com/features/dynamic-resolution-dependent-layouts/
function dynamicLayout(){
	var browserHeight = getBrowserHeight();

	//Load Short CSS Rules
	if (browserHeight < 615){
		changeLayout("short");
	}
	//Load Tall CSS Rules
	if ((browserHeight >= 615) && (browserHeight <= 705)){
		changeLayout("tall");
	}
	//Load Taller CSS Rules
	if (browserHeight > 705){
		changeLayout("taller");
	}
}

// changeLayout is based on setActiveStyleSheet function by Paul Sowdon 
// http://www.alistapart.com/articles/alternate/
function changeLayout(description){
   var rows = document.getElementsByTagName('link');
   for(var i=0, row; row = rows[i]; i++){
	   if(row.getAttribute("title") == description){row.disabled = false;}
	   else if(row.getAttribute("title") != "default"){row.disabled = true;}
   }
}

	//addEvent() by John Resig
	function addEvent( obj, type, fn ){ 
	   if (obj.addEventListener){ 
	      obj.addEventListener( type, fn, false );
	   }
	   else if (obj.attachEvent){ 
	      obj["e"+type+fn] = fn; 
	      obj[type+fn] = function(){ obj["e"+type+fn]( window.event ); } 
	      obj.attachEvent( "on"+type, obj[type+fn] ); 
	   } 
	} 
	
	//Run dynamicLayout function when page loads and when it resizes.
	addEvent(window, 'load', dynamicLayout);
	addEvent(window, 'resize', dynamicLayout);