/*[mst-20090209:start] change the conent in every 10 seconds for what people are saying box in consumer,business page*/

// On Load Methods 
var lblWhatPplSayShortDesc1;
var lblWhatPplSayShortDesc;
var lblWhatPplSayBy;
var lblWhatPplSayCtry;
var lnkWhatPplSayMore;
var lnkMore;
var arrsize;
var varmoreclientid;
var arr_desc1 = [];
var arr_desc = [];
var arr_id = [];
var arr_remarks = [];
var arr_by = [];
var testimonial_rand_secs = 10;
var testimonial_rand_timerID = null;
var testimonial_rand_timerRunning = false;
var testimonial_rand_delay = 1000;
var objTestimonial = new Array();
var testimonial_rand_current_idx = 0;
var testimonial_rand_max_idx = 0;
var testimonial_rand_url = 'Awards_testimonials.aspx?tcontid=' ;
var WhatPplSayCount;
 
/*  Original Start ........
$(document).ready(function(){
						   
    $("#hiddendesc1 li").each(function() { 
    arr_desc1.push($(this).text()) });
   
    $("#hiddendesc li").each(function() { 
    arr_desc.push($(this).text()) });

    $("#hiddenremarks li").each(function() { 
    arr_remarks.push($(this).text()) });
    
    $("#hiddenids li").each(function() { 
    arr_id.push($(this).text()) });
    
    $("#hiddencommentbys li").each(function() { 
    arr_by.push($(this).text()) });
 
    testimonial_rand_max_idx = arr_desc1.length;
    
    alert("arr_desc1.length " + arr_desc1.length);
    
    	
	lblWhatPplSayShortDesc1 = document.getElementById($('#hidshortdesc1').attr('value'));
	lblWhatPplSayShortDesc = document.getElementById($('#hidshortdesc').attr('value'));
	lblWhatPplSayBy = document.getElementById($('#hidcommentby').attr('value'));
	lblWhatPplSayCtry = document.getElementById($('#hidremarks').attr('value'));
	lnkWhatPplSayMore = document.getElementById($('#hidWhatPplSayMore').attr('value'));
	lnkMore = document.getElementById($('#hidMore').attr('value'));
	WhatPplSayCount= $('#hidCount').attr('value');

	InitializeTestimonialRandomTimer();
	
});

function InitializeTestimonialRandomTimer(){
    testimonial_rand_secs = 10;
    StartTestimonialRandomTimer();
    //LoadTestimonialList();
}
function StartTestimonialRandomTimer()
{
    if (testimonial_rand_secs==0)
    {
        testimonial_rand_secs = 10;
        if( (testimonial_rand_current_idx + 1) < testimonial_rand_max_idx )
            testimonial_rand_current_idx = testimonial_rand_current_idx + 1;
        else
            testimonial_rand_current_idx = 0;
        
       
        UpdateTestimonialPane();
        StartTestimonialRandomTimer();
    }
    else
    {
        testimonial_rand_secs = testimonial_rand_secs - 1
        testimonial_rand_timerRunning = true
        testimonial_rand_timerID = self.setTimeout("StartTestimonialRandomTimer()", testimonial_rand_delay)
    }
}


function UpdateTestimonialPane(){
    if( lblWhatPplSayShortDesc1 != null ) lblWhatPplSayShortDesc1.innerHTML =  '\"' + arr_desc1[testimonial_rand_current_idx].substr(0,WhatPplSayCount) + '..\"';
    if( lblWhatPplSayShortDesc != null ) lblWhatPplSayShortDesc.innerHTML = arr_desc[testimonial_rand_current_idx]; 
    if( lblWhatPplSayBy != null ) lblWhatPplSayBy.innerHTML = arr_by[testimonial_rand_current_idx]; 
    if( lblWhatPplSayCtry != null ) lblWhatPplSayCtry.innerHTML = arr_remarks[testimonial_rand_current_idx]; 
    if( lnkWhatPplSayMore != null ) lnkWhatPplSayMore.href = testimonial_rand_url + arr_id[testimonial_rand_current_idx];  
    if( lnkMore != null ) lnkMore.href = testimonial_rand_url + arr_id[testimonial_rand_current_idx];  
}
Original End ........*/


$(document).ready(function(){
	$("#divRptTestimonials > ul").each(function(){
	      arr_id.push($(this).attr("id"));
	});
	    
    testimonial_rand_max_idx = arr_id.length;
    	
	lblWhatPplSayShortDesc1 = document.getElementById($('#hidshortdesc1').attr('value'));
	lblWhatPplSayShortDesc = document.getElementById($('#hidshortdesc').attr('value'));
	lblWhatPplSayBy = document.getElementById($('#hidcommentby').attr('value'));
	lblWhatPplSayCtry = document.getElementById($('#hidremarks').attr('value'));
	lnkWhatPplSayMore = document.getElementById($('#hidWhatPplSayMore').attr('value'));
	lnkMore = document.getElementById($('#hidMore').attr('value'));
	WhatPplSayCount= $('#hidCount').attr('value');

	InitializeTestimonialRandomTimer();
	
});

function InitializeTestimonialRandomTimer(){
    testimonial_rand_secs = 10;
    StartTestimonialRandomTimer();
    //LoadTestimonialList();
}
function StartTestimonialRandomTimer()
{
    if (testimonial_rand_secs==0)
    {
        testimonial_rand_secs = 10;
        if( (testimonial_rand_current_idx + 1) < testimonial_rand_max_idx )
            testimonial_rand_current_idx = testimonial_rand_current_idx + 1;
        else
            testimonial_rand_current_idx = 0;
        
       
        UpdateTestimonialPane();
        StartTestimonialRandomTimer();
    }
    else
    {
        testimonial_rand_secs = testimonial_rand_secs - 1
        testimonial_rand_timerRunning = true
        testimonial_rand_timerID = self.setTimeout("StartTestimonialRandomTimer()", testimonial_rand_delay)
    }
}


function UpdateTestimonialPane(){
   $("ul[id='" + arr_id[testimonial_rand_current_idx] + "'] > li").each(function(){
        var liValue  = $(this).text();
        if( $(this).attr("class") == "lishortdesc1" && lblWhatPplSayShortDesc1 != null ){
            lblWhatPplSayShortDesc1.innerHTML =  '\"' + liValue.substr(0,WhatPplSayCount) + '..\"';
        }else if( $(this).attr("class") == "lishortdesc" && lblWhatPplSayShortDesc != null ){
            lblWhatPplSayShortDesc.innerHTML = liValue; 
        }else if( $(this).attr("class") == "licommentby" && lblWhatPplSayBy != null ){
            lblWhatPplSayBy.innerHTML = liValue; 
        }else if( $(this).attr("class") == "liremarks" && lblWhatPplSayCtry != null ){
            lblWhatPplSayCtry.innerHTML = liValue; 
        }
   });
   
   if( lnkWhatPplSayMore != null ) lnkWhatPplSayMore.href = testimonial_rand_url + arr_id[testimonial_rand_current_idx];  
   if( lnkMore != null ) lnkMore.href = testimonial_rand_url + arr_id[testimonial_rand_current_idx]
}



/*[mst-20090209:end] change the conent in every 10 seconds for what people are saying box in consumer,business page*/