demo1 = function(_form){
  // Initialize static variables
  ibUserDS = "I am sure you are aware that it is an effective and proven remedy."
  ibNonUserDS = "I am not sure if you have tried ibuprofen, but it is an effective and proven remedy."

  paragraphs = ["The following is a fictitious letter for an equally fictitious ibuprofen-based painkiller called Tamepain. As an example of advanced personalization, the letter incorporates the data you supplied above in the form of dynamic substitutions of names, words and even phrases, all with the purpose of establishing a connection with the customer.",
                "Using this sort of variable content is certainly one of the powerful aspects of advanced personalization. It allows you to use your customer data to carefully craft and slant your copy to the known interests, tendencies, conditions and buying habits of your clients. However, as with anything, beware of using too much of a good thing. Consider the following paragraph, which exemplifies some of the things you want to avoid when using advanced personalization.",
                "There are two key problems here. First, aside from sounding repetitive, the overuse of the contact name is too familiar and will likely to turn the customer off. This can be an effective technique, so long as it is used sparingly, usually at parts of your copy where you want to recapture the customer’s attention.",
                "Second, the paragraph makes the mistake of telling the reader “we know this about you.” Again, this is far too familiar. You don’t alienate the customer customer by telling them that you have all this information about them. Rather, you want to use that information to craft copy which will get your customers to think: “Hey, I can relate to that.” The following paragraph communicates the same basic concepts as the previous paragraph, but in a much more subtle and refined way."];

  // Capture user variables
  userTitle = document.demoForm.title.options[document.demoForm.title.selectedIndex].value;
  userFirstName = document.demoForm.firstName.value;
  userLastName = document.demoForm.lastName.value;
  //userCompanyName = document.demoForm.companyName.value;

  if (userFirstName == "" && userLastName == ""){
    alert("Please enter a first or last name");
    return false;
  }
  painResponse = -1;
  for(i=0;i<document.demoForm.pain.length;i++){
    if(document.demoForm.pain[i].checked){
      painResponse = i;
    }
  }
  if (painResponse == -1){
    alert("Please select a commain type of pain"); 
    return false;
  }
  reliefResponse = -1;
  for(i=0;i<document.demoForm.relief.length;i++){
    if(document.demoForm.relief[i].checked){
      reliefResponse = i;
    }
  }
  if (reliefResponse == -1){
    alert("Please select a favorite pain relief"); 
    return false;
  }
  // Make changes

  var demoLetter = document.getElementById("demoLetter").innerHTML;
  demoLetter = demoLetter.toString();


  // Update LETTER DEAR LINE

  if (userFirstName != ""){
    demoLetter = demoLetter.replace(/\[DEAR_DS\]/, "Dear " + userFirstName +",");
  }
  else if (userLastName != ""){
    demoLetter = demoLetter.replace(/\[DEAR_DS\]/, "Dear " + userTitle + " " + userLastName + ",");
  }
  else{
    demoLetter = demoLetter.replace(/\[DEAR_DS\]/, "Dear Consumer,");
  }

  // Update LETTER ACHE TYPE

  if (painResponse == 1){
    demoLetter = demoLetter.replace(/\[PAIN_DS\]/, "backache");
  }
  else{
    demoLetter = demoLetter.replace(/\[PAIN_DS\]/, "headache");
  }

  if (reliefResponse == 0){
    demoLetter = demoLetter.replace(/\[RELIEF_DS\]/g, "acetaminophen");
  }
  else if(reliefResponse == 1){
    demoLetter = demoLetter.replace(/\[RELIEF_DS\]/g, "ibuprofen");
  }
  else if(reliefResponse == 2){
    demoLetter = demoLetter.replace(/\[RELIEF_DS\]/g, "ASA");
  }

  // Update LETTER DYNAMIC STRING

  if (reliefResponse == 1){
    demoLetter = demoLetter.replace(/\[IB_DS\]/, ibUserDS);
  }
  else{
    demoLetter = demoLetter.replace(/\[IB_DS\]/, ibNonUserDS);
  }

  // Update LETTER FIRST NAME

  if (userFirstName != ""){
    demoLetter = demoLetter.replace(/\[FNAME_DS\]/g, userFirstName);
  }
  else if (userLastName != ""){
    demoLetter = demoLetter.replace(/\[FNAME_DS\]/g, userTitle + " " + userLastName);
  }
  else{
    demoLetter = demoLetter.replace(/\[FNAME_DS\]/g, "In closing");
  }

  document.getElementById("demoLetterRES").innerHTML = demoLetter;


  badExample = document.getElementById("demoPersonalBad").innerHTML
  badExample = badExample.toString();

  if (userFirstName != ""){
    badExample = badExample.replace(/\[FNAME_DS\]/g, userFirstName);
  }
  else if (userLastName != ""){
    badExample = badExample.replace(/\[FNAME_DS\]/g, userTitle + " " + userLastName);
  }
  else{
    badExample = badExample.replace(/\[FNAME_DS\]/g, "");
  }

  if (painResponse == 1){
    badExample = badExample.replace(/\[PAINs_DS\]/g, "backaches");
  }
  else{
    badExample = badExample.replace(/\[PAINs_DS\]/g, "headaches");
  }

  if (reliefResponse == 0){
    badExample = badExample.replace(/\[RELIEF_DS\]/g, "acetaminophen");
  }
  else if(reliefResponse == 1){
    badExample = badExample.replace(/\[RELIEF_DS\]/g, "ibuprofen");
  }
  else if(reliefResponse == 2){
    badExample = badExample.replace(/\[RELIEF_DS\]/g, "ASA");
  }

  document.getElementById("demoPersonalBadRES").innerHTML = badExample;

  goodExample = document.getElementById("demoPersonalGood").innerHTML
  goodExample = goodExample.toString();

  if (userFirstName != ""){
    goodExample = goodExample.replace(/\[FNAME_DS\]/g, userFirstName);
  }
  else if (userLastName != ""){
    goodExample = goodExample.replace(/\[FNAME_DS\]/g, userTitle + " " + userLastName);
  }
  else{
    goodExample = goodExample.replace(/\[FNAME_DS\]/g, "");
  }

  if (painResponse == 1){
    goodExample = goodExample.replace(/\[PAIN_DS\]/g, "backache");
    goodExample = goodExample.replace(/\[PAINs_DS\]/g, "backaches");
  }
  else{
    goodExample = goodExample.replace(/\[PAIN_DS\]/g, "headache");
    goodExample = goodExample.replace(/\[PAINs_DS\]/g, "headaches");
  }

  if (reliefResponse == 0){
    goodExample = goodExample.replace(/\[RELIEF_DS\]/g, "acetaminophen");
  }
  else if(reliefResponse == 1){
    goodExample = goodExample.replace(/\[RELIEF_DS\]/g, "ibuprofen");
  }
  else if(reliefResponse == 2){
    goodExample = goodExample.replace(/\[RELIEF_DS\]/g, "ASA");
  }


  document.getElementById("demoPersonalGoodRES").innerHTML = goodExample;

  // Display Results

  //slidePop(document.getElementById("demoResults").innerHTML,"Variable Copy Sample",500);
  document.getElementById("dialog").innerHTML = document.getElementById("demoResults").innerHTML;
  $.fn.colorbox({width:"650px", inline:true, href:"#dialog"});
  //document.getElementById("demoResults").style.display = "block";
}

demo2 = function(){
  userTitle = document.demoForm.title.options[document.demoForm.title.selectedIndex].value;
  userFirstName = document.demoForm.firstName.value;
  userLastName = document.demoForm.lastName.value;
  //userBirthDate = document.demoForm.birthDate.value  
  if(userFirstName != ""){
     username = userFirstName;
  }
  else if(userLastName != ""){
     username = userTitle + " " + userLastName;
  }
  else{
     username = "";
  }
  username = escape(username);
  //birthDate = new Date(userBirthDate);
  tempHTML = "<div style=\"width: 638px; height: 413px; background: #ffffff url(http://www.hiland.com/files/4112/6989/3880/loader-white.gif) center no-repeat;\"><div style=\"width: 638px; height: 413px; background: url(http://www.hiland.com/cgi-bin/apdemos.pl?name=" + username + "&month=" + document.demoForm.dateMonth.options[document.demoForm.dateMonth.selectedIndex].value + ") center no-repeat;\"></div></div>";
  tempHTML += "<p>There are three variable portions of this ad, which we would like to highlight and consider in some detail.</p><h3>1. The Birthstone - Image</h3><ul><li>unique, painted image which varies according the recipient's birth month</li><li>creates an immediate visual connection with the recipient.</li></ul><h3>2. The Birthstone - Name</h3><ul><li>variably inserted into the card's copy.</li><li>reinforces the connection first established with variable birthstone image.</li></ul><h3>3. Recipient Name</h3><ul><li>if a name exists for the recipient, then one form of the copy is used, with the name inserted variably. </li><li>if a name does not exist, an alternate, generic form of the copy is used instead.</li></ul><p>So, in this simple example, we use two simple pieces of data to control the three variable areas of the postcard, all with the intention of establishing a closer connection with the recipient.</p>";
  document.getElementById("dialog").innerHTML = tempHTML;
  $.fn.colorbox({width:"670px", inline:true, href:"#dialog"});
}
