var PlayerVersion = 'v4.4.8';
var theKey = Math.floor(Math.random()*100000);
function createRequestObject() {
  FORM_DATA = new Object();
  separator = ',';
  query = '' + this.location;
  qu = query
  query = query.substring((query.indexOf('?')) + 1);
  if (query.length < 1) { return false; }
  keypairs = new Object();
  numKP = 1;
  while (query.indexOf('&') > -1) {
    keypairs[numKP] = query.substring(0,query.indexOf('&'));
    query = query.substring((query.indexOf('&')) + 1);
    numKP++;
  }
  keypairs[numKP] = query;
  for (i in keypairs) {
    keyName = keypairs[i].substring(0,keypairs[i].indexOf('='));
    keyValue = keypairs[i].substring((keypairs[i].indexOf('=')) + 1);
    while (keyValue.indexOf('+') > -1) {
      keyValue = keyValue.substring(0,keyValue.indexOf('+')) + ' ' + keyValue.substring(keyValue.indexOf('+') + 1);
    }
    keyValue = unescape(keyValue);
    if (FORM_DATA[keyName]) {
      FORM_DATA[keyName] = FORM_DATA[keyName] + separator + keyValue;
    } else {
      FORM_DATA[keyName] = keyValue;
    }
  }
  return FORM_DATA;
}

FORM_DATA = createRequestObject();

var demo = FORM_DATA['demo'];

var User=FORM_DATA['User'];
var System=FORM_DATA['System'];
var Ver=FORM_DATA['Ver'];
var Id=FORM_DATA['Id'];
var ShortName=FORM_DATA['ShortName'];

var firstname=FORM_DATA['firstname'];
var lastname=FORM_DATA['lastname'];
var product=FORM_DATA['product'];
var date=FORM_DATA['date'];
var rep=FORM_DATA['rep'];
var company=FORM_DATA['company'];
var currentcount=FORM_DATA['currentcount'];
var maxcount=FORM_DATA['maxcount'];

var purchaseCode = FORM_DATA['purchaseCode'];
var email = FORM_DATA['email'];
var projectUrl = FORM_DATA['projectUrl'];


createRequestObject();

function Draw_demo() { if (demo) { document.write('<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td width="10"><img src="http://www.cioview.com/images/border_form_ul.gif" width="10" height="10"></td><td width="100%" background="http://www.cioview.com/images/border_form_t.gif"><img src="http://www.cioview.com/images/spacer.gif" width="10" height="10"></td><td width="10"><img src="http://www.cioview.com/images/border_form_ur.gif" width="10" height="10"></td></tr><tr valign="top"><td background="http://www.cioview.com/images/border_form_l.gif"><img src="http://www.cioview.com/images/spacer.gif" width="10" height="10"></td><td bgcolor="#FFFFFF" class="bodytext_sm"><p><b>Thank you.</b></p><p>We\'d like to thank you for using an evaluation version of this software. Now that you have seen just how easy it is to put together a financial analysis, you are probably wondering, &quot;How can I generate my own business case report?&quot;</p><p>The answer is very simple.  All you need to do is upgrade to a full license using this Web page and you will immediately receive:</p><ul><li>Access to the content in the Detail navigation arrows and Worksheets that are unavailable using an evaluation version</li><li>Access to all pricing and configuration data, including support and discount terms</li><li>The ability to change all values and assumptions, even if they were grayed out in the evaluation version</li><li>A one-button report generation feature that will automatically create a business case report of your analysis replete with charts and graphs</li></ul><p>Simply choose whether you would like to upgrade to a 1-week, 3-month, or 1-year license.</p></td><td background="http://www.cioview.com/images/border_form_r.gif"><img src="http://www.cioview.com/images/spacer.gif" width="10" height="10"></td></tr><tr><td><img src="http://www.cioview.com/images/border_form_ll.gif" width="10" height="10"></td><td background="http://www.cioview.com/images/border_form_b.gif"><img src="http://www.cioview.com/images/spacer.gif" width="10" height="10"></td><td><img src="http://www.cioview.com/images/border_form_lr.gif" width="10" height="10"></td></tr></table><br><br>'); } }

function Get_purchaseCode() { if (purchaseCode) { document.write(' <B>' + purchaseCode + '</B>'); } }
function Get_email() { if (email) { document.write(' <B>' + email + '</B>'); } }
function Get_projectUrl() { if (projectUrl) { document.write(' <a href="/cgi-bin/project_file.cgi?ID=' + projectUrl + '">click here</a>'); } }
function Get_name() { if (firstname) { document.write(' ' + firstname); } if (lastname) { document.write(' ' + lastname); } }
function Get_productname() { if (product) { document.write(' for <B>' + product + ' </B>'); } }
function Get_date() { if (date) { document.write(' as of <B>' + date +'</B>'); } }
function Get_rep() { if (rep) { document.write(', <B>' + rep + '</B>,'); } }
function Get_company() { if (company) { document.write(', <B>' + company + '</B>,'); } }
function Get_currentcount() { if (currentcount) { document.write(' Your company is currently using <B>' + currentcount + '</B> of the group licenses available.'); } }
function Get_maxcount() { if (maxcount) { document.write(' This is out of a total of <B>' + maxcount + '</B> licenses.'); } }

function Get_ShortName() { if (ShortName != '' && ShortName != 'IndustryApplicationServerConsolidation') { document.location = 'https://store.cioview.com/ProductDetails.asp?ProductCode=' + ShortName; } else if (ShortName == 'IndustryApplicationServerConsolidation') { document.location = 'https://store.cioview.com/ProductDetails.asp?ProductCode=IndustryApplicationServer' } }
function Get_User() { if (User) { document.write(User); } }
function Get_System() { if (System) { document.write(System); } }
function Get_Ver() { if (Ver) { document.write('Player version: ' + Ver + '<br>'); }}

function Get_VerCheck() {
  if (Ver) {
	  if (NewVersionAvailable())
		  document.write('The current public release is ' + PlayerVersion + 
		      '. If you would like to upgrade, please click <a href="http://www.cioview.com/download/content/playersetup.exe" target="_blank"><font color="#ffffff"><u>here</u></font></a>.');
	  else
		  document.write('You are using the most current version of the Player.<br>');
  }
	
	document.write( '<img src="/cgi-bin/player.cgi?User=' + User + 
	                '&System=' + System + '&Ver=' + Ver + '" height="0" width="0" border="0"><br>');
}

function NewVersionAvailable() {
  var newVersion = false;
  
  var current = PlayerVersion.substr(1).split('.');
  var installed = Ver.substr(1).split('.');
  for (var i = 0; i < Math.min(installed.length, current.length); i++)
  {
    var currentVer = current[i], installedVer = installed[i];
    if (installedVer < currentVer)
    {
      newVersion = true;
      break;
    }
    else if (installedVer > currentVer)
    {
      break;
    }
  }
  
  return newVersion;
}
