// JavaScript Document
/* 
	Used to show all images over and over again
*/
var client = 0;
var testimonial = 0;
var fact = 0;

/**************************************
	Show clients
***************************************/
function showClients(){	
	//numbers of the images (they all are .jpg) - add numbers if more clients required
	var clients = new Array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47");
	var clientNames = new Array("Johnson &amp; Johnson","NHS","The Guardian","Glaxo Smith Kline","McCain","Barnardos","AXA","Hobsons","Scholl","Kellogg&lsquo;s","Next","FXL","PZ Cussons","Jus-Rol","BEC London","VisitBritain","Unilever","Media Edge cia","Colgate Palmolive","Buena Vista International","Accantia","Cadbury","Bakkavor","First Rate","BMPolyco Limited","rightmove.co.uk","Bird &amp; Bird","The Route Development Group","Caf&eacute; Direct","Toluna","The Buzzz","Southern Syringe Services","General Mills","Loseley","Mila Hardware UK","Strix","Pwb Health","Combined Insurance","Pets Kitchen","England Marketing","McCann Erickson","Tena","SCA","Highways Agency","Simple","Bodyform","Eolas International");	
	
	var clientImagesPath = "<img src='../images/clients/";	//path for all pages but the index
	if(document.getElementById("index")){ //if the page is the index
		clientImagesPath = "<img src='images/clients/"; //path for index
	}		
	//var html = clientImagesPath + clients[client] + ".jpg' alt='" + clientNames[client] + "'/>"; //build image path
	var html = clientImagesPath + clients[client] + ".jpg' alt='" + clientNames[client] + "'/>"; //build image path

	//check if the page is supposed to show the clients
	if(document.getElementById("client")){
		document.getElementById("client").innerHTML = html;  //change image within div
	}

	//if all clients have been shown then start again
	if(client < clients.length-1){
		client++; //next
	}else{
		client = 0; //go back to first
	}
	window.setTimeout('showClients()',1500); //"recursivity..." (call to itself each second and a half)
}

/**************************************
	Show testimonials
***************************************/
function showTestimonials(){	
	//all testimonials
	var testimonials = new Array(
		"As always, very efficiently planned and executed - nothing is too much trouble"
		,"From a research perspective the project went well, running to time and within budget, giving results in a very short timeline. The questionnaire was very innovative to keep  respondents interested and the team was responsive to changes we wished to make prior to going live"
		,"Excellent - fast, efficient, friendly, helpful - a breeze to work with"
		,"Efficient and speedy service - good relationship management and flexibility to meet changing needs, for example, when we had to put a hold on progress temporarily while we assessed the methodology in the prep stages of research"
		,"The project totally met our expectations, leading to very actionable results that gave us real direction of where to take the concepts. The team couldn't do enough for us and made sure that they had a complete understanding on the previous stage of research that fed into this one"
		,"You are just great, you always get it. Great questionnaire. Always very good attention to detail"
		,"Quick turnaround, flexibility during project set up and analysis went beyond addressing our objectives providing additional valuable insights"
		,"Very helpful, quick to respond - a grand job!"
		,"Very good in accommodating our needs within our tight budget and tight timeline. Added to this the complexity of the client being in Australia and the research needing to be done in the USA and I was impressed with the speed and quality of service and output I received"
		,"Value for money and understanding of the client objectives"
		,"You are all completely on top of your job and delivering 100%. Well Done. Keep up the great work"
		,"Just a quick note to thank you for the presentation last week, I have heard from my colleagues that it went very well and was very useful. They were impressed with your presentation and the work done in preparation so thanks for a job well done"
		,"Great communication and responsiveness"
		,"When the senior brand manager announces she wants to applaud at the end of the presentation you can be fairly confident the research has been debriefed well"		
		,"This was a bit different to our normal tracker but the team worked really closely with many stakeholders (both internally and externally from us) to ensure the best outcome!"
		,"You can have speed of delivery without compromising the quality of data or analysis"		
		,"The team did a really top job and pulled out all of the stops for us. They went the extra mile, and even carried out additional analysis for us to try and help us find the optimum mix of concepts which was really great and will really help the team going forward"				
	);
	//job titles
	var titles = new Array("", "", "", "", "", "Market Research Planner","","Insight Manager", "", "", "", "", "", "Marketing Intelligence Manager", "", "", "Brand Marketing Officer");
	//companies
	var companies = new Array("Accantia","Pets Kitchen","One MS","AXA","PZ Cussons","General Mills","Colgate-Palmolive","MDL Research","Plantation","Routes Development","Research Guidance","SSL International","Accantia","Colgate-Palmolive","Barnardo's","Ceuta Healthcare","PZ Cussons");
	
	//build testimonial
	var html = "&quot;" + testimonials[testimonial] + "&quot; <strong>" + companies[testimonial] + "</strong>. <i>" + titles[testimonial] + "</i>";

	//check if the page is supposed to show testimonials
	if(document.getElementById("testimonial")){
		document.getElementById("testimonial").innerHTML = html;  //change testimonial within div
	}
	
	//if all testimonials have been shown then start again
	if(testimonial < testimonials.length-1){		
		testimonial++; //next
	}else{
		testimonial = 0; //go back to first
	}
	window.setTimeout('showTestimonials()',7000); //"recursivity..." (call to itself each six seconds)	
}

/**************************************
	Show facts
***************************************/
function showFacts(){	
	//all facts
	var facts = new Array(
		"<strong>92%</strong> of our clients said they would probably or definitely recommend us."
		,"<strong>Two thirds</strong> of our clients said we were <strong>better</strong> than their other suppliers."
		,"We\'ve conducted research in over <strong>30</strong> countries."
		,"<strong>93%</strong> of our clients rated us 8, 9 or 10 out of 10 for <strong>Overall Satisfaction</strong>."
		,"<strong>83%</strong> of our clients rated us 8, 9 or 10 out of 10 for <strong>Value for Money</strong>."
	);
	
	//check if the page is supposed to show the clients
	if(document.getElementById("fact")){
		document.getElementById("fact").innerHTML = facts[fact];  //change fact within div
	}

	//if all clients have been shown then start again
	if(fact < facts.length-1){
		fact++; //next
	}else{
		fact = 0; //go back to first
	}
	window.setTimeout('showFacts()',7000); //"recursivity..." (call to itself each second and a half)
}

/**************************************
	Start timers to show everything
***************************************/
function activateClients(){
  	setTimeout('showClients()',1);
	setTimeout('showTestimonials()',1);
	setTimeout('showFacts()',1);	
}
window.onload = activateClients; //start the timer

/**************************************
	Text used on every page of the website is being sent from Javascript, so if we need to change
	the text we do it here and we don't have to do it on every page there is
***************************************/
function registered_txt(){
	//document.write('Registered in England No. 5509933 Vat No. GB 878978033'); //Qubiq Online Limited
	document.write('Registered in England No. 4182527 Vat No. GB 793289673');
}
