// Weebly Javascript base file
// Copyright 2005-2006 Weebly

var included_files = new Array();
var initFiles = new Array();
var buildTime = 0;
var Weebly = { };

function init(footprint, build_time) {

   initFiles = footprint;
   buildTime = build_time;

  // Library Includes
  if( isIn(footprint, 'base')) {
    //include_once('/weebly/libraries/prototype.js');
    //include_once('/weebly/libraries/scriptaculous.js');
  }
  if( isIn(footprint, 'utils_ajax')) {
    include_once('/weebly/libraries/weebly_utils_ajax.js');
  }
  if( isIn(footprint, 'utils')) {
    include_once('/weebly/libraries/weebly_utils.js');
  }
  if( isIn(footprint, 'pages')) {
    include_once('/weebly/libraries/weebly_pages.js');
  }
  if( isIn(footprint, 'signup')) {
    include_once('/weebly/libraries/weebly_signup.js');
  }
  if( isIn(footprint, 'user_home')) {
    include_once('/weebly/libraries/transitions.js');
    include_once('/weebly/libraries/weebly_user_home.js');
    include_once('/weebly/libraries/behaviour.js');
    include_once('/weebly/libraries/weebly_user_home_style.js');
  }
  if( isIn(footprint, 'colorchooser')) {
    include_once('/weebly/libraries/yahoo.color.js');
    include_once('/weebly/libraries/colorpicker.js');
  }
  if( isIn(footprint, 'linker')) {
    include_once('/weebly/libraries/weebly_linker.js');
  }
  if( isIn(footprint, 'cache')) {
    include_once('/weebly/libraries/weebly_cache.js');
  }
  if( isIn(footprint, 'main')) {
    include_once('/weebly/libraries/transitions.js');
    include_once('/weebly/libraries/weebly_main.js');
    include_once('/weebly/libraries/weebly_initmain.js');
    include_once('/weebly/libraries/behaviour.js');
    include_once('/weebly/libraries/weebly_mainstyle.js');
  }

  if( isIn(footprint, 'editbox')) {
    include_once('/weebly/libraries/weebly_editbox.js');
  }
  if( isIn(footprint, 'absolute')) {
    include_once('/weebly/libraries/weebly_absolute.js');
  }
  if( isIn(footprint, 'corners')) {
    include_once('/weebly/libraries/corners.js');
  }
  if( isIn(footprint, 'feedback')) {
    include_once('/weebly/libraries/weebly_feedback.js');
  }
  if( isIn(footprint, 'signup')) {
    include_once('/weebly/libraries/weebly_signup.js');
  }
  if( isIn(footprint, 'elements')) {
    include_once('/weebly/libraries/weebly_elements.js');
  }
  if( isIn(footprint, 'imageutils')) {
    include_once('/weebly/libraries/weebly_image_utils.js');
  }
  if( isIn(footprint, 'uploads')) {
    include_once('/weebly/libraries/weebly_uploads.js');
  }
  if( isIn(footprint, 'myspace')) {
    include_once('/weebly/libraries/weebly_myspace.js');
  }
  if( isIn(footprint, 'adsense')) {
    include_once('/weebly/libraries/weebly_adsense.js');
  }

}

function initTwo() {

  if( isIn(initFiles, 'colorchooser')) {
  }
  if( isIn(initFiles, 'main')) {
  }

}

function include_dom(script_filename) {
    //var html_doc = document.getElementsByTagName('head').item(0);
    //var js = document.createElement('script');
    //js.setAttribute('language', 'javascript');
    //js.setAttribute('type', 'text/javascript');
    //js.setAttribute('src', script_filename);
    //html_doc.appendChild(js);
    document.write('<script type="text/javascript" src="'+script_filename+'?buildTime='+buildTime+'"></script>');
    return false;
}

function include_once(script_filename) {
    //alert("Including: "+script_filename);
    if (!isIn(included_files, script_filename)) {
        included_files[included_files.length] = script_filename;
        include_dom(script_filename);
    }
}

function isIn(myArray, matchVar) {

    for (i=0; i < myArray.length; i++) { 
      if (matchVar == myArray[i]) { 
	return i; 
      }
    }
    return false;

}

