﻿function cXHR(func){
	var tmp = null;
	try{ tmp = new XMLHttpRequest();
	}catch(e){
		try{ tmp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{ tmp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e){ return null;}
		}
	}
	tmp.onreadystatechange = func;
	return tmp;
}

function addEvent(target, type, listener) {
    if(target.addEventListener) target.addEventListener(type, listener, false);
    else if(target.attachEvent) target.attachEvent('on' + type, function() { listener.call(target, window.event); });
    else target['on' + type] = function(e) { listener.call(target, e || window.event); };
}

function $(id){
	return document.getElementById(id);
}
