function sendScreenInfo()
{	
  var theWidth = getBrowserWidth();
  //alert(theWidth);
  if (theWidth < 850){
  	setActiveStyleSheet('Small Screen Layout');
  } else {
    setActiveStyleSheet('Default Layout');
  }
}
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;
};


// switch styles

function setActiveStyleSheet(title) {
  var i, a, main;
  for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if (a.getAttribute("rel") &&
        a.getAttribute("rel").indexOf("style") != -1 &&
        a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if (a.getAttribute("rel") &&
        a.getAttribute("rel").indexOf("style") != -1 &&
        a.getAttribute("title") &&
        !a.disabled
        ) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if (a.getAttribute("rel") &&
        a.getAttribute("rel").indexOf("style") != -1 &&
        a.getAttribute("rel").indexOf("alt") == -1 &&
        a.getAttribute("title")
        ) return a.getAttribute("title");
  }
  return null;
}
