var tstId = '';
function loadTestimonial(testimonialId) {
	var xmlHttp;
	try {  
		// Firefox, Opera 8.0+, Safari  
		xmlHttp=new XMLHttpRequest();
	} catch (e) {
	   // Internet Explorer  
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 
		} catch (e1) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); 
			} catch (e2) {
				return;      
			} 
		}
	} 
	
	xmlHttp.open("GET","/public/elements/testmonial.jsp?testimonialId=" + testimonialId,true);
	xmlHttp.onreadystatechange=function() {
		if (xmlHttp.readyState==4) {
			var tresponse = xmlHttp.responseText;
			tstId = trim(tresponse.split("||")[0]);
			var tstContent = tresponse.split("||")[1];
			
			document.getElementById("tstText").innerHTML=easyReplace(tstContent);
			setTimeout("loadTestimonial(" + tstId + ")",20000);
		}
	}
	xmlHttp.send(null); 
}

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function easyReplace(txt) {
	txt = txt.replace(/\n/, '<br>')
	txt = txt.replace(/\r/, '<br>')
	return txt;
}

function dj_eval(/*String*/ scriptFragment, /*bool*/forceGlobal){ 
  // summary: Perform an evaluation in the global scope.  Use this rather than calling 'eval()' directly.
  // description: Placed in a separate function to minimize size of trapped evaluation context.
  // note:
  //  - JSC eval() takes an optional second argument which can be 'unsafe'.
  //  - Mozilla/SpiderMonkey eval() takes an optional second argument which is the
  //    scope object for new symbols.

  // Fix to evaluate in global scope for IE
  if (forceGlobal && window.execScript) {
    window.execScript(scriptFragment);
    return 1; // or just return?
  } 
  if (forceGlobal) {
    // From: http://trac.dojotoolkit.org/ticket/236
    var script = document.createElement('script');
    var content = document.createTextNode(scriptFragment);
    script.appendChild(content);
    script.type = 'text/javascript';
    script.defer = false;
    var head = document.getElementsByTagName('head').item(0);
    head.appendChild(script);
    return 1; // or just return?
  }
  return dj_global.eval ? dj_global.eval(scriptFragment) : eval(scriptFragment); 	// mixed
}