js = function() {
	this.librarypath = '';
	this.packages = [];
	this.loadFunction = [];
	this.loaded = false;
}
js.prototype.setLibraryPath = function(path) {
	if (path.substring(path.length-1)!='/') path+='/';
	this.librarypath=path;
	//alert(this.librarypath)
}
js.prototype.addPackage = function(pckg) {
	if (this.packages[pckg]) return;
	this.packages[pckg] = { libs: [] };
}
js.prototype.addLibrary = function(path,files) {
	var pckg = path.substring(0,path.indexOf('.'));
	if (!pckg) {
		alert("Incorrect usage");
		return;
	}
	var name = path.substring(path.indexOf('.')+1);
	if (!this.packages[pckg]) this.addPackage(pckg);
	if (this.packages[pckg].libs[name]) {
		alert("Library "+name+" already exists");
		return;
	}
	this.packages[pckg].libs[name] = files;
}
js.prototype.include = function(src,pth) {
	src=src.split('.');
	if (src[src.length-1] == 'js') src.length -= 1;
	var path=pth||this.librarypath||'';
	if (path.substr(path.length-1) != "/") path += "/";
	var pckg=src[0];
	var grp=src[1];
	var file=src[2];
	if (file=='*') {
		if (this.packages[pckg]) group=this.packages[pckg].libs[grp];
		if (group) for (var i=0;i<group.length;i++) document.write('<script language="Javascript1.2" src="'+path+pckg+'/'+grp+'/'+group[i]+'.js"><\/script>');
		else alert('include()\n\nThe following package could not be loaded:\n'+src+'\n\nmake sure you specified the correct path.');
	} else document.write('<script language="Javascript1.2" src="'+path+src.join('/')+'.js"><\/script>');
}

js.prototype.onload = function() {
	for (lF=0; lF < this.loadFunction.length; lF++) { this.loadFunction[lF](); }
	this.loaded = true;
}

ArteCodigoJS = new js();

// events
onload = function() { ArteCodigoJS.onload(); }

ArteCodigoJS.addPackage('ArteCodigo');
ArteCodigoJS.addLibrary('ArteCodigo.basics' ,["browser","functions","img","popup","screen"]);
ArteCodigoJS.addLibrary('ArteCodigo.dynapi' ,["dynlayer","dynlayer_slide","dynlayer_clip"]);
ArteCodigoJS.addLibrary('ArteCodigo.css' , ["css_function"]);
ArteCodigoJS.addLibrary('ArteCodigo.form' ,["ArteCodigo_form","ArteCodigo_formEn"]);
ArteCodigoJS.addLibrary('ArteCodigo.gui' ,["ArteCodigo_scrollbar"]);
ArteCodigoJS.addLibrary('ArteCodigo.effects' ,["ArteCodigo_fade", "ArteCodigo_friction", "ArteCodigo_friction2"]);
ArteCodigoJS.addLibrary('ArteCodigo.menus' ,["show_hide","fade","collapse","dropdown"]);

function BUG_ns4_reloadOnResize(){
	if(!document.pgW){ document.pgW = innerWidth; document.pgH = innerHeight;onresize=BUG_ns4_reloadOnResize}
	else if(innerWidth!=document.pgW||innerHeight!=document.pgH)location.reload()
}
if (document.layers) BUG_ns4_reloadOnResize()


