// *******************************************************
//
// MooTools Loader
// (c)2009 Webuddha.com, Holodyn Corporation
//
// This Loader will identify administration calls and
//   load MooTools. The optional flag "loadMooTools" can
//   be set on the frontend that will force the mootools
//   script to be loaded.
//
// *******************************************************
//
// To Force the Loading of MooTools, include the following
//   variable definition in your template file ABOVE jdoc
//
//  <script> var loadMooTools=true; </script>
//  <jdoc:include type="head" />
//
// *******************************************************

// Path to Media Folder
    var mtPath = location.href.replace(/^(\w+\:+\/+[\w\.\-]+).*$/,'$1')
               + '/media/system/js/';

// Identify Administration if not forced...
  if( typeof(loadMooTools)=='undefined' )
    loadMooTools = /administrator/.test(location.href);

// Load MooTools if chosed and not already loaded...
  if(loadMooTools && typeof(MooTools)=='undefined'){
    var mtIncludes = [
      'mootools-compressed.js'
      ];
    for(var i=0;i<mtIncludes.length;i++){
      if(mtIncludes[i].match(/css$/))
        document.write('<link rel="stylesheet" type="text/css" href="'+mtPath+mtIncludes[i]+'" />');
      else
        document.write('<script type="text/javascript" src="'+mtPath+mtIncludes[i]+'"></script>');
    }
  }

// *******************************************************
// END
// *******************************************************
