function $(id) {
	return document.getElementById(id);
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function SetCookie(name,value){
    expires=new Date();
    expires.setTime(expires.getTime()+(86400*365));
    document.cookie=name+"="+value+"; expires="+expires.toGMTString()+"; path=/";
}
function getCookie(Name) {
   var search = Name + "="
   if (document.cookie.length > 0) {
      offset = document.cookie.indexOf(search) 
      if (offset != -1) {
         offset += search.length 
         end = document.cookie.indexOf(";", offset) 
         if (end == -1) 
            end = document.cookie.length
         return unescape(document.cookie.substring(offset, end))
      } 
   }
   return 0;
}

function appendToSelect(select, value, content) {
	var opt = document.createElement('option');
	opt.value = value;
	opt.text = content;
	select.options.add(opt);
}
