document.write("<script type='text/javascript' src='/js/wips/jQuery/1.5.1/js/jquery-1.5.1.min.js'></script>");
document.write("<script type='text/javascript' src='/js/wips/jQuery/1.5.1/js/jquery-ui-1.8.14.custom.min.js'></script>");
document.write("<link rel='stylesheet' type='text/css' href='/js/wips/jQuery/1.5.1/css/custom-theme/jquery-ui-1.8.14.custom.css'>");
var wips = new function() {
	this.path = "/js/wips/";

	this.dependency = function(script) {
		if (script == "jQuery") {
			if (typeof $ == "undefined") {
				var errorMSG = "You have to add " + this.path + "jQuery/1.5.1/js/jquery-1.5.1.min.js, " + this.path + "jQuery/1.5.1/js/jquery-1.5.1.min.js and " + this.path + "jQuery/1.5.1/css/custom-theme/jquery-ui-1.8.14.custom.css";
				alert(errorMSG);
				throw errorMSG;
			}
		} else if (this[script] == undefined) {
			var errorMSG = "You have to add " + this.path + script + ".js";
			alert(errorMSG);
			throw errorMSG;
		}
	}

	this.loadScript = function (url, callback) {
		var head = document.getElementsByTagName("head")[0];
		var script = document.createElement("script");
		script.type = "text/javascript";
		script.src = url;
		if (callback) {
			script.onreadystatechange = callback;
			script.onload = callback
		}

		head.appendChild(script);
	}

	this.loadCSS = function (url) {
		var head = document.getElementsByTagName("head")[0];
		var css = document.createElement("link");
		css.rel = "stylesheet";
		css.type = "text/css";
		css.href = url;

		head.appendChild(css);
	}
}

