browser_version = parseInt(navigator.appVersion); browser_type = navigator.appName; if (browser_type == "Microsoft Internet Explorer") { var ua = window.navigator.userAgent var msie = ua.indexOf("MSIE ") if (msie > 0) // If Internet Explorer, return version number browser_version = (ua.substring(msie + 5, ua.indexOf(".", msie))) } var style800 = "images/style800.css"; var style1024 = "images/style1024.css"; var styleWide = "images/styleWide.css"; var styleIE6 = "images/styleIE6.css"; function setStyle() { var width, height; if (window.innerWidth) { width = window.innerWidth; height = window.innerHeight; } else if (screen.availWidth) { width = screen.availWidth; height = screen.availHeight; } else if (document.documentElement.clientWidth) { width = document.documentElement.clientWidth; height = document.documentElement.clientHeight; } else if (document.body.clientWidth) { width = document.body.clientWidth; height = document.body.clientHeight; } var stylesheetLink = document.getElementById("stylesheetLink"); var useStyle800 = (width <= 800); var useStyleWide = (width > 1024); var useIE6 = (browser_type == "Microsoft Internet Explorer" && browser_version < 7); if (useStyle800) { stylesheetLink.setAttribute("href", style800); } if (useStyleWide) { stylesheetLink.setAttribute("href", styleWide); } if (useIE6) { var headID = document.getElementsByTagName("head")[0]; var cssNode = document.createElement('link'); cssNode.type = 'text/css'; cssNode.rel = 'stylesheet'; cssNode.href = 'images/styleIE6.css'; cssNode.media = 'screen'; headID.appendChild(cssNode); } return; } setStyle();