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

gnarleyCode = {
        debug : function(text){
                try{
			console.log(text);
		} catch(e){
		}
        },

        printObjectProperties : function(obj){ //alerts out properties of an object
                var output = "";
                for (var prop in obj) {
                        output += prop + " = " + obj[prop] + "\n" ;
                }
                //alert(output);
                console.log("gnarleyCode:|" + output + "|");
                //Usage: gnarleyCode.printObjectProperties(document.images["myImage"]);
        },

        instrumentExternalLinks : function(){ //Sets all anchor tags with rel=external to open a new window (as per the HTML [1] 4.0 Strict spec)
		if (!document.getElementsByTagName) return; 
		var anchors = document.getElementsByTagName("a"); 
		for (var i=0; i<anchors.length; i++) { 
			var anchor = anchors[i]; 
			if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
				anchor.target = "_blank"; 
			}
		} 
        },

        updateCSS : function(theClass,element,value) { //changes a property of a css class
                var cssRules;
                if (document.all) {
                        cssRules = 'rules';
                } else if (document.getElementById) {
                        cssRules = 'cssRules';
                }
                for (var S = 0; S < document.styleSheets.length; S++){
                        for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
                                if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
                                        document.styleSheets[S][cssRules][R].style[element] = value;
                                }
                        }
                }
                //Usage: gnarleyCode.updateCSS('.listViewHeader','backgroundColor','green');
        }
}


