

/* * * * * * * * * * * * * * * * * * *
*
*  giganttic: Prototype Edition
*
*  (c) 2005 www.giganttic.com
*
*  giganttic is freely distributable under the terms of an MIT-style license.
*  For details, see the giganttic web site: http://www.giganttic.com/
*
*   - Scriptaculous Loader (modded for giganttic)
*     Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
*
* * * * * * * * * * * * * * * * * * */

var gi = new Object();

gi.isOpera   = /opera/i.test(navigator.userAgent);
gi.isSafari  = /khtml|webkit/i.test(navigator.userAgent);
gi.isIE      = (!gi.isOpera  && /msie/i.test(navigator.userAgent));
gi.isMozilla = (!gi.isSafari && !gi.isOpera && document.addEventListener);
  

/* * * * * * * * * * * * * * * * * * *
*
*  Load Required Files
*
* * * * * * * * * * * * * * * * * * */

Object.extend(gi,{
	
  Version : '1.0',
  path    : null,
  skipStyleSheetCreation : false,
  
  _plotObservers  : false,
  _plotNumber     : 0,
  _instanceNumber : 0,

  
  require : function(libraryName) {
    //inserting via DOM fails in Safari 2.0, so brute force approach
    document.write('<script type="text/javascript" src="'+libraryName+'"></script>');
  },
  
  load : function(){
    if((typeof Prototype == 'undefined') || (typeof Element == 'undefined') ||
      parseFloat(Prototype.Version.split('.')[0] + '.' + Prototype.Version.split('.')[1]) < 1.4){
      throw('giganttic requires the Prototype JavaScript framework >= 1.4.0');
    }
    
    var script = $A(document.getElementsByTagName("script")).find( function(s){
      return (s.src && s.src.match(/giganttic\.js(\?.*)?$/));
    });
    
    this.path = script.src.replace(/giganttic\.js(\?.*)?$/,'');
    var includes = ['proto','common','htm','gantt','method'];
    
    includes.each(function(include){
      gi.require( this.path + include + '.js');
    }.bind(this));
  }
});

gi.load();