
/*
 * binds a object function to the context of the object
 * 'this' will point to the object
 */
function bind(fn, context) {
    if(fn instanceof Function) {
            return function() {
                    fn.apply(context, arguments);
            };
    }
}

function clone(obj) {
    var newobj = {};
    clone_attrs(obj, newobj);
    return newobj;
}

function clone_attrs(cloner, cloney) {
    for (i in cloner) {
        if (typeof cloner[i] == 'object' && !(cloner[i] instanceof Array) ) {
            clone_attrs(cloney[i],cloner[i]);
        } else {
            cloney[i] = cloner[i];
        }
    }
}

function ob(a) {
    var o = {};
    for(var i=0;i<a.length;i++) {
        o[a[i]]='';
    }
    return o;
}

/*
 * 	String class extentions
 */

String.prototype.entity_encode=function(){
	var str = this;
	str= str.replace(/\&/g,'&amp;');
	str= str.replace(/</g,'&lt;');
	return str;
};

String.prototype.entity_decode=function(boo){
	var str = this;
	str= str.replace(/\&amp;/g,'&');
	str= str.replace(/\&lt;/g,'<');
	return str;
};



/* Check IE */
function isIE() {
    return ( navigator.appName == "Microsoft Internet Explorer" );
}

UHS = new Object();
