// (c) Almega Consulting Corporation 2007 - All rights reserved.
//          http://www.help-pm.com/Almega.html

var Testing = "";
<!-- alert("Testing...");-->

function setCookie (name, value) { 
if (Testing != "" ) alert("setCookie..." + name + "=" + value);
  var argv = setCookie.arguments; 
  var argc = setCookie.arguments.length; 
  var expires = (argc > 2) ? argv[2] : null; 
  var path = (argc > 3) ? argv[3] : null; 
  var domain = (argc > 4) ? argv[4] : null; 
  var secure = (argc > 5) ? argv[5] : false; 
  document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); 
} 
setCookie('Help-PM_Test', Testing);

function getCookie( name ) {
  var start = document.cookie.indexOf( name + "=" );
  var len = start + name.length + 1;
  if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
    return null;
  }
  if ( start == -1 ) return null;
  var end = document.cookie.indexOf( ';', len );
  if ( end == -1 ) end = document.cookie.length;
if (Testing != "" ) alert("getCookie..." + name + "=" + document.cookie.substring( len, end ));
  return unescape( document.cookie.substring( len, end ) );
}

function delCookie( name, path, domain ) {
if (Testing != "" ) alert("delCookie..." + name);
  if ( getCookie( name ) ) document.cookie = name + '=' + ( ( path ) ? ';path=' + path : '') + ( ( domain ) ? ';domain=' + domain : '' ) + ';expires=Thu, 01-Jan-1970 00:00:01 GMT';
}

function setReceipt (value) { 
  var TodayDate = new Date();
  var sTodayDate = TodayDate.toString();
if (Testing != "" ) alert("setReceipt - TodayDate=" + sTodayDate);
  var Year = sTodayDate.substring(24,28);
  var Month = sTodayDate.substring(4,7);
  var Day = sTodayDate.substring(8,10);
  var HH = sTodayDate.substring(11,13);
  var MM = sTodayDate.substring(14,16);
  var SS = sTodayDate.substring(17,19);
  var Zone = sTodayDate.substring(20,23);
  setCookie('Help-PM_Receipt', value + sTodayDate.substring(7,30));
} 

function getReceipt() {
if (Testing != "" ) alert("getReceipt...");
  return getCookie('Help-PM_Receipt');
}

function delReceipt() {
if (Testing != "" ) alert("delReceipt...");
  return detCookie('Help-PM_Receipt');
}

function getProdName( Receipt ) {
if (Testing != "" ) alert("getProdName...");
  var ProdId = Receipt.substring(1,6);
  if (Testing != "" ) alert("ProdId=" + ProdId);
  if ( ProdId == '10107' ) return "Portfolio Dashboard 2007";
  if ( ProdId == '10207' ) return "PMO in a Box 2007";
  if ( ProdId == '11107' ) return "IT Project Estimator 2007";
  if ( ProdId == '11207' ) return "IT Work Breakdown Structures 2007";
  if ( ProdId == '12107' ) return "Communications Plan 2007";
  if ( ProdId == '17107' ) return "Project Risk Templates 2007";
  <!-- If not found -->
  return "Unknown Product";
}

function getFileName( Receipt ) {
if (Testing != "" ) alert("getFileName...");
  var ProdId = Receipt.substring(1,6);
  if ( ProdId == '10107' )
    return '<A href=\"http://www.help-pm.com/Download_P10107_1g6CDjl7K5/P10107_Portfolio%20Dashboard.zip\">Download Now</A>';
  if ( ProdId == '10207' )
    return '<A href=\"http://www.help-pm.com/Download_P10207_3t6jl6Uu7o1/P10207_Project_Office.zip\">Download Now</A>';
  if ( ProdId == '11107' )
    return '<A href=\"http://www.help-pm.com/Download_P11107_1f9AJDg7D5/P11107_IT%20Project%20Estimator.zip\">Download Now</A>';
  if ( ProdId == '11207' )
    return '<A href=\"http://www.help-pm.com/Download_P11207_3f6KlDi08n/P11207_IT%20WBS.zip\">Download Now</A>';
  if ( ProdId == '12107' )
    return '<A href=\"http://www.help-pm.com/Download_P12107_3f89H913ln/P12107_Communications%20Plan.zip\">Download Now</A>';
  if ( ProdId == '17107' )
    return '<A href=\"http://www.help-pm.com/Download_P17107_1w6HlDi78p/P17107_Risk%20Templates.zip\">Download Now</A>';
  <!-- If not found -->
  return "Unknown Product";
}
