
 // Check for browser support of event handling capability
if (window.addEventListener) {
	window.addEventListener("load", dynamicLayout, false);
	window.addEventListener("resize", dynamicLayout, false);
} else if (window.attachEvent) {
	window.attachEvent("onload", dynamicLayout);
	window.attachEvent("onresize", dynamicLayout);
} else {
	window.onload = dynamicLayout;
	window.resize = dynamicLayout;
}
	 
function getBrowserWidth(){
	if (window.innerWidth){
		return window.innerWidth;}	
	else if (document.documentElement && document.documentElement.clientWidth != 0){
		return document.documentElement.clientWidth;	}
	else if (document.body){return document.body.clientWidth;}		
		return 0;
}

// dynamicLayout by Kevin Hale
function dynamicLayout(){
	var browserWidth = getBrowserWidth();

	//Load Thin CSS Rules
	if (browserWidth <= 1180){
		setActiveStyleSheet("wide");
	}
	
	//Load Wider CSS Rules
	if (browserWidth > 1180){
		setActiveStyleSheet("wider");
	}
}


// http://www.alistapart.com/articles/alternate/

 
function setActiveStyleSheet(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {

     if(a.getAttribute("rel").indexOf("alt") != -1 && a.getAttribute("title")) {
       a.disabled = true;
       if(a.getAttribute("title") == title) a.disabled = false;
     }

   }
}
 

