//
// Routines for mini help menu
//

// Menu help messages
// Main menu
var helpmessagestext = new Array;
helpmessagestext['affiliates']    = 'Affiliate management area allowing you to view and update affiliate infomation and run detailed reports on clicks and commission';
helpmessagestext['configuration'] = 'View and edit all the settings of this program. Be sure to reference the documentation if you do not understand a variable before adjusting it';
helpmessagestext['payday']        = 'Generate a Pay Period report whenever you want to pay your affiliates. Note that this does not include commissions for the current day';
helpmessagestext['dataman']       = 'Backup affiliate details and statistics. Download old PayDays and block access to data folders';
helpmessagestext['codegen']       = 'Setup and manage the linking methods for your affiliates to use. Including banners, flash, text links and html boxes';
helpmessagestext['adserver']      = 'Monitor, add and update the adverts you server for affiliate sites. Detailed statistics show exactly which adverts are performing';
helpmessagestext['tracking']      = 'Setup marketing tracking accounts and calculate your ROI from the advertising campaigns that you run';
helpmessagestext['email']         = 'Email all or a select group of affiliates. Regular contact with affiliates can keep you in touch with their needs and them up to date';
helpmessagestext['help']          = 'Familiarize yourself with your Affiliate Program and all of the CosmicAffiliate features available to you';
helpmessagestext['orders']        = 'Add, remove and update tracked orders and commissions. Also view and edit current memberships for semi-automated recurring commissions';
helpmessagestext['looknfeel']     = 'Adjust the Look and Feel of the affiliate area. Run the template wizard or edit templates directly';
helpmessagestext['adshare']       = 'Setup and edit different AdShares for sponsors on your site. Give affiliates a slice of the advertising revenues you are receiving';
helpmessagestext['merchant']      = 'Enter the merchant management area. Adjust their information and view stats for merchants in your affiliate network';
helpmessagestext['logout']        = 'Logout of this management area and stop your current session';
helpmessagestext['onlinehelp']    = 'Read up on the documentation for each part of CosmicAffiliate so that you know what\'s going on';
// Affiliate menu
helpmessagestext['displayaffiliates']    = 'View a list of all your affiliates with sorting options. Access all their individual sales, stats and commissions';
helpmessagestext['pendingaffiliates']    = 'The list of affiliates awaiting your approval to access the affiliate area';
helpmessagestext['suspendedaffiliates']  = 'Affiliates that you have currently flagged as suspended';
helpmessagestext['affiliatereferrers']   = 'View the referring pages that the affiliates have been sending you clicks from';
helpmessagestext['ordersthis']           = 'List all the orders tracked this pay period from affiliates with details including order amount, id and original referring click';
helpmessagestext['orderslast']           = 'List all the orders tracked last pay period from affiliates with details including order amount, id and original referring click';
helpmessagestext['manualorder']          = 'Manually add an order to an affiliates account. Set the affiliate, date, currency, site, amount and order number';
helpmessagestext['deadaffiliates']       = 'Display a list of affiliates that haven\'t been active in your chosen number of days';
helpmessagestext['overaffiliates']       = 'Display a list of affiliates that have commissions valueing over your chosen amount';
helpmessagestext['affiliateconversions'] = 'Display a list of affiliates that have not met on average at least 1 sale per your chosen number of clicks';
helpmessagestext['orderlookup']          = 'Enter and order number or date to display a list of matching tracked orders';
// 
helpmessagestext['generalsettings']    = 'General program settings. Including your company name and email. Whether affiliates are given instant access or approved. Required join fields. If affiliate usernames are generated automatically. Default days stats affiliates view in reports. Whether to wipe old data. How many affiliates to show in the top affiliate display. Date style (US or UK). Default currency. Minimum payout. If tiers are enabled. Whether affiliates can contact their downline. Default language. Available payment methods and default payment method.';


// Random help messages
var randomhelptext = new Array;
randomhelptext[0] = 'Don\'t forget to backup your Database before every PayDay!';
randomhelptext[1] = 'Email your affiliates regularly to keep them up to date and active';
randomhelptext[2] = 'Be sure to report any errors you find in this program';
randomhelptext[3] = 'We provide free internet marketing guides and information at <a href="http://www.cosmicmarketing.com" target="_blank">CosmicMarketing.com</a>';
randomhelptext[4] = 'Integrate CosmicAffiliate with a collection of other website software available from <a href="http://www.cosmicperl.com" target="_blank">CosmicPerl.com</a>';


function HelpDisplayGo(helptext) {
  var starthtml = "<span class='helpmessage'>";
  var endhtml = "</span>";
  // Fix string
  helptext = helptext.replace(/&/gm, '&amp;');
//  helptext = helptext.replace(/</gm, '&lt;');
//  helptext = helptext.replace(/>/gm, '&gt;');
  helptext = helptext.replace(/\n/gm, '<br/>');
  var msgtext = starthtml + helptext + endhtml;

  if (navigator.appName == 'Microsoft Internet Explorer') {
    this.document.all['helpdisplay'].innerHTML = msgtext;
  } // End if

  if (navigator.appName == 'Netscape' && parseInt(navigator.appVersion) == 4) {
    var outhtml = this.document.layers['helpdisplay'].document;
    outhtml.open();
    outhtml.write(msgtext);
    outhtml.close();
  } // End if

  if (navigator.appName == 'Netscape' && parseInt(navigator.appVersion) > 4) {
    outhtml = this.document.getElementById('helpdisplay');
    if (outhtml && outhtml.innerHTML) {
      outhtml.innerHTML = msgtext;
    } // End if
  } // End if
  
} // End sub

function RndHelpDisplay() {
  index = Math.floor(Math.random() * randomhelptext.length);
  HelpDisplayGo(randomhelptext[index]);
} // End sub
//HelpDisplayGo(randomhelptext[index]);

function HelpDisplay(helptext) {
  var messagetext = helpmessagestext[helptext];
  HelpDisplayGo(messagetext);
} // End sub
