// general functions
function addLoadEvent(func) {	
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function switchStyleSheet() {
	var obj = document.getElementById('cssHiRes');
	if(getWindowWidth()>960){
		obj.disabled = false;}
	else{
		obj.disabled = true;}
}

function getWindowWidth() {
	// Default to screen dimensions.
	var winW = window.screen.width;
	
	// Attempt to retrieve browser window dimensions.
	if (window.innerWidth)
		winW = window.innerWidth;
	else {
		if(document.documentElement.offsetWidth)
			winW = document.documentElement.offsetWidth;
		else if (document.body.offsetWidth)
			winW = document.body.offsetWidth;
		}
		return winW;
}

function getElementByClass(classname){ 
     var messages=new Array();
     var inc=0; 
     var alltags=document.all? document.all : document.getElementsByTagName("*"); 

     for (i=0; i<alltags.length; i++){ 
       if (alltags[i].className==classname) 
         messages[inc++]=alltags[i]; 
     }
     if(messages != null){return messages;}
     else {return null;}
} 

// load and attach events
switchStyleSheet();
window.onresize = switchStyleSheet;




