if (!Array.prototype.indexOf) {
    Array.prototype.indexOf = function(elt /*, from*/) {
        var len = this.length;

        var from = Number(arguments[1]) || 0;
        from = (from < 0)
         ? Math.ceil(from)
         : Math.floor(from);
        if (from < 0)
            from += len;

        for (; from < len; from++) {
            if (from in this &&
          this[from] === elt)
                return from;
        }
        return -1;
    };
}


var pageSize = 10;
var currentPage = 1;
var pages = 1;

var myComments = new Array(
new objComment("Norma Lang", "CBI Coordinator, Drumheller", "The compassion you showed for this youth audience was touching, and your personal testimony and lesson of optimism and hope coming out of adversity was high impact and truly inspirational.", "Troy, we thank you for coming to Drumheller to share your message of resiliency with the outreach school students in our community. You effectively adapted your presentation to suit a cozy venue and delivered a powerful and personal message of resiliency to a small group of students at our Outreach School. These were students who could relate to the powerful personal story you told them, and you had what can be a tough audience mesmerized. Good public speakers are able to quickly earn the trust and respect of their audience. Could there be a tougher audience than such a group of teens as we offered up to you? Your ability to immediately relate to these kids on their level, earned you their undivided attention for well over an hour. The compassion you showed for this youth audience was touching, and your personal testimony and lesson of optimism and hope coming out of adversity was high impact and truly inspirational. Thank you for sharing it with us."),
new objComment("Nicole", "Student, Drumheller Outreach School", "all I can say is that you are completely phenomenal! You touched me in a place of my heart that I don't think anyone has ever touched before. You make me feel like I have hope.", "Troy. You came to our school on December 14th, 2009, and all I can say is that you are completely phenomenal! You touched me in a place of my heart that I don't think anyone has ever touched before. You make me feel like I have hope. You showed us a lot of bravery. I don't think I would ever be able to come out and talk to people about my childhood. I hope everything in your life is well."),
new objComment("Laurie Stavne", "Peace River Family & Community Support Services", "The fact that he creates these bonds of trust with the youth and then follows up with helping to provide the supports that they need", "It is a true gift to be able to reach inside someone (especially teens) and trigger their desire to seek help, to realize that there are others out there going through the same things they are, to give them the strength and the avenues to make that change happen, and to make them feel safe enough to search out supports. This is exactly what Troy does with his speaking. The fact that he creates these bonds of trust with the youth and then follows up with helping to provide the supports that they need afterwards was the reason why we chose him for the Peace Region Youth Conference. Thank you Troy, for being so easy to work with, for freely giving of your heart to the students at our conference and for all of the good work that you do on a daily basis."),
new objComment("Penny Fox, Director", "Smoky River Family & Community Support Services", "Every once in a long while we come across the path of someone who touches our hearts. Troy Payne is one of those people.", "Every once in a long while we come across the path of someone who touches our hearts. Troy Payne is one of those people. As you watch his presentation you are thinking about how you would react if this story was yours. You feel sadness, you share the pain and by the end you realize that there is truth in the strength we can all find - if only we stop and think about the possibilities of something better. As I watched his presentation, spoke to him over lunch and then witnessed him sitting on a bench in the hallway talking to our youth, it is obvious that he speaks from his heart and is truly passionate about helping our children make positive choices. Troy, we so appreciate you coming to our region and into our schools during our youth rally. It was a great event for all of us."),
new objComment("Carol Coleman, FCSS Coordinator", "Vermilion, Alberta", "He encourages youth to keep moving ahead in a positive direction despite the challenges they may face.", "It takes much inner strength and the support from various sources to face the \"giants\" in our life. Troy is successful in sharing his personal story in a manner which holds the attention of youth. He encourages youth to keep moving ahead in a positive direction despite the challenges they may face. Thanks Troy for reminding all of us that our lives are not determined by what may have happened to us but rather how we respond to what happens in our life and the attitudes we choose to live by."),
new objComment("Sandra Bembridge, Service Coordinator", "Alberta Brain Injury Network, High Prairie, Alberta", "Like you said, everyone has a story & yours is an incredible one.", "Troy, Just a note to say that I thoroughly enjoyed your presentation in Slave Lake. You have a wonderful way of telling your story, and set a great example. Like you said, everyone has a story & yours is an incredible one. Thank you for sharing and in that, you truly are a gift! It was great to be part of your positive and enlightening presentation, truly can't say enough about it. Awesome! I highly recommend, everyone would benefit from hearing you speak. Best wishes to you. : )"),
new objComment("Robbin Bowman, Director of Family & Community Support Services", "Carstairs, Alberta", "I whole heartedly recommend this presentation as I have witnessed it as one that resonates with many people; be they a youth, a parent, grandparent, community member, or those in the helping professions.", "In my work in family and community support, I am often seeking out opportunities to bring in speakers and/or programs that benefit children, youth and families in the community. Thankfully, I was made aware of a young man who had made a presentation to other like-minded people and promptly made contact with Troy Payne. From the beginning Troy’s correspondence was pleasant and respectful. In viewing his website further and checking out testimonials I decided this was worth looking into. Troy presented a message of resiliency to our High School students in the afternoon and a ‘ tweaked’ version to the community later on the same evening. Both audiences connected easily with Troy, as he engaged them through a story of a young mans life and the adversities encountered in his formative years. At the end of this well done, engaging and inspiring presentation, Troy was approached by audience members who felt compelled to share their comments of gratitude. For me, Troy’s message came a day after learning a young man in my life had decided his was not worth living, an impact that struck a chord as to the absolute importance of Troy’s message, that will be with me forever. And although I realize I am writing this testimonial through fresh grief; I strongly believe that it emphasizes all the more, the importance of Troy’s message. I wholeheartedly recommend this presentation as I have witnessed it as one that resonates with many people; be they a youth, a parent, grandparent, community member, or those in the helping professions. Thank you again Troy."),
new objComment("Lenny Richer, FCSS Coordinator", "Town of Slave Lake, Alberta", "the tools he leaves the youth and adults with are very practical and leaves them with hope that change is possible. ", "As part of our FCSS Directors Network, Troy presented to both of our local junior and senior high schools as well as during one of the sessions at the conference. I had the opportunity to sit in on all three sessions and I have to say, without a doubt Troy is one of the most powerful speakers I have ever listened to. He was engaging and interactive no matter what age group he was speaking to, and delivered an intense personal account of the challenges he has faced in his life. To hear him tell his story is gut wrenching, but the message he delivers in terms of resiliency is extremely powerful. Most importantly, the tools he leaves the youth and adults with are very practical and leaves them with hope that change is possible. We will definitely have Troy in our community again!"),
new objComment("Joyce Mearon, Human Resources Consultant", "City of Grande Prairie, Grande Prairie, Alberta", "Troy's presentation was very powerful, inspiring and thought-provoking.", "During our Health & Wellness Month, we invited Troy Payne to present on Resiliency. Troy's presentation was very powerful, inspiring and thought-provoking. The audience was spellbound as Troy told Kyle's story with photos and music. The story of Kyle's life from a sweet, happy and innocent little boy to a hurt and angry young man and beyond was amazing and miraculous. The feedback was phenomenal: \"I honour Troy's determination and courage,\" \"very inspiring presentation\" and \"great presentation - it was timely for me\". All who attended were very glad they took the time to attend. Troy is an outstanding speaker, a kind and gentle soul and obviously believes strongly in his message. I would not hesitate to recommend Troy Payne as a presenter at any conference whatever the topic may be."),
new objComment("Alex Gillis, Student", "Grande Prairie, Alberta", "You really changed peoples lives I can guarantee you that.", "Troy, you are so inspiring, you really made me think. It was the best presentation ever. If you can make a difference for yourself, there is hope for everybody. Even though your life started out rough and you got abused, you’re bigger then them. You made it through the roughest times of your life, I think that’s amazing, you’re an inspiration and you should be to everybody. You were amazing what you said in there. Probably made a lot of kids think, it sure made me think. I have had a pretty rough childhood too just not as bad as you did. You make it seem like nothing ever happened, but something did, and you forgave what people did to you, now you’re helping other students, I think that’s amazing. You are my number one inspiration. If you can have a bad childhood and make it better, everybody can do the same, all it takes is the inspiration that you gave to hundreds of kids today. You really changed peoples lives I can guarantee you that. When you’re up there speaking to all those kids, not knowing what impact it could or could not do to them, you’re really making a difference. No matter what happened when you were a kid you are bigger then those people who chose to hurt you. You’re a real inspiration because if you can change at least one life in this world, you’re making a difference and you have certainly changed mine. You can help millions of people with the presentation you gave today; you’re making a difference that’s for sure."),
new objComment("Jean Powell, Executive Administrator/Conference Coordinator", "Community Futures Visions North, La Ronge, Saskatchewan", "", "Troy Payne, Wellness Realization, made a presentation at our youth conference \"Look to the Future\" on April 24th & 25th, 2008. Troy made a presentation to Grade 11 & 12 students \"Exploring Entrepreneurship As A Career Alternative\". Upon summarizing the evaluations completed by the students, his presentation received 4’s & 5’s (5 being excellent). Troy also MC’ed the conference for us and did a great job. Thanks again Troy and look forward to working with you in the future."),
new objComment("Jennifer Smith, Department Head", "Notre Dame High School, Red Deer, Alberta", "I would highly recommend Troy to any organization dealing with at-risk youth. I felt that we were blessed by the experience and his presence.", "On May the 2nd, we were fortunate to have Troy Payne in as a speaker for my school. He spoke to four separate classes consisting of many at-risk students. The feedback from my students has been incredible. They were held spellbound by Troy's engaging manner of presenting. They were drawn in by his genuine approach to his life and the choices that he made. They felt connected to him. All of the 120 students that had the opportunity to listen to Troy came away with food for thought, a feeling that someone cared, a feeling of empathy and a hope for a better life for themselves. They were rejuvenated. I would highly recommend Troy to any organization dealing with at-risk youth. I felt that we were blessed by the experience and his presence."),
new objComment("Grade 11 Girl", "Red Deer, Alberta", "He really showed me a strength and resilience that I hadn’t found yet.", "I loved the presentation. As I listened, I emphasized and put my memory to use. I dwelled on my past and felt angry and then he went over his key points for changing your life and I felt resilient and strong. I felt hope in being a Mom and escaping my Dad’s control. I didn’t need those struggles because he showed me that he could, so I could too. I felt we had many similarities. He really showed me a strength and resilience that I hadn’t found yet."),
new objComment("Grade 12 Boy", "Red Deer, Alberta", "I thought it was so necessary for teens to hear this, because it does happen and he comes to let kids know they are not alone.", "I loved it! The whole thing. My parents don’t abuse me but they still hurt me inside. I don’t have anything that is not positive to say. I’d actually talk to this guy on a regular basis. He was the greatest person to talk to because he knows. Not like those hopeless people who are just hired to say things like this. I thought it was so necessary for teens to hear this, because it does happen and he comes to let kids know they are not alone."),
new objComment("Jessica, Grade 11 Student", "Drumheller, Alberta", "It was an awesome inspiration to not only young students but to people of all ages.", "You probably receive a lot of emails regarding your presentations, but I felt it was necessary to email you and share with you my appreciation of your presentation at my school. I attended your career presentation in Drumheller on October 26th and I was thoroughly shocked to see a person of your age, let alone a young male, so passionate about his job. It was an awesome inspiration to not only young students but to people of all ages. I am in grade eleven and am planning to attend school to become a social worker/addictions counselor/youth worker and it was amazing to see someone else share the same passion. One of the best parts of your presentation was how you incorporated your humorous stories into your speech, and the way you displayed so much honest passion about what you do. But the absolutely best thing about your presentation was your slide show about the African children’s choir. Not only did it touch my heart, but it brought me back to memories of past mission trips I have been on and worked with children. You have an amazing gift to reach teens and I pray that God will continue to bless you with this awesome gift. So thank you for being an inspiration to me and all of my peers. God bless you."),
new objComment("Vickie Newmeyer, General Manager", "Meridian Community Futures Development Corporation", "", "Troy’s presentations are well prepared, focused and inter-active. His contemporary demeanor carries relevance and a connection to his audience both young and old. Troy encourages his audience to broaden their thinking and to expand the spirit of entrepreneurship. Troy’s knowledge of Community Futures programming is invaluable for those ‘would be’ entrepreneurs. He brings knowledge, experience and great examples of what can be accomplished by entrepreneurs."),
new objComment("Danielle Schnurer, 4-H Media Release Coordinator", "4-H Alberta", "", "The instant that Troy walked through the door into the room of 4 H Ambassadors, he immediately grasped their attention. Troy was able to connect with the ambassadors, for he spoke to them at their level, and made them feel that their mission within the 4 H program was an important one. Troy tackled their intellectual levels, and challenged the ambassador group to come up with idea’s to implement within the program that will make it more attractive to the youth of Alberta and Canada. He also gave the delegates the information necessary to understand the importance of marketing, and allowed them to discover that \"edge\" needed to promote 4 H successfully. Troy was very prepared for the session, and it definitely shined through by his ability to take every ambassador’s passion about the 4 H program, and lift it by 10 levels. At the end of the session, each delegate was ready and willing to gain more knowledge from Troy. He really hit the nail on the head in terms of motivating each ambassador to return to his or her home province, and implement or strengthen the ambassador program. Overall Troy was motivational, professional, dedicated, and genuinely interested in the ambassador group. I am confident in saying that Troy Payne is an outstanding speaker, and would tackle any issue for any age group with poise, confidence, and professionalism."),
new objComment("Corinne Lubiniecki, General Manager", "Ventures Community Futures Development Corporation", "", "Troy did a fantastic job as Master of Ceremonies, he was well prepared, managed the agenda and timing for the event very well, was very energetic and had captivated his audience. We had 129 students participating in this conference and some of the comments we had received from the students was that he was motivational, very open, worked the crowd well and that they loved the candy. I have no hesitation in recommending Troy as a speaker for any type of function."),
new objComment("Kelsay Reimer, Economic Development Officer", "Southwest Regional Economic Development Authority Inc", "", "I had the opportunity and the privilege to develop a partnership with Troy while working on a youth initiative – Be Youth Blast – developed by our organization in an attempt to encourage entrepreneurship through education. Troy was a wealth of information and inspiration, and provided much appreciated assistance and guidance with his vast experience working with youth. Troy acted as Master of Ceremonies at our youth event, as well as delivered a keynote presentation engaging the youth and encouraging them to follow their dreams. He created a positive atmosphere for the students to learn and to laugh with one another. Troy Payne was a pleasure to work with, and I feel confident recommending him for similar occasions.")
);
function objComment(sTitle, sLocation, sSummary, sComments){
this.title = sTitle;
this.comments = sComments;
this.location = sLocation;
this.summary = sSummary;
}

function listComments(page){
currentPage = (isNaN(page)) ? 1 : page;

var start = (currentPage==1) ? 0 : (currentPage * pageSize)-pageSize;
var end = (myComments.length>start+pageSize ) ? start+pageSize : myComments.length;
var htmlOut = '';
for (i =start; i < end; i++){

	htmlOut += '<div class="contentBox">';
	htmlOut += '  <div class="contentTop"></div>';
	htmlOut += '  <div class="contentBody">';
	htmlOut += '<div class="contentTitle">' + myComments[i].title + ', <span class="light">' + myComments[i].location + '</span></div>';
	htmlOut += '  <p>' + myComments[i].comments + '</p>';
	htmlOut += '  </div>';
	htmlOut += '  <div class="contentBottom"></div>';
	htmlOut += '</div>';
}


if(document.getElementById("comments") != null){
	document.getElementById("comments").innerHTML = htmlOut;
}
if(document.getElementById("pager") != null){
	document.getElementById("pager").innerHTML = showPageNav();
}
}

function showPageNav()
{
var navHtml;
var cnt = Math.ceil(myComments.length / pageSize);
pages = cnt;
navHtml = "";
for(x=1; x<=cnt; x++){
	navHtml += (navHtml == '') ? '' : " | ";
	if(currentPage == x){
		navHtml += x;
	}else{
		navHtml += '<a href="javascript:listComments(' + x +');" onclick="window.scrollTo(0,400);">' + x + '</a>';
	}
}


navHtml = '<span><a href="javascript:prev();" onclick="window.scrollTo(0,400);">prev</a></span>&nbsp;&nbsp;&nbsp;<span>' + navHtml + '</span>&nbsp;&nbsp;&nbsp;<span><a href="javascript:next();" onclick="window.scrollTo(0,400);">next</a></span>';

return navHtml
}

function prev(){
	if(currentPage > 1)
		listComments(currentPage - 1);
}
function next(){
	if(currentPage < pages)
		listComments(currentPage + 1);
}

function listCommentsSummary(id, count) {
    var htmlOut;
    htmlOut = "";
    var which;
    var usedArr = new Array();
    var newComments = new Array();
    var featured = new Array();
    for (var i = 0; i < myComments.length; i++) {
        if (myComments[i].summary != "") {
            featured.push(myComments[i]);
        }
    }

    for (var x = 0; x < count; x++) {
        htmlOut += (htmlOut == "") ? "" : '<div class="dottedLine"></div>';
        do
        {
            which = Math.round(Math.random() * (featured.length - 1));
            
        } while (usedArr.indexOf(which) > -1)
        usedArr.push(which);
        //newComments = featured[which].summary.split(" ", 25);
        htmlOut += '<div class="title">' + featured[which].title + '</div>';
        htmlOut += '<div class="subTitle">' + featured[which].location + '</div>';
        //htmlOut += '<div class="body">' + newComments.toString().replace(/,/gi, " ") + '...</div>';
        htmlOut += '<div class="body">' + featured[which].summary + '...</div>';
        htmlOut += '<a href="your_say.html">View Comments ></a>';    
    }
    
 
    if (document.getElementById(id) != null) {
        document.getElementById(id).innerHTML = htmlOut;
    }
}