emptyFunc =  function () {};

function checkUA (str) {
	return (navigator.userAgent.indexOf(str) != -1);
}

Browser = {
	Opera:     checkUA('Opera'),
	Gecko:     checkUA('Gecko'),
	WebKit:    checkUA('WebKit/'),
	Konqueror: checkUA('Konqueror'),
	IE:        checkUA('MSIE'),
    IE6:       checkUA('MSIE 6'),
    IE7:       checkUA('MSIE 7'),
    IE8:       checkUA('MSIE 8')
};

function $ (id) {
	return document.getElementById(id);
}

function include(file) {
    var no_cache = (arguments.length > 1) ? '?' + Math.random() : ''; 	
    var script = window.document.createElement('script');
    script.setAttribute('src', file + no_cache);
    script.setAttribute('type', 'text/javascript');
    document.getElementsByTagName('head')[0].appendChild(script);
}

function loadStyle(file) {
	var no_cache = (arguments.length > 1) ? '?' + Math.random() : '';
	var css = window.document.createElement('link');
	css.setAttribute('href', file + no_cache);
	css.setAttribute('type', 'text/css');
	css.setAttribute('rel', 'stylesheet');
	document.getElementsByTagName('head')[0].appendChild(css);
}

/**
 *  Some browsers (IE) does not support JavaScript 1.6, and not support Array.indexOf of course.
 *  own function is indexOf equivalent. 
 */ 
Array.prototype.own = function(item) {
	for (var i = 0; i < this.length; i++) {
		if (this[i] == item) {
			return i;
		}
	}
	return false;
};

Array.prototype.addRange = function (from, to) {
	for (var i = from; i < to; i++) {
		this.push(i);
	}
};

String.prototype.trim = function () {
	return this.replace(/^\s+|\s+$/g, '');
}

String.prototype.ltrim = function () {
	return this.replace(/^\s+/, '');
}

String.prototype.rtrim = function () {
	return this.replace(/\s+$/, '');
}

isFunc = function (suspect) {
	return (typeof(suspect) == 'function');
}

isString = function (suspect) {
	return (typeof(suspect) == 'string');
}

isObject = function (suspect) {
	return (typeof(suspect) == 'object');
}

