User:Alexav8/util.js

topaz.util = {

getobj:function(id) {

return document.getElementById ?

document.getElementById(id) :

document.all[id];

},

add:function(parent, tag, attr) {

var el = document.createElement(tag);

if (attr) {

for (key in attr) {

el[key] = attr[key];

}

}

return parent.appendChild(el);

},

mousebtnmap:{

ns:[null,1,3,2],

ie:[null,1,2,null,3]

},

xmlhttpreq:function() {

if (window.XMLHttpRequest) {

xmlhttpobj = new XMLHttpRequest()

} else {

try {

xmlhttpobj = new ActiveXObject("Msxml2.XMLHTTP");

} catch (e) {

try {

xmlhttpobj = new ActiveXObject("Microsoft.XMLHTTP");

} catch (e) {

xmlhttpobj = null;

}

}

}

return xmlhttpobj;

}

};