// JavaScript Document
/* ********************************************************************
* Buffered Text-fade Effect - v3.0.1
* - Copyright 2008 - Licenced for free distribution under the BSDL
*   - http://www.opensource.org/licenses/bsd-license.php
*
*   This program is licenced under the BSDL and may be distributed far
* and wide, anywhere on the planet and beyond (maybe!)  If you happen
* to get a kick out of this script, please drop me a note at:
* wyvern@greywyvern.com and tell me where you gave it a good home and
* plenty of bytes to eat, hmmm? :)  I'd be eternally grateful.
*
* Description:
*   A javascript object which allows you to direct text fades within an
* HTML page.  Fades received before the previous fade has completed are
* queued rather than displayed immediately.  This keeps all fade
* animations smooth.
*
* Changelog:
*  3.0.1 - Changed timeout values to 10ms to keep Opera from queuing
*
*  3.0  - Buffer for each fadeObject is stored separately for stability
*         and speed.
*       - Major structure changes.  Different arguments
*
* Support:
*   Opera   - Yes
*   IE 6    - Yes
*   IE 5.5  - Yes
*   IE 5.01 - Fails
*   Firefox - Yes
*   Safari  - Yes
*
***********************************************************************
* I) Setting Up
*
*   Copy the javascript from this page into an external .js file or
* into the <script> tag of your own HTML page.  You only need the code
* between the "Begin" and "End" lines.  This shouldn't be that
* difficult, but you wouldn't believe the kind of mail I get about
* this!  Just do it, okay?  Jeepers.
*
*   a) The Fade Object
*   After that's done we need to create a fade object.  We do this by
* creating a fadeObj using a number of arguments.  We'll call our new
* fadeObj object "fader".
*
* var fader = new fadeObj('fade0', 'dddddd', '000000', 20, 20);
*
*   The first argument ('fade0') is the id of the HTML tag which will
* be displaying the fading effect.  Usually you'll want to apply some
* height and width styles to this element, since it starts out with no
* text by default and will probably be collapsed.  You don't want it
* jumping around when the script writes new text to it.
*
*   The next two values are hexidecimal colour values, WITHOUT the
* preceding #.  The first value is the starting colour, or the colour
* the text is before it fades in.  The second value is the ending
* colour, or the colour the text will be when it finishes fading in.
*
*   The last two values are two integers which indicate the number of
* "steps" the script must take to complete a fade-in and a fade-out
* respectively.  With a value of 20 like in the example above, there
* will be 20 colour changes before the text is fully faded-in or faded-
* out.  The lower these numbers, the faster the fade will be.
*
*   b) The Fade Messages
*   After setting up our fade object, all we need to do now is write
* out all of the messages which will be displayed in this element.
* Remember that this script only affects text of a single colour.
* Images and multi-coloured text won't work.
*
*   Messages are included in the msg[] array.  Simply assign each
* message a number, like so:
*
* fader.msg[1] = "Fade text, message one.";
*
*   Each fade object can have as many messages as you want, and be in
* any numerical order.  You can even skip numbers, but note that if you
* use the fade() method pointed at a message number which doesn't
* exist, you will get an error.
*
* The msg[] array should start at element [1].  If you would like a
* default message to appear if there are no more fade-in events in the
* queue, assign the default message to element [0].
*
***********************************************************************
* II) The Events
*
*   Fades can be triggered by any DOM event, but most likely you'll be
* using mouseover and mouseout events.
*
*   To trigger a fade, you use the fade() method to add a fade action
* to the queue.  The reason we use a queue, is so that you can add this
* fade, even if another fade is already happening.  The fade() method
* takes two important arguments:
*
* Example: onmouseover="fader.fade(1, true);"
*
*   In this example we are still referencing fadeObj object "fader".
*
*   The first argument is the message this command refers to.  This one
* has been associated with msg[1] of "fader".
*
*   The second argument indicates the direction of the fade.
*     -> true = fade in, false = fade out.
*
***********************************************************************
* III) Tips
*
*   - All the text in each msg[] variable MUST be on one line in the
* code.  That means this:
*
*   fader.msg[1] = "Fader zero,
* message one";
*
*   - To include quotation marks (") in your messages, make sure to
* escape them with backslashes, like so: "\"Hello,\" he said."
*
* ... is not allowed!  The text should wrap automatically when it's
* displayed on your HTML page, but you can force line breaks with a
* <br> tag.  (If you have some Javascript experience you'll know how to
* get around this).
*
*   - If you're placing the fading text on a background image, make
* the starting colour an average sample of the background instead of
* just black or white.  This will enhance the "disappearing" effect.
*
*   - The script can only fade text, but can accept non-graphical HTML
* tags in which CSS text color is inherited, such as <p>, <table> (no
* borders), <strong> and <em>.  Use these tags to add structure and a
* simple text layout to your fades.
*
*   - To have links fade along with with the surrounding text, apply
* the CSS style: color:inherit !important; to all links within the fade
* text messages.
*
***********************************************************************
* That's it!  Isn't that amazing!?! :)
*
* If you have any problems with this script, don't hesitate to email me
* at wyvern@greywyvern.com and I'll be happy to answer your matter-of-
* life-and-death questions!  Cheers!
******************************************************************** */


var fader = new fadeObject('fade1', '9A483B', 'ffffff', 100, 150);
function fadeObject(id, c1, c2, s1, s2) {
  var self = this;
  this.id      = id;
  this.elem    = false;
  this.colour  = {
    stt: [parseInt(c1.substr(0, 2), 16), parseInt(c1.substr(2, 2), 16), parseInt(c1.substr(4, 2), 16)],
    end: [parseInt(c2.substr(0, 2), 16), parseInt(c2.substr(2, 2), 16), parseInt(c2.substr(4, 2), 16)],
    now: [parseInt(c1.substr(0, 2), 16), parseInt(c1.substr(2, 2), 16), parseInt(c1.substr(4, 2), 16)]
  };
  this.steps   = [s1, s2];
  this.dir     = false;
  this.active  = false;
  this.queue   = [];
  this.msg     = [];
  this.message = 0;
  function d2h(num) {
    num = Math.round(num);
    return ((num < 16) ? "0" : "") + num.toString(16);
  }
  this.fade = function(message, direction) {
    this.elem = this.elem || document.getElementById(this.id);
    this.queue.push([message, direction]);
    for (var x = 0; x < this.queue.length; x++) {
      for (var y = x + 1; y < this.queue.length; y++) {
        if (this.queue[x][0] == this.queue[y][0] && this.queue[x][1] != this.queue[y][1]) {
          this.queue.splice(x, 1);
          this.queue.splice(y - 1, 1);
        }
      }
    }
    if (!this.active) setTimeout(function() { self.fadeLoop(); }, 10);
  };
  this.fadeLoop = function() {
    if (!this.active && this.queue.length) {
      if (this.dir && this.message != this.queue[0][0]) this.queue.unshift([this.message, false]);
      var msg = this.queue.shift();
      if (this.msg[msg[0]]) {
        this.active = true;
        this.elem.innerHTML = this.msg[this.message = msg[0]];
        this.dir = msg[1];
      }
    }
    if (this.dir) {
      var c1 = this.colour.stt, c2 = this.colour.end, s = this.steps[0];
    } else var c1 = this.colour.end, c2 = this.colour.stt, s = this.steps[1];
    for (var x = 0, cnow = "", inc = 0; x < 3; x++) {
      this.colour.now[x] += inc = (c2[x] - c1[x]) / s;
      cnow += this.colour.now[x] = (inc < 0) ? Math.max(this.colour.now[x], c2[x]) : Math.min(this.colour.now[x], c2[x]);
    } this.elem.style.color = "#" + d2h(this.colour.now[0]) + d2h(this.colour.now[1]) + d2h(this.colour.now[2]);
    if (cnow == c2.join("")) {
      this.active = false;
      if (!this.queue.length) {
        if (!this.dir) {
          if (this.msg[0]) {
            this.queue.push([0, true]);
            setTimeout(function() { self.fadeLoop(); }, 10);
          } else this.elem.innerHTML = "&nbsp;";
        }
      } else setTimeout(function() { self.fadeLoop(); }, 10);
    } else setTimeout(function() { self.fadeLoop(); }, 10);
  };
  if (window.addEventListener) {
    window.addEventListener('load', function() { self.fade(0, true); }, false); 
  } else if (window.attachEvent)
    window.attachEvent('onload', function() { self.fade(0, true); });
}


/* *****
 * The code below describes how to make a throbbing or automatic fade
 * sequence of messages.  It is important to note that this function is
 * NOT part of the Buffered Text-Fade Effect, but merely an example of
 * how it can be used.  In this example, the throb() function controls
 * the commands which are sent to the fade engine; it is called
 * repeatedly at set time intervals rather than using mouseover events
 * as triggers.
 *
 * Notes:
 * - A global array "hash" is used to keep track of where each
 *   animation is currently in the sequence.
 * - The list of messages defined in the fader *must* start at one (1)
 *   and count upwards without skipping any integers.
 * - The third line of the throb() function controls how fast
 *   commands get sent to the fade engine.  It waits only 100 milli-
 *   seconds when fading out, but 5000 milliseconds (5 seconds) when
 *   fading in; this means the message will remain visible for about 5
 *   seconds before fading out again.
 *
 * Other types of fade animation are possible simply by designing
 * different ways to control the fade-ins and fade-outs!
 */

var hash = new Array();
function throb(item) {

  // If the hash array does not have an entry for this item, initialise it at 2
  if (!hash[item]) hash[item] = 1;

  // Send a fade command, using the hash array to tell us what parameters we should use
  fader[item].fade(Math.floor(hash[item] / 2), !(hash[item] % 2));

  // Call this function again for this same item after a certain amount of time
  setTimeout(function() { throb(item); }, (hash[item] % 2) ? 100 : 15000);

  // If we have exceeded the number of messages in this fader, start over again at 2
  if (++hash[item] > fader[item].msg.length * 2 - 1) hash[item] = 0;
}

fader[0] = new fadeObject('fade1', '9A483B', 'ffffff', 100, 150);
fader[0].msg[0] = "<span style=\"font-weight:bold;\">Our customers love Hoof-Alive!</span><br /><br /> No matter the application, whether hoof treatments, finger nail treatments, cracked  feet, chapped lips, or even applied to dog's pads, Hoof-Alive does a superior job. <br/><br/>  Here's what our customers are saying.";
fader[0].msg[1] = " <span style=\"font-weight:bold;\">T.H. - Dennison, MN:</span><br /><br />\"Hi! I own a Hair & Nail Salon in Minnesota.  While on vacation in Cody, I bought some Hoof Alive.  I LOVE IT!!!  I was wondering if I could possibly carry the smaller sizes in my salon to retail to my customers?\"";
fader[0].msg[2] = " <span style=\"font-weight:bold;\">J.O. &nbsp;(Handler for --Explosive-- Guns&amp; Ammo Detection Dogs):</span><br />\"I have two Black Labs three years old, working dogs. We train in and under all types of conditions six days a week. We live in the mountains and the weather and ground conditions are very harsh and hard on K9 foot pads. I have tried many different products with little success....\"";
fader[0].msg[3] = "\"...Hoof Alive was suggested by the sales clerk at our Co-Op. After one (1) application I noted a dramatic difference, after one week and three treatments the cracks were gone and the pads are soft and flexible \".... ";
fader[0].msg[4] = "\"...The vet tech that does acupressure on the dogs once a month, could not believe the beautiful condition of the pads compared to the month before, and is now getting Hoof Alive for her dogs. Thanks for a great product. These dogs get only the best products and treatment.\"";
fader[0].msg[5] = "<span style=\"font-weight:bold;\">L.D.H - Baton Rouge, LA:</span><br/><br/>\" I met a lady yesterday from Lafayette, Louisiana, who told me about your product and how wonderful it is.\"";
fader[0].msg[6] = "<span style=\"font-weight:bold;\">Cynthia - Dana Point, CA:</span><br/><br/>\"My new farrier recommended your product to me. I hope your product is as good as the hype, because my horse's feet and my fingernails could do with some major help.\"";
fader[0].msg[7] = "<span style=\"font-weight:bold;\">L.N. - Lakewood, NJ:</span><br/><br/>\"I am a user of the hoofalive and love the stuff.  Many friends loved it when they have tried mine. I would like to become a distributor.\"";
fader[0].msg[8] = "<span style=\"font-weight:bold;\">M.W. -  Burlington, NJ:</span><br/><br/>\"I purchased a 3/4-ounce container of Hoof-Alive at a tack and feed store in Cody, WY while on vacation this past summer, and absolutely love it, and would like to purchase some more.\"";
fader[0].msg[9] = "<span style=\"font-weight:bold;\">T.R. -  Amarillo, TX:</span><br/><br/>Would you mind faxing a price sheet with a full list of what you carry.  We will place an order this week!  We are so excited!\"";
fader[0].msg[10] = "<span style=\"font-weight:bold;\">L.J.F.-  Washington,DC:</span><br/><br/>\"Dear Hoof Alive, I am not a horse, cow, sheep, pig or bison.  However, your hoof alive has worked wonders on my nails and those of my roommate.  My nails routinely crack and split every winter and I cannot grow them to any length due to the constant splitting. My roommate can't grow her nails period.  ...\"";
fader[0].msg[11] = "\"...Her mother gave her a container of hoof alive on Christmas. We have both been using it ever since.  I now have 10 long nails suitable for painting. My roommate now has nails.  I also passed on the name to a fellow church choir member. Her nails have been growing wonderfully ever since....\"";
fader[0].msg[12] = "\"...Have you guys ever thought of marketing your little saddle sore cure to women? Thanks for the great product. If I ever own a horse or any other hooved creature I'll be sure to use your product. In the mean time - I'll continue to market your product to one badly manicured woman at a time.\"";
/*fader[0].msg[13] = "<span style=\"font-weight:bold;\">W.H. - Cleveland, TN:</span><br />\"I found your product at………Thank you for your help and excellent product, love the product!\"";
fader[0].msg[14] = "<span style=\"font-weight:bold;\">L.K. Denver, CO:</span><br />\"Thank you for your reply. As you suspected, my dog is just fine. Thank you for making a safe, high quality product.\"";
fader[0].msg[15] = "<span style=\"font-weight:bold;\">M.F. - Dodge City, KS:</span><br/>\"I have a friend who swears by the Hoof Alive dressing. Can I order a jar directly from you?\"";
fader[0].msg[16] = "<span style=\"font-weight:bold;\">S.A. - Phoenix, AZ:</span><br/>\"Thanks for your help.  It is great for my fingernails!!!\"";
fader[0].msg[17] = "<span style=\"font-weight:bold;\">E.R. - Nashville, TN:</span><br/>\"My boyfriend introduced \"Hoof Alive\" to me a  couple of years ago, to help my fingernails. It's incredible. I need more.\"";
fader[0].msg[18] = "<span style=\"font-weight:bold;\">D.B. -  Peculiar, Missouri:</span><br/>\"I was in Colorado this winter and I picked up a bottle of hoof alive to see if it would help my brittle nails. I live in Missouri and we have a sod farm; the dirt just dries out my nails so bad. But to my surprise...\"";
fader[0].msg[19] = "\"...every since using hoof alive my nails are growing and are stronger than ever. My daughter is now using hoof alive as well and her nails are 100% stronger as well. Thank you hoof alive for the wonderful product.\"";
fader[0].msg[20] = "<span style=\"font-weight:bold;\">M.F. - Yucca Valley, CA:</span><br/>\"Hi, I've used Hoof-Alive on my feet and hands for years as I live in an extremely dry climate. It's without a doubt the best product I've ever used. I need to order another quart and don't see where to order on your home page. Please send the information and price of 1 quart so I may order soon. I'm just about out of the product.  Thanks so much! M.F.\"";
fader[0].msg[21] = "<span style=\"font-weight:bold;\">J.H. -  Bastrop, Tx</span><br/>\"I am interested in becoming a Hoof-Alive dealer. I have used your product with great success.\"";
fader[0].msg[22] = "<span style=\"font-weight:bold;\">J.M. - Stockton,CA:</span><br/>\"Hi, A friend told me just today about your product. He is an\"old cowboy\" and  swears by your hoof alive!\"";
fader[0].msg[23] = "<span style=\"font-weight:bold;\">(no name):</span><br />I was at a trade show with one of your repres  He let me have a sample of the \"Hoof Alive\" for my horses and a lip balm. I am NOW out of the lip balm and I am so impressed with it and the \"hoof Alive\" for my horses that I would like to try the product for my nails.\"";
fader[0].msg[24] = "<span style=\"font-weight:bold;\">M. Venice Beach, CA:</span><br/>\"My girlfriend and I have 20 nails, 3 dogs and a horse that love this stuff.\"";
fader[0].msg[25] = "<span style=\"font-weight:bold;\">(No Name):</span><br/>\"We are young, small, but growing pet health supply company. After many years of dealing with dogs, cats, horses and a whole myriad of other types of animal life, we have come to believe in a more holistic approach to animal health.  The HoofAlive product has proven to be a product we would like to handle.  We like the ingredients, and have found it to be beneficial in treatment of some types of surface scars on our horses.\"";
fader[0].msg[26] = "<span style=\"font-weight:bold;\">D.B. - Fort Smith, AR:</span><br/>\"My husband is a farrier. I bought your product in Fort Smith, AR. I can't believe how good this product is. I am interested in becoming a dealer. Could you please send me information on how to become a dealer or where I can purchase your product in my area. Thank you.\"";
fader[0].msg[27] = "<span style=\"font-weight:bold;\">B.J.:</span><br/>\"…purchased a 4oz jar of the product and tried it on my hands and I can't believe how it works. Oh, by the way, we used to live in Rapid City SD. Thank you for this product.\"";
fader[0].msg[28] = "<span style=\"font-weight:bold;\">J.Y.:</span><br/>\"Sir:  My manicurist suggested I use your product for myself because of the condition of my hands.\"";
fader[0].msg[29] = "<span style=\"font-weight:bold;\">K.W. - Holdenville, OK:</span><br/>\"My farrier requested I use your product on my horses' hoof that is damaged and dried. I am also a tack dealer with a physical store. I would like to speak with you about your product 'Hoof Alive' Thank You\"";
fader[0].msg[30] = "<span style=\"font-weight:bold;\">L.:</span><br/>\"Just thought I'd send you this picture of my boy Jack and I. He loves Hoof Alive.\"";
fader[0].msg[31] = "<span style=\"font-weight:bold;\">J.S - Alvin, TX:</span><br />STORE OWNER - \"We put Hoof-Alive on our horses every day after we wash them down following riding. 
It stays on and works great.\"";
fader[0].msg[32] = "<span style=\"font-weight:bold;\">M.D. - Parker,CO:</span><br />STORE OWNER - \"Hoof-Alive is one of the best sellers I have in the store.  Basically I sell it to people who have horse issues, but also to people with fingernail and cuticle problems. I sell it to my farrier because it will heal a hangnail in about 2 days. I\'ve never had a product that would do that before. My daughter is a nurse, and she uses it on her feet and hands. She washes her hands about 20 times a day and Hoof-Alive keeps her hands from being chapped\"";
fader[0].msg[33] = "<span style=\"font-weight:bold;\">J.B, Golden, CO:</span><br />STORE MANAGER - \"We've been selling Hoof-Alive for at least 10 years - maybe longer. I recommend it to anybody who is having any kind of hoof problems at all, whether dry, cracked hooves or needing hoof growth etc. I think it's the best thing on the market. It's good for anything from hoof problems to saddle sores, to people with cracked heels or fingernail problems. It's just a great product. I like it because it's all natural. Good product!!!\"";
fader[0].msg[34] = "<span style=\"font-weight:bold;\">J.B. - Tyler, TX:</span><br />STORE MANAGER - \"The reason Hoof-Alive is the #1 hoof dressing on the market is because it is all-natural ingredients, it does work - I use it on my horse. It will seal cracks.  It's completely harmless for people or animals!!! And it does work well; I've been using it for about a year and a half. I'll put this on about once a week.  When I first started using it my horse had a crack in his front hooves, I used it for about 6 or 7 days in a row, then I cut back to about twice a week and gradually got down to just once a week.\"";
fader[0].msg[35] = "<span style=\"font-weight:bold;\">K.D. - Denver, CO:</span><br/>\"Would you please let me know where I can get Hoof Alive in the Denver Metro area? My dermatologist recommends using it on my dry heels. Thanks - I look forward to hearing from you!\"";
fader[0].msg[36] = "<span style=\"font-weight:bold;\">A.N.M. - Ft Morgan, CO:</span><br/>\"Since 1991 I have been commending your fine products to anyone with even a passing interest in horses and their welfare.  Your service as a farrier certainly brought comfort and healing to those wonderful animal and their stewards, and now your fine product does even more for them.\"";
fader[0].msg[37] = "<span style=\"font-weight:bold;\">T.Y.R. Dubois, WY:</span><br/>\"Thank you for introducing Hoof-Alive to my mother ______ at one of the \"Miss America\" pageants. She then introduced it to me.  I was sold on it from day one.  I use Hoof-Alive in my profession as a cosmetologist/massage therapists. I and my clients now use Hoof-Alive on fingernails; tired, cracked feet; chapped lips; etc. etc.  Thanks Hoof-Alive\"";
fader[0].msg[38] = "<span style=\"font-weight:bold;\">B.M. - Wills Point, TX:</span><br/>\"… I am very glad a gentleman recommended using Hoof-Alive on wounds. I never would have thought of that. I am amazed at how quickly large scars reduce in size, become soft and start covering over.  I may use it on hooves next. You should emphasize more what the oils can do on wounds and scars... \"";
fader[0].msg[39] = "<span style=\"font-weight:bold;\">M.C. - Harvey, LA: </span><br/>\"Dear Sirs, Almost a year ago a friend of mine told me about Hoof-Alive. I used it on my hands and nails with wonderful results. You see, I am a neo-natal nurse and in by business, we wash our hands about every 5-15 minutes!  I can't tell you how many products I have tried over the last 19 years, but to no avail….even dermatologist recommended prescriptions.  Your product, Hoof-Alive, is the only one that has ever really worked.  I'm convinced there is no better product out there.  With sincere thanks,\"";
fader[0].msg[40] = "<span style=\"font-weight:bold;\">E.B. - Casper, WY: </span><br/>\"I used Hoof-Alive on my son's face where a dog bit him.  It softened the skin and kept it soft all day and even after a bath. I am convinced it works.  I like it!\"";
fader[0].msg[41] = "<span style=\"font-weight:bold;\">G.S.W. - Wheat Ridge, CO: </span><br/>\"W…… is a precision horse riding organization based in Colorado.  We are kids 9 to 18 years old. We have three horses and we have used Hoof-Alive for two years now.  We like what it does for their feet.  I would like to help you with your advertising.\"";
fader[0].msg[42] = "<span style=\"font-weight:bold;\">D.E. - Worden, MT: </span><br/>\"My horse's feet have to be kept in the best of condition to be able to withstand the wear and tear of the Rodeo arena.  Hoof-Alive, I have found, is by far the best product on the market today.  It helps keep my horse's feet pliable and helps prevent cracking.\"";
fader[0].msg[43] = "<span style=\"font-weight:bold;\">S.M. - Birmingham, Alabama:</span><br/>\"Just wanted to say your product is simply the best on the market!!! Nothing even comes close to what Hoof Alive does!!! Thanks for an amazing product!\"";
fader[0].msg[44] = "<span style=\"font-weight:bold;\">D.B. -  :</span><br />My boyfriend introduced \"Hoof Alive\" to me a couple of years ago, to help my fingernails. I am almost out of the product, and wondered if you furnish any of the Nashville, TN dealers/stores with your Hoof Alive products.\"";
fader[0].msg[45] = "<span style=\"font-weight:bold;\">L.M.:</span><br/>\"Hi, I live in northeastern CA, between Reno Nevada and Susanville.  Can you tell me where the closest place to buy is.  This is the best product made.  Thanks!\"";
*/
// Start this fader
setTimeout(function() { throb(0); },  15000);

