/*
  Programmer...: Michael Thomas - michael@michael-thomas.com
  Original Date: 05/11/08
  Changed Date.: 05/11/08
  
  History of Changes:
  
  
*/

/*
Set who the vendor is.  This drives the following:
  1) top banner if running from localhost or filesystem.
  2) the link that returns back to the Tutorial Home Page if running from localhost or filesystem.
*/

var strVendor = "Michael Thomas"  //Note: Used to have more than one vendor!
      

var blnTutorialHomePage_Offline_UseAlert = false; //true - shows a popup, false - goes to the online web site tutorial home page.


function fWriteLogo( strLogoFilesDirectory ) {

  var strHtmlLogo = "";

  var strLocationHost = location.host;
  var strWidth = "100%";
  var strHeight = "200"; 

  var strDisplayBannerFilename = ""; 
  //Options: 
  //  "logo_michael-thomas.htm"
  
  
  //*************************************
  //Start: Determine Banner to Display
  //*************************************
  
  if ( strLocationHost == "www.michael-thomas.com" ) {
	
    strDisplayBannerFilename = "logo_michael-thomas.htm";
    strLogoFilesDirectory = "http://www.michael-thomas.com/tech/" + strLogoFilesDirectory
    
  } else {

    //Running from localhost or filesystem.
    if ( strVendor == "Michael Thomas" ) {
      strDisplayBannerFilename = "logo_michael-thomas.htm"  
    } else {
      strDisplayBannerFilename = "logo_michael-thomas.htm"  
    }
    
  }

  //*************************************
  //Stop: Determine Banner to Display
  //*************************************

  if ( strDisplayBannerFilename == "logo_michael-thomas.htm" ) {

    strWidth = "100%";
    strHeight = "300"; // was 200, 300 with Corporate Training email link.
	
    strHtmlLogo += '' + '\n' +
    '<iframe src="' + strLogoFilesDirectory + '/logo_michael-thomas.htm" noResize=true scrolling=no width="' + strWidth + '" height="' + strHeight + '" align="center" valign="center" frameborder=0>' + '\n' +
    'Sponsored by: <a href="http://www.michael-thomas.com" target="_parent">Michael Thomas</a> ' + '\n' +
    '</iframe>' + '\n' +
    ''

  }

  document.write( strHtmlLogo );

}

function fGoToTutorialHomePage(strURL) {

  var strLocationHost = location.host;
  var strPopupAlertURL = "javascript:alert('This link is not available while you are working offline.')";
  
  //alert("Hello: " + strUrl + " - " + strLocationHost + " - " + ( strLocationHost == "" ) );
 
  if ( "|localhost|www.michael-thomas.com|".indexOf("|" + strLocationHost + "|") > -1 ) {

    //Use the strURL value passed in!	

  } else {
 
    //Running on a local filesystem or a server that is not one of the valid servers.
    //FYI - Local filesystem is: strLocationHost == ""

    if ( strVendor == "Michael Thomas" ) {
      strURL = "http://www.michael-thomas.com/tech/"  //Tutorial home page at: www.michael-thomas.com
    } else {
      strURL = strPopupAlertURL;
    }

  }	
	
  if ( blnTutorialHomePage_Offline_UseAlert ) {
    strURL = strPopupAlertURL;
  }
  
  location.href = strURL;
  
}
