<!--POST

var eMail = user.attr("eMail");

/*******************************************************
Starting of subscription services url scramble code
*******************************************************/
var ASCII_for_A     = 'A'.charCodeAt(0);
var ASCII_for_a     = 'a'.charCodeAt(0);
var ASCII_for_0     = '0'.charCodeAt(0);
var encode64        = buildEncode64Table ();
var decode64        = buildDecode64Table ();
var preValidString  = "aV1";
var postValidString = "V1z";
 
var preSignature    = "rb";
var postSignature   = "sg";
var AlgorithmValidationRE      = new RegExp(preValidString + "([A-Za-z0-9\\-\\_]+)" + postValidString);
var EncodingAlgorithmVersionRE = new RegExp(preSignature + "([A-Za-z0-9\\-\\_]+)" + postSignature);
 
var scrambleKeyString = "a8Fm*f";
var scrambleKey       = scrambleKeyString.split("");
var scrambleKeyLen    = scrambleKeyString.length;

function retAsciiVal (decodeChar)
{
    return(decodeChar.charCodeAt(0));
}

var codeChar   = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +  "0123456";
var decodeChar = "!#$'*+-/^`{|}~%&=? ()<>,;:" + '\\"[].@_';

function escapeChar (specialChar){
    var nIndex = decodeChar.indexOf(specialChar);
    if (-1 == nIndex) // Not found
      { return(specialChar); }
    return(codeChar.charAt(nIndex));
}
 
function specialChar (escapeChar){
    var nIndex = codeChar.indexOf(escapeChar);
    if (-1 == nIndex) // Not found
      { return(escapeChar); }
    return(decodeChar.charAt(nIndex));
}
 
function buildEncode64Table (){
    var encode64 = new Array(64);
     for (i=0; i < 26; i++) {
        encode64[i] = String.fromCharCode(ASCII_for_A+i);
        encode64[i+26] = String.fromCharCode(ASCII_for_a+i);
      }
     for (i=0; i < 10; i++){
        encode64[i+52] = String.fromCharCode(ASCII_for_0+i);
      }
    encode64[62] = "-";
    encode64[63] = "_";
    return encode64;
}
 
function buildDecode64Table (){
    var decode64 = new Array( 127 );
    for (i=0; i <= 26; i++) {
        decode64[i+ASCII_for_A] = i;
        decode64[i+ASCII_for_a] = i+26;
    }
 
    for (i=0; i <= 10; i++){
        decode64[i+ASCII_for_0] = i+52;
    }
 
    decode64['-'.charCodeAt(0)] = 62;
    decode64['_'.charCodeAt(0)] = 63;
    return decode64;
}
 
function scramble64 (plainText64) {
    var plainTextLength = plainText64.length;
    var escapedTextLength = 0;
    var escapePrefix = "_";
    var escapedChar = "";
    var escapedText = "";
    var scrambled = "";
    var i = 0;
        
    for (i = 0; i < plainTextLength; i++) {
        plainChar = plainText64.charAt(i);
        escapedChar = escapeChar(plainChar);
        if (escapedChar != plainChar){
            escapedText += escapePrefix;
            }
        escapedText += escapedChar;
    }
 
    // Add the validation strings pre-encryption.
    escapedText = preValidString + escapedText + postValidString;
 
    escapedTextLength = escapedText.length;
 
    var i0 = decode64[ retAsciiVal(escapedText.charAt (escapedTextLength - 1)) & 0x7F ];
    var i1 = decode64[ retAsciiVal(escapedText.charAt (0)) & 0x7F ];
    var value = ((i0 << 5) | (i1 >>> 1)) & 0x3F;
    value = (value ^ retAsciiVal(scrambleKey[ 0 ])) & 0x3F;
 
    if (scrambled == null){
        scrambled = encode64[ value ];}
    else {
        scrambled = scrambled.concat (encode64[ value ]);}
 
    i0 = i1;
    for (i = 1; i < escapedTextLength; i++) {
        i1 = decode64[ retAsciiVal(escapedText.charAt (i)) & 0x7F ];
        value = ((i0 << 5) | (i1 >>> 1)) & 0x3F;
        value = (value ^ retAsciiVal (scrambleKey[ i % scrambleKeyLen ])) & 0x3F;
        scrambled = scrambled.concat (encode64[ value ]);
       i0 = i1;}
 
    // Add the signature strings post-encryption.
    scrambled = preSignature + scrambled + postSignature;
 
    return scrambled;}
 
var cIdString = user.attr("cId");
var argString = eMail + ":" + cIdString;
var URLArg = scramble64(argString);
/*******************************************************
End subscription services url scramble code
*******************************************************/

/*******************************************************
  This code allows varying content for the message.
*******************************************************/
var mdb         = false;
var subServices = false;
var prospect    = false;
var quick_sub   = false;

if (user.contains ("source","HP ScanJet Microsoft")||
    user.contains ("source","Mac Software Updates")||
    user.contains ("source","HP ScanJet Gazette")||
    user.contains ("source","ScanJet")) {
   subServices                = true;
   var userProductOwnedString = user.attr("SSDBProductOwned1");
   var updateURL              = "http://subscription.support.hp.com/di/nc?c=" + URLArg;
} else {
  if (user.contains ("source","Marketing Database")) {
     mdb = true;}
  if (user.contains ("source","ProspectNet")) {
     prospect = true;}
  if (user.contains ("source","Quick_Sub")) {
     quick_sub = true;}
  var userProductOwnedString = user.attr("hpccmProductsOwned1");
  var updateURL              = "http://h30189.www3.hp.com/modify_profile_b.jsp";
}

/************************************************************************
STAF section
************************************************************************/

var firstName = user.attr("firstName");
var lastName = user.attr("lastName");

if (firstName == null || lastName == null || firstName == "" || 
    lastName == "" || firstName == " " || lastName == " ") {
    greeting = "Dear HP Newsgram Subscriber:";}
else {
    /***** convert first letter of name to uppercase *******/
    var phraseLength = firstName.length;
    var userFirstInitial = firstName.substring(0,1).toUpperCase();
    var userRestOfName = firstName.substring(1, phraseLength).toLowerCase();
    /***** convert first letter of last name to uppercase *******/
    var phraseLength = lastName.length;
    var userFirstInitialLastName = lastName.substring(0,1).toUpperCase();
    var userRestOfLastName = lastName.substring(1, phraseLength).toLowerCase();
    greeting = "Dear " + userFirstInitial + userRestOfName + " " + userFirstInitialLastName + userRestOfLastName + ":";}



var referredEmail = user.attr("lastReferredByEmail");
var signature;
var referredNoteExists = true;
var isReferred = false;

if (user.attr("subscribed") == 2) {
    isReferred = true;}
if (isReferred) {
var lastReferredfirstName = user.attr("lastReferredFirstName");

var lastReferredNote = user.attr("lastReferredNote");
    if (lastReferredNote == null || lastReferredNote == "" || lastReferredNote == " ") {
    lastReferredNote = "";
    referredNoteExists = false;}
    else {
    lastReferredNote = lastReferredNote + "<br><br>";}

if (firstName == null || firstName == "" || firstName == " ") {
    firstName = referredEmail; 
    signature = referredEmail;
    greeting ="Valued hpshopping customer!";
} else {
     /***** convert first letter of name to uppercase *******/
    firstName= firstName.substring(0,1).toUpperCase() + firstName.substring(1, firstName.length).toLowerCase() + " (" + referredEmail + ")";
    signature= firstName + "<br>" + referredEmail;
    greeting = "Hi " + firstName + "!";
}

if (lastReferredfirstName == null || lastReferredfirstName == "" || lastReferredfirstName == " ") {
    lastReferredfirstName = ","; 
} else {
     /***** convert first letter of name to uppercase *******/
    lastReferredfirstName= " " + lastReferredfirstName.substring(0,1).toUpperCase() + lastReferredfirstName.substring(1, lastReferredfirstName.length).toLowerCase() + ","; 
}
}

/************************************************************************
End of STAF section
************************************************************************/

/********************************************
         CHECKING FOR AOL USERS
********************************************/
var isAOL     = false;
var gMailFlag = false;
if (user.attr ("eMail") != null) {
    isAOL = user.attr ("eMail").substring (
user.attr ("eMail").length - 8, 999) == "@aol.com";}

if (eMail.substring (eMail.length - 10) == "@gmail.com") {
      gMailFlag = true;
}
function anchor (url, label) {
    if (isAOL) {
        document.write ("<A HREF=\"" + url + "\">" + label + "</A>");}
    else {
        document.write (url);}}

if (isAOL) document.writeln ("<html><pre><font size=2 fase=Arial>");
POST--><!--POST if (isReferred) { POST-->Hello `lastReferredfirstName`

`firstName` thought you would like to see this special 
edition of the HP newsgram.
<!--POST if (referredNoteExists) { 
var lineText = lastReferredNote;
var x = 65;
if (lineText.length <= x ){
  document.write(lineText);
}
else {
  while (flag) {
    if (lineText.substring(x,(x+1)) == " ") {
      document.write(lineText.substring(0, x) + "\n");
      lineText = lineText.substring((x+1),lineText.length);
      if (lineText.length <= x) {
        document.write(lineText);
        flag = false;
      }
    }
    else {
      x = x - 1;
    }
  }
}
POST-->`signature`<!--POST } POST-->
This doesn't mean you will be getting messages from HP. But if you'd
like to sign up for useful and fun information like this, you can
subscribe here today. 
`anchor("http://h30189.www3.hp.com/signUp.jsp","- subscribe -")`

<!--POST } POST-->
Display graphics version
>> @HTML_PREVIEW_LINK 

========================================================
HP Newsgram
========================================================

`greeting`

Please help us improve the HP Newsgram by answering a few 
questions about your experience. Your responses will remain 
confidential and be used solely to evaluate the quality and
content. Just click on the link below:

Take Survey:
http://h30189.www3.hp.com/quicksurvey.jsp?surveyid=19

Thank you! 

HP Newsgram Team 

AWARD-WINNING HP SERVICE AND SUPPORT

Software & Driver Downloads
>> `anchor("http://www.hp.com/info/hho-ng-1093-supportDriverDownload","- go -")`
Support & Troubleshooting
>> `anchor("http://www.hp.com/info/hho-ng-1093-supportTroubleshoot","- go -")`
Chat support for HP products
>> `anchor("http://www.hp.com/info/hho-ng-1093-chat","- go -")`
Email Support in as fast as 1 hour
>> `anchor("http://www.hp.com/info/hho-ng-1093-oneHourSupport","- go -")`

-----------------------------------------------------------------
SHOP WHERE AND WHEN YOU WANT
-----------------------------------------------------------------
Call: 1-888-917-8097
Click: www.hpshopping.com
>> `anchor("http://www.shopping.hp.com/webapp/shopping/home.do?aoid=29653","- go -")`
Visit: over 15,000 retail locations
>> `anchor("http://www.hp.com/info/hho-ng-1093-retailLocations","- go -")`

-----------------------------------------------------------------
HP RESOURCES ON THE WEB
-----------------------------------------------------------------
Projects
>> `anchor("http://www.hp.com/info/hho-ng-qterly-survey-projects","- go -")`
Online classes
>> `anchor("http://www.hp.com/info/hho-ng-qterly-survey-online-classes","- go -")`
Support
>> `anchor("http://www.hp.com/info/hho-ng-qterly-survey-support","- go -")`
Printer supplies
>> `anchor("http://www.shopping.hp.com/webapp/shopping/store_access.do?template_type=printer_supp_acc&aoid=29652","- go -")`
Outlet
>> `anchor("http://www.shopping.hp.com/webapp/shopping/store_access.do?template_type=landing&landing=outlet_store&aoid=29654","- go -")`
Online shopping
>> `anchor("http://www.shopping.hp.com/webapp/shopping/home.do?aoid=29653","- go -")`

-----------------------------------------------------------------
HP NEWSGRAM OPTIONS
-----------------------------------------------------------------
<!--POST if(!isReferred) { POST-->Change your e-mail
>> `anchor("http://h30189.www3.hp.com/change-email.jsp","- go -")`
<!--POST } POST-->Privacy policy
>> `anchor("http://www.hp.com/country/us/en/privacy.html","- go -")`
<!--POST if(!isReferred) { POST-->
<!--POST if (subServices) { POST-->This mailing was sent to `eMail` because you
signed up to receive the HP Newsgram. This is an
ongoing mailing. To customize your HP Newsgram,
please visit:
<!--POST if (isAOL) { POST--><a href="http://subscription.support.hp.com/di/nc?c=`URLArg`">subscription.support.hp.com/di/nc?c=`URLArg`</a><!--POST } else { POST-->http://subscription.support.hp.com/di/nc?c=`URLArg`<!--POST } POST-->

If you no longer want to receive this mailing, 
please unsubscribe at:
>> `anchor("http://h30189.www3.hp.com/one-click.jsp","h30189.www3.hp.com/one-click.jsp")`

To unsubscribe from the HP Newsgram and other 
marketing-related communication from HP, reply 
with "UNSUBSCRIBE" as the subject line. 

HP is committed to respecting your privacy. 
For more information, visit:
>> `anchor("http://www.hp.com/country/us/en/privacy.html","hp.com/country/us/en/privacy.html")`
or contact us at HP Privacy Mailbox, 20555 SH 249, 
MS 040307, Houston, TX 77070. <!--POST } else if (prospect) { POST-->This mailing was sent to `eMail` because you 
signed up to receive the HP Newsgram. This is an ongoing 
mailing. To customize your HP Newsgram, please visit 
>> `anchor("http://h30189.www3.hp.com/modify_profile.jsp","h30189.www3.hp.com/modify_profile.jsp")`

If you no longer want to receive this mailing, 
please unsubscribe at 
>> `anchor("http://h30189.www3.hp.com/one-click.jsp","h30189.www3.hp.com/one-click.jsp")`

To unsubscribe from the HP Newsgram and other 
marketing-related communication from HP, reply 
with "UNSUBSCRIBE" as the subject line.

HP is committed to respecting your privacy. 
For more information, visit 
>> `anchor("http://www.hp.com/country/us/en/privacy.html","hp.com/country/us/en/privacy.html")`
or contact us at HP Privacy Mailbox, 20555 SH 249, 
MS 040307, Houston, TX 77070. <!--POST } else { POST-->This mailing was sent to `eMail` because you 
registered with HP or Compaq. This is an ongoing mailing. 
To customize your HP Newsgram, please visit 
>> `anchor("http://h30189.www3.hp.com/modify_profile.jsp","h30189.www3.hp.com/modify_profile.jsp")`

If you no longer want to receive this mailing,
please unsubscribe at 
>> `anchor("http://h30189.www3.hp.com/one-click.jsp","h30189.www3.hp.com/one-click.jsp")`

To unsubscribe from the HP Newsgram and other 
marketing-related communication from HP, reply
with "UNSUBSCRIBE" as the subject line. 

HP is committed to respecting your privacy.
For more information, visit 
>> `anchor("http://www.hp.com/country/us/en/privacy.html","hp.com/country/us/en/privacy.html")`
or contact us at HP Privacy Mailbox, 20555 SH 249, 
MS 040307, Houston, TX 77070.<!--POST } POST-->

To ensure you receive your HP Newsgram, please add 
Hewlett-Packard@us.newsgram.hp.com to your address book. 
Need help?
>> `anchor("http://h30189.www3.hp.com/add_address.jsp", "- Click here -")`<!--POST } POST-->

<!--POST if (isReferred) { POST-->HP Privacy Mailbox, 20555 SH 249, MS 040307, 
Houston, Texas 77070  ATTN: Member Services<!--POST } POST-->
<!--POST
/*******************************************************************************

AOL messages are terminated specially

*******************************************************************************/
if (isAOL) document.writeln ("</pre></html>");
POST-->