/**
 * Resource Technology Management, Inc.  
 *
 * @copyright Copyright (c) 2010 - 2011, RTM, Inc.
 * @link    http://www.rtm-inc.com/
 * 
 * @notes:
 *    Jquery.history:       Browser history with AJAX support,
 *    Jquery.hijax:     SEO/AJAX support
 * 
 */
 
var core = {  
  templateFolder: "e11/",  // e11/
  /* CSS */  
  CSSPath: "", 
  localCSSPath: "css/",  
  globalCSSPath: "http://www.hoteldevserver.com/global/css/",   
  /* Scripts */ 
  scriptsPath: "", 
  globalScriptsPath: "http://www.hoteldevserver.com/global/Scripts/",
  coreScriptsPath: " http://www.hoteldevserver.com/global/Scripts/core_v1/" //  http://www.hoteldevserver.com/global/Scripts/core_v1/  
}

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

core.initialize = function(assetPath) {
  // If template folder is passed then set property
  if(typeof templateFolder!='undefined') 
    this.templateFolder = templateFolder; 
  
  // Load global  CSS
  this.CSSPath =  this.globalCSSPath;
  this.loadCSS(this.templateFolder+"global","screen");  
  this.loadCSS("jquery.lightbox","screen");        
  
  // Load local CSS
  this.CSSPath =  this.localCSSPath;    
  this.loadCSS("layout","screen");    
  this.loadCSS("pages","screen"); 
  
  // Switch to global scripts path
  this.scriptsPath = this.globalScriptsPath;
  //this.scriptsPath = this.coreScriptsPath+this.templateFolder+"jquery/";      
  
  // Class Support
  this.loadScript("jquery.class");
  
  // Jquery core scripts
  this.loadScript("jquery.min");
  this.loadScript("jquery.mousewheel");    
  this.loadScript("jquery.em");    
  this.loadScript("jquery.corner");  
  this.loadScript("jquery.ui.min");
  this.loadScript("jquery.lightbox");
  this.loadScript("jquery.scrollpane");        
  this.loadScript("jquery.history");
  this.loadScript("jquery.hijax");
  
  // Switch to core scripts path
  this.scriptsPath = this.coreScriptsPath+this.templateFolder;    
  
  // Main application  
  this.loadScript("application");
  
  // Set Events
  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();

