/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//#Testimonial0 {
//	color: #44920C;
//	font-family: arial,helvetica,sans-serif;
//	font-weight: bold;
//	font-size:12px;
//	line-height:14px;
//}
//
//#Testimonial1 {
//	background-color: #eef8e0;
//	overflow: hidden;
//	float: left;
//	display:block;
//	cursor: pointer;
//	margin-left: 5px;
//}
//
//#Testimonial2 {
//	position: relative;
//	height: 100px;
//	left: -300px;
//	display:block;
//}
//
//#Testimonial3 {
//	height: 50px;
//	position: relative;
//	left: -200px;
//	display:block;
//}

//
//        <div id="Testimonial1">
//          <div id="Testimonial2">
//              <table cellpadding="2" cellspacing="0" border="0" width="180" height="50">
//                  <tr>
//                      <td valign="bottom" align="left"><img src="http://img.driveragent.com/img/testimonial/top.gif" ></td></tr><tr><td align="center" valign="middle" height="80">
//                          <div id="Testimonial0"></div>
//                      </td>
//                  </tr>
//              </table>
//          </div>
//          <div id="Testimonial3">
//              <table cellpadding="0" cellspacing="0" border="0" width="180">
//                  <tr>
//                      <td valign="top" align=right><img src="http://img.driveragent.com/img/testimonial/bottom.gif" >
//                          <div id="Testimonial4"></div>
//                      </td>
//                  </tr>
//              </table>
//          </div>
WIDTH = 180;
STEPS = 7;

var firststep = 0;
var quote = -3;
var frame = 0;
var timing = new Array(60, 60, 60, 60, 60, 60, 60, 2340, 60, 60, 60, 60, 60, 60, 60);
quotes = new Array(
                    'Very good site, really useful Keep the nice work'              , 'Buratino' , 1,
                    'Good work. Youve a very nice site where is possible to find interesting information.', 'Poshol naxui'  , 1,
	                'Great site, great idea, just all round great work, everyone. ' , 'John L.' , 1 );

function jtpDisplayFrame(load) {
	var delta, curpos;
	frame++;
	if (frame == timing.length) frame = 0;
	if (load || !frame) {
		var oa0 = MM_findObj('Testimonial0');
		var oa4 = MM_findObj('Testimonial4');
		quote+=3;
		if (quote >= quotes.length) quote = 0;
		
        oa0.innerHTML = quotes[quote];
        var footer = '<p align="right"><em>' + quotes[quote + 1] + '</em>&nbsp;</p>';

		oa4.innerHTML = footer;
		
	}
	var oa2 = MM_findObj('Testimonial2');
	var oa3 = MM_findObj('Testimonial3');

	delta = frame * WIDTH / STEPS;
	curpos = parseInt(WIDTH - delta);	
	oa2.style.left = curpos + 'px';
	curpos = parseInt(delta - WIDTH);	
	oa3.style.left = curpos + 'px';
}

function jtpNextFrame(load) {
	jtpDisplayFrame(load);
	setTimeout('jtpNextFrame(false);', timing[frame]);
}

function jtp_Elapsed(step) {
	var i;
	for(i = 0; i < timing.length; i++) {
		if (step < timing[i]) {
			firststep = timing[i] - step;
			frame = i;
			break;
		}
		step -= timing[i];
	}
}

function init_animation() {
	var oa2 = MM_findObj('Testimonial2');
	if (oa2) {
		frame--;
		if ((quote + 3) >= quotes.length) quote = -3;
		if (firststep > 0) {
			jtpDisplayFrame(true);
			setTimeout('jtpNextFrame(false);', firststep);
		} else {
			jtpNextFrame(true);
		}
	}
}

///////////////////////////////////////////////////////////////////////////////////////////////////
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function addLoadEvent(func) {
	var oldOnload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldOnload();
			func();
		}
	}
}

addLoadEvent(init_animation);
