/**
 * Resource Technology Management, Inc.  
 *
 * @copyright Copyright (c) 2010 - 2011, RTM, Inc.
 * @link    http://www.rtm-inc.com/
 * @version    1.1
 * 
 * @notes:
 *    E12 Template
 * 
 */
 
var core = {  
  templateFolder: "e12",
  globalPath: "http://www.hoteldevserver.com/global/",
  CSSPath: "",
  scriptsPath: "",
  siteCSS: "site"
}

/**
 * Constructor
 *
 * @access  public
 */

core.initialize = function(assetPath) {
  // If template folder is passed then set property
  if(typeof templateFolder!='undefined') 
    this.templateFolder = templateFolder; 
    
  // If site css is passed then set property
  if(typeof siteCSS !='undefined') 
    this.siteCSS = siteCSS.replace(".css","");
  
  // Load CSS
  this.loadCSS(this.globalPath+"global","screen");  
  this.loadCSS(this.globalPath+"css/jquery.lightbox","screen");        
  this.loadCSS(this.siteCSS,"screen");     
  this.loadCSS(this.globalPath+"css/"+this.templateFolder+"/global","screen");  

  // Load scripts
  this.scriptsPath = this.globalPath+"Scripts/";      
  this.loadScript("jquery.class");
  this.loadScript("jquery.min");
  this.loadScript("jquery.cycle.all.min");
  this.loadScript("jquery.mousewheel");          
  this.loadScript("jquery.ui.min");
  this.loadScript("jquery.lightbox");
  this.loadScript("cufon_1.09i"); 
  this.loadScript("fonts/myriad_pro_cond");
  this.loadScript("superfish");  
  
  // Switch to core scripts path
  this.scriptsPath = this.globalPath+"Scripts/core_v1/"+this.templateFolder+"/";
  this.loadScript("application");
  this.loadScript("events");
}

/**
 * loadScript
 *
 * @access  public
 */

core.loadScript = function(fileName) {
  // Write script to document
  document.write('<' + 'script');
  document.write(' language="javascript"');
  document.write(' type="text/javascript"');
  document.write(' src="' + this.scriptsPath + fileName + '.js">');
  document.write('</' + 'script' + '>');
}

/**
 * loadCSS
 *
 * @access  public
 */

core.loadCSS = function(fileName,mediaType) {
  // Append css document to document head
  var headID = document.getElementsByTagName("head")[0];
  var cssNode = document.createElement('link');
  cssNode.type = 'text/css';
  cssNode.rel = 'stylesheet';
  cssNode.href = this.CSSPath + fileName + ".css";
  cssNode.media = mediaType;
  headID.appendChild(cssNode);
}
/* ----------------------------------------- */

core.initialize();

