// SET THE NUMBER OF FILES
var numFiles = 18;


// DON'T CHANGE
function getHTTPObject() { var xmlhttp; /*@cc_on @if (@_jscript_version >= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @else xmlhttp = false; @end @*/ if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp = false; } } return xmlhttp; }
var http = getHTTPObject();



function getTestimonial(typeTestimonial) {
	
	var file = Math.floor(Math.random() * numFiles) + 1;
	http.open("GET", 'nats_images/newSkin/testimonials/' + file + '.txt',true);

	if(typeTestimonial == 'a') http.onreadystatechange = useHttpResponse_a;
	if(typeTestimonial == 'b') http.onreadystatechange = useHttpResponse_b;
	if(typeTestimonial == 'c') http.onreadystatechange = useHttpResponse_c;

	http.send(null);
}

var getAllActual	= 1;
function getAllTestimonials() {
		if(getAllActual > numFiles) return 0;

		http.open("GET", 'nats_images/newSkin/testimonials/' + getAllActual + '.txt',true);
		http.onreadystatechange = useHttpResponse_d;
		http.send(null);

		getAllActual++;
}

function getAllTestimonialsIe() {
		
		for(var i = 1 ; i <= numFiles ; i++) {
		
			http.open("GET", 'nats_images/newSkin/testimonials/' + i + '.txt',true);
			http.onreadystatechange = useHttpResponse_e;
			http.send(null);
		}

}



// INDEX PAGE
function useHttpResponse_a() {
	var textDisplay;

	if (http.readyState == 4) {
		textArray 	= http.responseText.split(";");
		var tDate	= textArray[0];
		var tFirstName	= textArray[1];
		var tLastName	= textArray[2];
		var tCompany	= textArray[3];
		var tText	= textArray[4];

		textDisplay =	"<h3>12clicks is the right choice!</h3>" +
				"<p>"+tText+"</p>"+
				"<h4>"+tFirstName+" "+tLastName+", "+tCompany+"</h4>";



		document.getElementById('testimonial').innerHTML = textDisplay;
	}
}

// OTHERS PAGES
function useHttpResponse_b() {
	var textDisplay;

	if (http.readyState == 4) {
		textArray 	= http.responseText.split(";");
		var tDate	= textArray[0];
		var tFirstName	= textArray[1];
		var tLastName	= textArray[2];
		var tCompany	= textArray[3];
		var tText	= textArray[4];
		
		textDisplay =	"<h3>12clicks is the right choice!</h3>" +
				"<p>"+tText+"</p>"+
				"<h4>"+tFirstName+" "+tLastName+", "+tCompany+"</h4>";

		document.getElementById('testimonial2').innerHTML = textDisplay;
	}
}

// SIGN UP PAGE
function useHttpResponse_c() {
	var textDisplay;

	if (http.readyState == 4) {
		textArray 	= http.responseText.split(";");
		var tDate	= textArray[0];
		var tFirstName	= textArray[1];
		var tLastName	= textArray[2];
		var tCompany	= textArray[3];
		var tText	= textArray[4];
		
		textDisplay =	"<h3>12clicks is the right choice!</h3>" +
				"<p>"+tText+"</p>"+
				"<h4>"+tFirstName+" "+tLastName+", "+tCompany+"</h4>";

		document.getElementById('testimonial2').innerHTML = textDisplay;
	}
}

// TESTIMONIALS PAGE
function useHttpResponse_d() {
	var textDisplay;

	if (http.readyState == 4) {
		textArray 	= http.responseText.split(";");
		var tDate	= textArray[0];
		var tFirstName	= textArray[1];
		var tLastName	= textArray[2];
		var tCompany	= textArray[3];
		var tText	= textArray[4];
		
		textDisplay =	"<h2>"+tFirstName+" "+tLastName+", "+tCompany+"</h2>" +
						"<p>"+tText+"</p>";

		document.getElementById("test").innerHTML = document.getElementById("test").innerHTML + textDisplay;	
		getAllTestimonials()
	}
}

// FOR IE
function useHttpResponse_e() {
	var textDisplay;

	if (http.readyState == 4) {
		textArray 	= http.responseText.split(";");
		var tDate	= textArray[0];
		var tFirstName	= textArray[1];
		var tLastName	= textArray[2];
		var tCompany	= textArray[3];
		var tText	= textArray[4];
		
		textDisplay =	"<h2>"+tFirstName+" "+tLastName+", "+tCompany+"</h2>" +
						"<p>"+tText+"</p>";

		document.getElementById("test").innerHTML = document.getElementById("test").innerHTML + textDisplay;	
	}
}

