function truckReel() {
    var numTrucks = $('#trucks-reel div.truck').size();
    var counter = 1;
    rotate = function() {
        $('#trucks-reel div.truck').each(function() {
            currentZIndex = $(this).css('z-index');
            newCss = { 'z-index' : parseInt(currentZIndex) + 1};
            $(this).css(newCss);
            $(this).children('.top-strip').css(newCss);
        });
        nextTruck = $('#trucks-reel div.truck:nth-child(2)');
        nextTruck.css('visibility', 'visible');
        
        $('#trucks-reel div.truck:first-child').fadeOut(1000, function() {
            $('#trucks-reel div.truck:first-child').css({ 'visibility' : 'hidden', 'z-index' : '1' });
            $('#trucks-reel div.truck:first-child').insertAfter('#trucks-reel div.truck:last-child').fadeIn(0);
        });
    };
    rotateSwitch = function() {
        play = setInterval(function() {
            rotate();
            counter++;
            if ( counter == ( numTrucks + 1 ) ) {
                counter = 1;
            }
        }, 10000);
    };
    rotateSwitch();
}
function playVideo() {
    $('#playVideo').click(function() {
        $('#trucks').html(
            "<object width=\"748\" height=\"445\"><param name=\"movie\" value=\"http://www.youtube.com/v/Dt8EV3VqoC0?fs=1&amp;hl=en_US&amp;rel=0&autoplay=1\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/Dt8EV3VqoC0?fs=1&amp;hl=en_US&amp;rel=0&autoplay=1\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"748\" height=\"445\"></embed></object>"
        )
    });
}
function toggle() {
	var ele = document.getElementById("toggleText");
	var text = document.getElementById("displayText");
	if(ele.style.display == "block") {
    		ele.style.display = "none";
		text.innerHTML = "Read More";
  	}
	else {
		ele.style.display = "block";
		text.innerHTML = "Collapse";
	}
} 
google.setOnLoadCallback(function() {
    truckReel();
    playVideo();
});

