var Testimonial = {
    testimonials : null,
    page : null,
    output : null,
    initialized : false,

    initialize : function() {
        if (!this.initialized) {
            this.page = $F('pageOn');
            this.output = $('testimonial');
            this.testimonials = {
            'allergic-rhinitis-including-hay-fever' : null,
            'menopause' : null,
            'depression' : null,
            'anxiety' : null,
            'back-pain' : [
            {
                type: '<h3>Back Pain &amp; Shoulder Pain</h3>',
                testimonial: '<p><em>"After weeks of taking ibuprofen and icing for chronic pain in my wrist, elbow, and shoulder with no improvement I thought I\'d give acupuncture a chance. Amazingly after a few visits I got full mobility back in my wrist, no more pain, and big improvements in my elbow and shoulder. Ted also recommended two herbal tinctures which don\'t taste great but I\'ve noticed improved energy and immunity (I was always getting sick). I\'m open-minded about alternative medicine but skeptical as well. Ted made me a believer."<em></p>',
                author: '<p>- Noelle G., Cupertino</p>'
            },
            {
                type: '<h3>Chronic Back Pain</h3>',
                testimonial: '<p><em>"I have seen Ted multiple times and he has helped me with my back problem. I had back problems for the past 15 years due to sports injuries and stress - and Ted has really reduced my pain tremendously. He is very knowledgable and committed to his patients."<em></p>',
                author: '<p>- Michael  J., Menlo Park</p>'
            },
            {
                type: '<h3>Low Back Pain & Sciatica</h3>',
                testimonial: '<p><em>"I can recommend Ted Ray as an acupuncturist based on firsthand experience with him. I am not new to acupuncture. I embrace herbs and many types of complementary medicine practices, especially for any kind of chronic condition. I went to Ted with an unusual and persistent back pain. It moved around a bit and was related to a block in my energy. Prior to seeing Ted, my chiropractor\'s assistance seemed to make the problem worse. (It was not a sports injury!) Ted\'s efforts had an immediate positive effect. It took a few treatments to really knock out the problem. After two months of frustration and suffering, a few visits with Ted and I was back on track, able to travel to the East Coast for a long holidays. Ted is not only skilled, he is good natured and personable. I would not hesitate to refer my friends."<em></p>',
                author: '<p>- Judy W., Mountain View</p>'
            },
            {
                type: '<h3>Chronic Back Pain</h3>',
                testimonial: '<p><em>"I came to Ted Ray with lower back pain that radiated down both legs.  It had curtailed my activities for about a year.  I have to admit I was a skeptic who knew very little about acupuncture, but he quickly made me a believer.  His treatments have reduced my pain to almost non-existent and I\'m happily back to hiking, walking and working out.  He is a gentle, patient, caring person who puts you at ease as he inserts those thin little needles.  His treatments are so relaxing it\'s not unusual for me to doze off during a session."<em></p>',
                author: '<p>- Beth M., Mountain View</p>'
            },
            {
                type: '<h3>Back Pain-Immediate Relief</h3>',
                testimonial: '<p><em>"I have known Ted for several years. He is extremely competent and passionate about what he does. I recently had some back pain and had a tennis tournament to play in on the same day. I saw him at around 11AM and played pain free later on that day. Can\'t do better than that. Great job Ted!"<em></p>',
                author: '<p>- Jim E., Redwood City</p>'
            }
            ],
            'acid-reflux' : null,
            'immune-system' : [{
                type: '<h3>Immune System Problems and Stress</h3>',
                testimonial: '<p><em>"Four months ago I began to visit Peninsula Acupuncture for emotional stress, insomnia, and a battered immune system brought on by years of stress in the software and advertising industries. After routine acupuncture and herbal treatments with Ted Ray, I feel mentally and physically balanced. During a recent product launch, I found myself to be in great physical and emotional health despite long hours and demanding deadlines."</em></p>',
                author: '<p>- Mark S., Palo Alto</p>'
            }],
            'headaches' : [
            {
                type: '<h3>Migraine Headaches & Sciatica</h3>',
                testimonial: '<p><em>"My wife saw Ted when she was suffering from migraines in two week intervals. She saw a quick improvement and after treatment she went five months without a migraine. I saw Ted on a Monday with a pinched nerve that had kept me off my feet through the weekend. On Tuesday I was at 100% mobility. These things are great, but I believe the best thing about Ted is his ability to make a western person such as myself comfortable with eastern medicine. I would not hesitate to give Ted the highest recommendation."</em></p>',
                author: '<p>- Bob  D.,  Mountain View</p>'
            },
            {
                type: '<h3>Migraine Headaches</h3>',
                testimonial: '<p><em>"Ted combines western medicine with acupuncture, as well as having knowledge of herbal remedies. If migraine is your issue, then go to Ted."<em></p>',
                author: '<p>- Ginny W., Palo Alto</p>'
            }
            ],
            'jet-lag' : null,
            'bells-palsy' : [
            {
                type: '<h3>Bell\'s Palsy</h3>',
                testimonial: '<p><em>"On New Years Eve, I came down with Bell\'s Palsy. My wife freaked - she thought I was having a stroke (so did the hospital emergency room).  My regular doctor treated my with viral medication and steroids. After 10 days, I decided to go to Ted. After Ted\'s first treatment I had feeling in the corner of my mouth and with each treatment healing progressed further. From everything that I read, my understanding was that there is nothing that can be done to help the recovery of Bell\'s Palsy except time.  I firmly believe that my time was shortened considerably by the treatments that I received from Ted."<em></p>',
                author: '<p>- Kenn C., Los Gatos</p>'
            },
            {
                type: '<h3>Bell\'s Palsy</h3>',
                testimonial: '<p><em>"When I was diagnosed with Bell\'s Palsy I was told it could take up to 6 months to recover. The doctors said not much could be done.Then I heard that Ted Ray had treated a co-worker for the same ailment. Ted was very knowledgeable regarding this virus, and assured me that he could speed up my recovery time. Not only did Ted help ease my concerns, but his acupuncture treatments and herbal remedies resolved all my Bells Palsy symptoms within 2 weeks. I have been going to Ted for regular acupuncture treatments ever since, and highly recommend him to all my friends and family!"<em></p>',
                author: '<p>- Chris R., San Jose</p>'
            }
            ],
            'misc' : [
            {
                type: '<h3>Stiff Neck</h3>',
                testimonial: '<p><em>"I first med Ted after a car accident and wasn\'t sure what to expect from acupuncture.  He explained the process and treatment methods. I was pleased to get such good results in the range of motion from my stiff neck. The needle treatments were painless and greatly reduced my aches. I have recommended several friends who have had similar results."<em></p>',
                author: '<p>- Pat R., Los Altos </p>'
            },
            {
                type: '<h3>Nerve Damage</h3>',
                testimonial: '<p><em>"I first saw Ted after a surgical procedure to relieve my leg pain left me with nerve damage. My pain actually became worse and it woke up on a nightly basis. After a series of treatments with Ted, my pain was almost completely resolved. It\'s been six months since my last visit and I am completely pain free. Thank you!"<em></p>',
                author: '<p>- Pat. P., Los Altos Hills</p>'
            },
            {
                type: '<h3>Great Experience!</h3>',
                testimonial: '<p><em>"Ted is a warm, caring healer as well as a knowledgeable professional.  My treatment was a truly pleasurable experience and I would certainly return for other ailments.  I did send a good friend and she also had a positive experience."<em></p>',
                author: '<p>- Kristin S., Los Altos</p>'
            },
            {
                type: '<h3>Chronic Leg Pain</h3>',
                testimonial: '<p><em>"When I first started seeing Ted, my chronic leg pain prevented me from walking more than an hour, I couldn\'t play with my 7-yr. old son, and just 9 holes of golf would wipe me out for a day or two. I went to several doctors including a neurologist, pain specialist, endocrinologist, and rheumatologist. In all cases, the blood work came back normal. I tried several medications to no avail.</p><p>After weekly acupuncture treatments and herbs for 1 month, I started to see improvement. After 3 months, I am now playing with my son, and skiing every other weekend pain-free."<em></p>',
                author: '<p>- Mike J., Los Gatos</p>'
            },
            {
                type: '<h3>Insomnia</h3>',
                testimonial: '<p><em>"When I told a friend I was having difficulty sleeping and was repeatedly getting sick, she said that Ted had helped her through the difficulties of menopause.  She told me that Ted is a healer, and she is right. One of my favorite things about Ted was that he listened – both to my pulse and to me. I felt safe in his office, I felt nurtured, and, most importantly, I felt better."<em></p>',
                author: '<p>- Anne H., Los Gatos</p>'
            },
            {
                type: '<h3>Repetetive Stress Injury</h3>',
                testimonial: '<p><em>"I am a photographer and spend many hours a day carrying my camera. I began experiencing sharp stabbing pain in my arm whenever I would pick up the camera. The anticipation of the pain whenever I would reach for my camera and thought of having to live with this, had me looking for a solution.</p><p>I had never been to an acupuncturist and was very nervous, but Ted\'s professional and warm style put me at ease and before you know it I was laying on the table with needles in my arm. </p><p>The amazing part is that after only two sessions here I am 2 years later pain free."<em></p>',
                author: '<p>- Jeanne D., Menlo Park</p>'
            },
            {
                type: '<h3>Lung Cancer</h3>',
                testimonial: '<p><em>"About a year ago, I was diagnosed with stage 4 metastatic lung cancer.  As a 37-year-old non-smoker, I was completely taken off-guard.  My doctors all agreed that I was a unique case given my age and history and that an aggressive treatment regime would be the best course of action.  Shortly thereafter, I was introduced to Ted and visited his offices for an initial consultation and acupuncture treatment.  Ted was very thorough in his questions regarding my medical history, symptomology, and well-being.  As a research biochemist, I am very aware of what Western medicine has to offer in terms of treating diseases like cancer.  I am also aware that Eastern medicine offers unique treatments in the form of acupuncture and herbal therapy.  Ted took the time to answer my questions and propose a path to recovery both physically and mentally.</p><p>Thank you Ted for your knowledge and support."<em></p>',
                author: '<p>- David T., Menlo Park</p>'
            },
            {
                type: '<h3>Stress-related Neck Pain</h3>',
                testimonial: '<p><em>"I have seen Ted for stress-related neck pain and his treatment was amazing. He is a most thorough practitioner who combines the best of traditional Chinese medicine with all the best of Western therapies. He took the time to do a full diagnosis and explained the procedures. I regained a range of motion in my neck that I hadn\'t had in years. Ted also combines the best of skilled healing and compassionate care of his patients. I highly recommend Ted."<em></p>',
                author: '<p>- Jan  F., Menlo Park</p>'
            },
            {
                type: '<h3>Insomnia</h3>',
                testimonial: '<p><em>"I am very scared of needles. I was trying to stop taking prescription sleeping pills and I am ultra-sensitive to medications. I went to Ted Ray for acupuncture and he made it comfortable and after a couple sessions, I was able to quit using any sleep aids. I actually rested and relaxed while being treated and that is hard for me to do."<em></p>',
                author: '<p>- Alicia L.,  Mountain View</p>'
            },
            {
                type: '<h3>Cold and Flu Relief</h3>',
                testimonial: '<p><em>"I was surrounded by people with colds. My throat started getting sore. I saw Ted, got treated and felt better, but not cured. I faithfully took the herbal tincture. I felt like I was about to get a cold, but I never did! I\'ll be seeing him next time I get the slightest symptoms. I highly recommend you do the same. If everyone got treated at the first sign of symptoms, we could probably save a few lives during flu season."<em></p>',
                author: '<p>- Eric G., Mountain View</p>'
            },
            {
                type: '<h3>Post-surgical pain & Scar tissue</h3>',
                testimonial: '<p><em>"I\'d seen an acupuncturist while training for a marathon several years ago and so I knew the benefits of acupuncture--but that Lac didn\'t take the time to explain what he was doing which is just as important as the treatment itself. I\'ve had several major operations which, although successful, have left me with substantial scar tissue/pain. I didn\'t want to take drugs to ease the pain, and Ted\'s methods were the only thing that\'s helped my pain-finally-</p><p>Since I first started treatment, I\'ve had no pain- and he\'s also helped me with other typical aches and pains of being a gardener/artist along the way. If anyone had any reservations seeking acupuncture treatment, I can tell you will feel very comfortable with Dr. Ray (Not to mention getting pain free!)"<em></p>',
                author: '<p>- Kyra P., Mountain View</p>'
            },
            {
                type: '<h3>Peace of Mind</h3>',
                testimonial: '<p><em>"Ted was my first Acupuncture experience. I did not know what to expect. Ted brings a western perspective to eastern medicine - he is very calming. When I left I felt more relaxed than I had in years."<em></p>',
                author: '<p>- Brett M., Palo Alto</p>'
            },
            {
                type: '<h3>Tendinitis</h3>',
                testimonial: '<p><em>"I\'m a writer, which means that I have flair-ups of chronic forearm/hand tendon pain. Ted Ray\'s treatment, including acupuncture and acupressure, along with a post-treatment plan helped my tendinitis to the point that I was feeling better within a few days. Ted is professional, friendly, funny, and answers all questions for those who may be unsure about acupuncture.</p><p> You may see some shops with neon "Acupuncture" signs, but do you think those guys get referred to by orthopedic surgeons? Probably not, but Ted does. When you see Ted, you immediately feel confident with his depth of knowledge and professional sensibility and respect. I recommend him for anyone who is experiencing carpal tunnel/tendonitis pain."<em></p>',
                author: '<p>- Mike C., Palo Alto</p>'
            },
            {
                type: '<h3>Great Results!</h3>',
                testimonial: '<p><em>"I\'ve seen a number of acupuncturists over the years.  Ted Ray is by far one of the most effective practitioners I\'ve encountered.  The quality of my life has improved dramatically since seeing Ted.  He really knows his stuff."<em></p>',
                author: '<p>- Becky F., Palo Alto</p>'
            }
            ]
            };
            this.chooseTestimonial();
            this.initialized = true;
        }
    },

    chooseTestimonial : function() {
        var options = this.testimonials[this.page];
        if (options) {
            var pickedEntry = options;
        } else {
            var i = 0;
            var random = Math.ceil(Math.random() * $H(this.testimonials).keys().length);
            for (var entry in this.testimonials) {
                i++;
                if (i == random) {
                    var pickedEntry = this.testimonials[entry];
                    break;
                }
            }
        }
        if (!pickedEntry) {
			this.chooseTestimonial();
		} else {
			var entry = pickedEntry[Math.floor(Math.random()*pickedEntry.length)];
	        this.output.innerHTML += entry.type + entry.testimonial + entry.author;
		}		
    }
};
Event.observe(window, 'load', function() {
    Testimonial.initialize();
});
