/*
Javascript File for Switching Style Sheets within the Yaletown Theme for Wordpress.
*/
function getBrowserWidth() {
	if (screen.width)
		var iWidth = screen.width;
	else
		var iWidth = 800;
	
	if (window.innerHeight) { // All but Explorer
		iWidth = window.innerWidth; 
	} else if (document.documentElement && document.documentElement.clientWidth) { // Explorer 6 Strict Mode 
		iWidth = document.documentElement.clientWidth; 
	} else if (document.body && document.body.clientWidth) { // other Explorers
		iWidth = document.body.clientWidth; 
	}
	return iWidth;
}
function setActiveStyleSheet() {
	var i, oElement, sTitle;

	sTitle = "default";
	if(getBrowserWidth()>1024) {
		sTitle = "wide";
	}
//alert(sTitle); //Debug Code
	for(i=0; (oElement = document.getElementsByTagName("link")[i]); i++) {
		if(oElement.getAttribute("rel").indexOf("style") != -1 && oElement.getAttribute("title")) {
			oElement.disabled = true;
			if(oElement.getAttribute("title") == sTitle)
				oElement.disabled = false;
		}
	}
}
function init() {
	//alert("Page Loaded");
	setActiveStyleSheet();
	window.onresize = setActiveStyleSheet;
}
//window.onresize = setActiveStyleSheet;