//Class to administer


ConfigurationFactory.prototype.loadJs = function (filename) 
{

    var fileref = document.createElement('script');
    var path = siteRoot + "funktioner/conf/" + filename.substring(3) + ".php?js=true";
    fileref.setAttribute("type", "text/javascript");
    fileref.setAttribute("src", path);
    document.getElementsByTagName("head")[0].appendChild(fileref);
}

function ConfigurationFactory()
{
    this.loadedConfigs = new Array();
    this.loadedConfigs['CF_Generic'] = true;
    this.validConfigs = new Array("CF_Newsletter", "CF_Generic", "CF_FileArchive");
}

ConfigurationFactory.prototype.getConfigurator = function(name)
{
    var confName = "CF_Generic";
    for (var i in this.validConfigs)
	{ 
	    if(this.validConfigs[i] == name)
		{
		    confName = name;
		    break;
		}
	}
    if(this.loadedConfigs[confName] == null)
	{
	    
	    this.loadJs(confName);
	    this.loadedConfigs[confName] = true;
	}

    return eval('new ' + confName + '()');
	

}

var CF_factory = new ConfigurationFactory();


