function setHeader() { return; /* Used in random places, deprecated, this just keeps things tame */ }

var webs = {

    // We now search for jQuery's document.ready availability, as it conflicts with the old loadEvent in high use situations.
    loadEvent: function(func) {
		if(typeof jQuery != "undefined") jQuery(document).ready(function() { func(); });
		else webs.fallback_loadEvent(function() { func(); });
	},

	fallback_loadEvent: (function() {
        var load_events = [], load_timer, script, done, exec, old_onload,
			
	    init = function () {
            done = true;
		    clearInterval(load_timer);
            for(i = 0; i < load_events.length; i++) {
		        exec = load_events.shift(); 
                exec();
		    }
            if(script) script.onreadystatechange = '';
	    };
		
	    return function(func) {
	        if(done) return func();
		
            if(!load_events[0]) {
		        if(document.addEventListener) document.addEventListener("DOMContentLoaded", init, false);
		
				/*@cc_on @*/ /*@if (@_win32) // Fairly obvious who this is for...
				    document.write("<script id=__ie_onload defer src=//0><\/scr"+"ipt>");
					script = document.getElementById("__ie_onload");
					script.onreadystatechange = function() {
					    if (this.readyState == "complete") init(); // call the onload handler
					};
				/*@end @*/
		
				if(/WebKit/i.test(navigator.userAgent)) {
				    load_timer = setInterval(function() {
					    if (/loaded|complete/.test(document.readyState)) init(); 
					}, 10);
				}
		
				old_onload = window.onload;
				window.onload = function() {
				    init();
					if (old_onload) old_onload();
				};
			}
			load_events.push(func);
		}
	})(),

    appendInputTypeClasses: function() { /* Used in Domains and a few other places - need to deprecate eventually, leave it here for now -- Ryan */
        var inputs = document.getElementsByTagName('input');
        for(i = 0; i < inputs.length; i++) {
            if(inputs[1].getAttribute('type')) inputs[i].className = inputs[i].getAttribute('type');
        }
    },

    staticServer : 'http://images.freewebs.com', /* This is reset in real time when the page loads */

	addEvent: function(element, evt, fn, bubble) {
		if(document.addEventListener) element.addEventListener(evt, fn, bubble);
		else element.attachEvent("on" + evt, fn);
	},

	removeEvent: function(element, evt, fn, bubble) {
		if(document.removeEventListener) element.removeEventListener(evt, fn, bubble);
		else element.detachEvent("on" + evt, fn);
	}
}

var multisite_dropdown = {
	dropdown: "",
	droplist: "",

	open: function() {
		multisite_dropdown.droplist.style.display = "block";
		webs.removeEvent(multisite_dropdown.dropdown, "click", multisite_dropdown.open, false);
		webs.addEvent(document.body, "mouseup", multisite_dropdown.close, false);
	},

	close: function() {
		multisite_dropdown.droplist.style.display = "none";
		webs.removeEvent(document.body, "mouseup", multisite_dropdown.close, false);
		setTimeout(function() { webs.addEvent(multisite_dropdown.dropdown, "click", multisite_dropdown.open, false); }, "500");
	}
}

webs.loadEvent(function() { 
	/* Stuff for the multi-site dropdown - shouldn't be a huge performance hit anywhere else since it's checking by ID first */	
	if(document.getElementById("multisite_dropdown") != null) {
		multisite_dropdown.droplist = document.getElementById("multisite_dropdown_choices");
		multisite_dropdown.dropdown = document.getElementById("multisite_dropdown");
		webs.addEvent(multisite_dropdown.dropdown, "click", multisite_dropdown.open, false);
	}
});
