var activeStyle = 'hi-res';

function init() {
  rpvl();
  checkBrowserWidth();
  }


function checkBrowserWidth() {
  docheck = true;
  var agt = navigator.userAgent.toLowerCase();
    ismac = (agt.indexOf("mac")>-1);

if (docheck) {
  var theWidth = getBrowserWidth();
if (theWidth > 830) {
  if (activeStyle != 'hi-res') {
    setStylesheet("hi-res");
    activeStyle = 'hi-res';
    }
  }
else {
  if (activeStyle != 'lo-res') {
    setStylesheet("lo-res");
    activeStyle = 'lo-res';
    }
  }
    }
  }

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;
  }

function setStylesheet(styleTitle) {
  var currTag;
if (document.getElementsByTagName) {
  for (var i = 0; (currTag = document.getElementsByTagName("link")[i]); i++) {
    if (currTag.getAttribute("rel").indexOf("style") != -1 && currTag.getAttribute("title")) {
      currTag.disabled = true;
      if(currTag.getAttribute("title") == styleTitle) {
        defaultStatus = 'Style: ' + styleTitle;
        currTag.disabled = false;
        }
      }
    }
  }
  return true;
  }

function rpvl() {
  document.getElementById("contact").firstChild.nodeValue="design@elgo"+"rithms.com";
  document.getElementById("contact").setAttribute("href", "mailto:design@elgo"+"rithms.com");
  }

onload = init;
onresize = checkBrowserWidth;