var arrSourceLogos = new Array(12)
// \x22 = "

arrSourceLogos[0] = '<img src=\x22images/home/logos/net10.gif\x22 alt=\x22\x22 />';
arrSourceLogos[1] = '<img src=\x22images/home/logos/tracfone.gif\x22 alt=\x22\x22 />';
arrSourceLogos[2] = '<img src=\x22images/home/logos/chevy.gif\x22 alt=\x22\x22 />';
arrSourceLogos[3] = '<img src=\x22images/home/logos/mylifetime.gif\x22 alt=\x22\x22 />';
arrSourceLogos[4] = '<img src=\x22images/home/logos/clix.gif\x22 alt=\x22\x22 />';
arrSourceLogos[5] = '<img src=\x22images/home/logos/vegas.gif\x22 alt=\x22\x22 />';
arrSourceLogos[6] = '<img src=\x22images/home/logos/nc-chevy.gif\x22 alt=\x22\x22 />';
arrSourceLogos[7] = '<img src=\x22images/home/logos/rm-chevy.gif\x22 alt=\x22\x22 />';
arrSourceLogos[8] = '<img src=\x22images/home/logos/mas.gif\x22 alt=\x22\x22 />';
arrSourceLogos[9] = '<img src=\x22images/home/logos/runway.gif\x22 alt=\x22\x22 />';
arrSourceLogos[10] = '<img src=\x22images/home/logos/deutsch.gif\x22 alt=\x22\x22 />';
arrSourceLogos[11] = '<img src=\x22images/home/logos/cici.gif\x22 alt=\x22\x22 />';
//arrSourceLogos[12] = '<img src=\x22images/home/logos/popcorn.gif\x22 alt=\x22\x22 />';





var logosHTML = "";
for(i = 0; i < 12; i++)
{
	var randomIndex = Math.floor(Math.random()*arrSourceLogos.length)
	logosHTML += arrSourceLogos[randomIndex];
	arrSourceLogos.splice(randomIndex, 1);
}


$(document).ready(function(){
	$("#client_logos").html(logosHTML);
	$("#client_logos").css(
						   	{	"top": "0",
								"left": "0",
								"height": "93px",
								"width": 12*229 + "px"}
							);
});

function drawLogos()
{
	
}

var logoWidth = 229;//229 - 18;
var logoPos = 0;
var totalLogos = 11;  //total - 1, first position 0
var allowClientsAnimate = true;
var animatinTime = 500;

function clientsScrollFinished()
{
	allowClientsAnimate = true;
}

function clientsRight()
{
	//alert('clientsRight');
	if(allowClientsAnimate)
	{
		if( logoPos + 1 <= totalLogos)
		{
			allowClientsAnimate = false;
			logoPos = logoPos + 1;

			$("#client_logos").animate
			(
				{ 
					marginLeft: -(logoPos * logoWidth) + "px"
				},
				{
					duration: animatinTime,
					complete: clientsScrollFinished 
				} 
			);
			
			
			
			$("#handler").animate(
				{ 
					marginLeft: logoPos * 169 / (totalLogos + 1) + "px"
				}, 
				{
					duration: animatinTime
				}
			);

			

		}	
	}
}

function clientsLeft()
{
	//alert('clientsLeft');
	if(allowClientsAnimate)
	{
		if( logoPos - 1 >= 0)
		{
			allowClientsAnimate = false;
			logoPos = logoPos - 1;
	
			$("#client_logos").animate(
				{ 
					marginLeft: -(logoPos * logoWidth) + "px"
				}, 
				{
					duration: animatinTime,
					complete: clientsScrollFinished 
				}
			);
			$("#handler").animate(
				{ 
					marginLeft: logoPos * 169 / (totalLogos + 1)
				}, 
				{
					duration: animatinTime 
				}
			);
		}	
	}
}


/*--- testimonials start ---*/







var testimonialsPos = 0;
var totalTestimonials = 3;  //total - 1, first position 0
var allowTestimonialsAnimate = true;

function testimonialsRight()
{
	
	if(allowTestimonialsAnimate)
	{
		if( testimonialsPos + 1 <= totalTestimonials)
		{
			allowTestimonialsAnimate = false;
			testimonialsPos = testimonialsPos + 1;
			$("#trace_testimonialsPos").text(testimonialsPos);
			$("#testimonial_" + (testimonialsPos - 1)).fadeOut(animatinTime, function()
															   {
															   	$("#testimonial_" + testimonialsPos).fadeIn(animatinTime);
																testimonialFadeFinished();
															   });
			$("#handler_testimonials").animate(
				{ 
					marginLeft: testimonialsPos * 169 / (totalTestimonials + 1)
				}, 	
				{
					duration: animatinTime
				}
			);
		}	
	}
	
}

function testimonialsLeft()
{
	
	if(allowTestimonialsAnimate)
	{
		if( testimonialsPos - 1 >= 0)
		{
			allowTestimonialsAnimate = false;
			testimonialsPos = testimonialsPos - 1;
			$("#trace_testimonialsPos").text(testimonialsPos);
			$("#testimonial_" + (testimonialsPos + 1)).fadeOut(animatinTime, function()
															   {
															   	$("#testimonial_" + testimonialsPos).fadeIn(animatinTime);
																testimonialFadeFinished();
															   });
			$("#handler_testimonials").animate(
				{ 
					marginLeft: testimonialsPos * 169 / (totalTestimonials + 1)
				}, 	
				{
					duration: animatinTime
				}
			);
		}	
	}
	
}

function testimonialFadeFinished()
{
	allowTestimonialsAnimate = true;
}

function readMore() {
    $(".readMore").css("display", "none");
    $("#expanded_content").css("display", "block");
}
