/**
 * LoadScript
 *
 * @author Christian Hansen <christian@resource-it.dk>
 * @version 1.0
 * @package Resource it Modules
 * @copyright Resource it ApS
 *
 **/


/*===================================
  CLASS InjectScript
  ===================================*/

    /**
     * LoadScript constructor 
     * @param string script - script file name
     * @param string path [optional] - path to backend xml - api
     * @uses lib.resext.js
     * @uses class.function.js
     **/

    function LoadScript ( script, path ) {
        
        this.query = [];
        this.script = script;
        this.path = path === undefined ? "" : path;
        
    }//InjectScript
    
    
    LoadScript.prototype.addParm = function ( key, value ) {
        this.query[this.query.length] = key + '=' + value;
    }//addParm
    
    
    LoadScript.prototype.load = function (force) {
        if ( this.query.length > 0 ) var querystr = '?' + this.query.join("&");
        else var querystr = '';
        if (force !== undefined ) resExt.load({script:this.script + querystr,path:this.path,force:true});
        else resExt.load({script:this.script + querystr,path:this.path});
    }//load
    
    
