/**
 * PINO JS Library
 *
 * (c) Copyright 2009 - www.pino.pl
 **/
function pino() {
	
	// Path to JS parent directory 
	this.path = 'http://openid.pino.pl/app/static/global/';
	
	// Subdirectory - where libraries (i.e. jQuery) will be stored
	this.libPath = this.path + 'libs/';

	// Subdirectory - where plugins (i.e. for jQuery) will be stored
	this.pluginPath = this.path + 'plugins/';
	
	// Subdirectory - where standalone files will be stored
	this.filePath = this.path + 'files/';
	
	// Default options
	this.options = {
		uncompressed: false				// tells if uncompressed JS should be loaded (not recommended for production!)
	};
	
	/**
	 * Loader function
	 *
	 * This will load an external JS file and include it in the <head> section
	 * of the page
	 **/
	this.load = function( file, options ) {
		// Check if the loaded file should be compressed or not
		if( typeof options != 'undefined' ) {
			var uncompressed = options.uncompressed;
		} else {
			var uncompressed = this.options.uncompressed;
		}
		var fileref = document.createElement( 'script' );
		fileref.setAttribute( 'type', 'text/javascript' );
		// If compressed, add '.min' to the filename
		if( uncompressed != false ) {
			file = file + '.min';
		}
		fileref.setAttribute( 'src', file + '.js' );
		if( typeof fileref != 'undefined' ) {
			document.getElementsByTagName( 'head' )[ 0 ].appendChild( fileref );
		}
	}
	
	/**
	 * Library loader function
	 *
	 * This will load an external JS file and include it in the <head> section
	 * of the page
	 **/
	this.loadLibrary = function( file, options ) {
		// Check if the loaded file should be compressed or not
		this.load( this.libPath + file, options );
	}
	
	/**
	 * Plugin loader function
	 *
	 * This will load an external JS file and include it in the <head> section
	 * of the page
	 **/
	this.loadPlugin = function( file, options ) {
		// Check if the loaded file should be compressed or not
		this.load( this.pluginPath + file, options );
	}
	
	/** 
	 * Files loader
	 * Loads standalone files
	 **/
	this.loadFile = function( file, options ) {
		// Check if the loaded file should be compressed or not
		this.load( this.filePath + file, options );
	}
	
}

// Create an instance
pino = new pino();