var $DOM = YAHOO.util.Dom;
var $EVENT = YAHOO.util.Event;



var myQuotes=new Array();
myQuotes[2]= "<p>" + "Emerald was selected as the sole provider for our expansion across EMEA and will be a fundamental part of our future growth. They have taken time to understand our current and future needs and always strive to deliver fast. I have no hesitation in recommending Emerald." + "</p>" + "<p class='testimonial'>" + "VP EMEA - FOUNDRY NETWORKS" + "</p>";
myQuotes[0]= "<p>" + "From director/managerial positions to technical experts, the quality and number of candidates presented by Emerald has been high. I have personally received great support from Emerald whilst building the organisation throughout Europe." + "</p>" + "<p class='testimonial'>" + "HR MANAGER - NOKIA NETWORKS" + "</p>";
myQuotes[1]= "<p>" + "Emerald has provided a consistently high level of service, in terms of excellent matching of candidates to company requirements, as well as ensuring an efficient and professional recruitment process, both for the Company, and for the candidates - I would not hesitate to recommend Emerald." + "</p>" + "<p class='testimonial'>" + "HR MANAGER - CITRIX SYSTEMS" + "</p>";

var myTitles=new Array();
myTitles[2]= "<h1>" + "Access Technology Innovators" + "</h1>" + "<p>" + "Emerald has a proven track record of delivering global search assignments for a client base that spans many of the foremost Venture Capital, Pre IPO, Service Providers and Global Organisations within the Technology, Media and Telecoms market." + "</p>";
myTitles[0]= "<h1>" + "Access Global Talent" + "</h1>" + "<p>" + "Emerald's unique value proposition and the most flexible delivery model available in the industry today enables leading technology innovators to access the highest calibre talent across EMEA, APAC, CALA & North America." + "</p>";
myTitles[1]= "<h1>" + "Access Industry Leading Expertise" + "</h1>" + "<p>" + "Emerald offers unparalleled expertise in the delivery of end-to-end Search and Selection, Human Resource and Value-Added Services for leading-edge technology organisations." + "</p>";



var keysquote = null;
var keystitle = null;
var turnquote = 0;
var spinquote = null;


function init() {
	// console.log('init');	
}


function fader() {
	
	//console.log(turnquote);
									  
switch(turnquote){
	case 0:
	YAHOO.util.Dom.setStyle('overhomepage', 'background-image', 'url(../image_assets/homepage_main_slab1.jpg)');
	break;
	case 1:
	YAHOO.util.Dom.setStyle('overhomepage', 'background-image', 'url(../image_assets/homepage_main_slab2.jpg)');
	break;
	case 2:
	YAHOO.util.Dom.setStyle('overhomepage', 'background-image', 'url(../image_assets/homepage_main_slab.jpg)');
	break;
	
	
}

//console.log(turnquote);

    ///////////////////////////////////////////////
	keystitle = $DOM.get('titlehomepage', 'div');
	keystitle.innerHTML = myTitles[turnquote];								 
	keysquote = $DOM.get('quotebox_text_homepage', 'div');
	keysquote.innerHTML = myQuotes[turnquote];
	///////////////////////////////////////////////


    var myAnim2 = new YAHOO.util.Anim('overhomepage', {
  	opacity: { to: 1} 
	}, 2, YAHOO.util.Easing.easeBothStrong);
    myAnim2.animate();
	
	var myAnim2 = new YAHOO.util.Anim('quotebox', {
  	opacity: { to: 0.4} 
	}, 2, YAHOO.util.Easing.easeBothStrong);
    myAnim2.animate();
	
	var myAnim2 = new YAHOO.util.Anim('titlehomepage', {
  	opacity: { to: 1} 
	}, 2, YAHOO.util.Easing.easeBothStrong);
    myAnim2.animate();
	
	var myAnim2 = new YAHOO.util.Anim('quotebox_text_homepage', {
  	opacity: { to: 1} 
	}, 2, YAHOO.util.Easing.easeBothStrong);
    myAnim2.animate();
	
	var myAnim2 = new YAHOO.util.Anim('quotebox_border_homepage', {
  	opacity: { to: 1} 
	}, 2, YAHOO.util.Easing.easeBothStrong);
    myAnim2.animate();

	
	if(turnquote == 2){
		turnquote = 0;
		}else{
		turnquote = turnquote+1; 	
		}
		



}



function timerquote(){
	
	
	spinquote = setInterval(function(){							 						 
	
var myAnim = new YAHOO.util.Anim('overhomepage', {
  	opacity: { to: 0} 
	}, 2, YAHOO.util.Easing.easeBothStrong);

var myAnimq = new YAHOO.util.Anim('quotebox', {
  	opacity: { to: 0} 
	}, 2, YAHOO.util.Easing.easeBothStrong);

var myAnimt = new YAHOO.util.Anim('titlehomepage', {
  	opacity: { to: 0} 
	}, 2, YAHOO.util.Easing.easeBothStrong);

var myAnimqth = new YAHOO.util.Anim('quotebox_text_homepage', {
  	opacity: { to: 0} 
	}, 2, YAHOO.util.Easing.easeBothStrong);

var myAnimqb = new YAHOO.util.Anim('quotebox_border_homepage', {
  	opacity: { to: 0}
	}, 2, YAHOO.util.Easing.easeBothStrong);

myAnim.onComplete.subscribe(myAnimq);
myAnimq.onComplete.subscribe(myAnimt);
myAnimt.onComplete.subscribe(myAnimqth);
myAnimqth.onComplete.subscribe(myAnimqb);
myAnimqb.onComplete.subscribe(fader);
    myAnim.animate();
	myAnimq.animate();
	myAnimt.animate();
	myAnimqth.animate();
	myAnimqb.animate();			 

	}, 10000);


}


function kicktimerquote(){
							 						 
	
var myAnim = new YAHOO.util.Anim('overhomepage', {
  	opacity: { to: 0} 
	}, 2, YAHOO.util.Easing.easeBothStrong);

var myAnimq = new YAHOO.util.Anim('quotebox', {
  	opacity: { to: 0} 
	}, 2, YAHOO.util.Easing.easeBothStrong);

var myAnimt = new YAHOO.util.Anim('titlehomepage', {
  	opacity: { to: 0} 
	}, 2, YAHOO.util.Easing.easeBothStrong);

var myAnimqth = new YAHOO.util.Anim('quotebox_text_homepage', {
  	opacity: { to: 0} 
	}, 2, YAHOO.util.Easing.easeBothStrong);

var myAnimqb = new YAHOO.util.Anim('quotebox_border_homepage', {
  	opacity: { to: 0}
	}, 2, YAHOO.util.Easing.easeBothStrong);

myAnim.onComplete.subscribe(myAnimq);
myAnimq.onComplete.subscribe(myAnimt);
myAnimt.onComplete.subscribe(myAnimqth);
myAnimqth.onComplete.subscribe(myAnimqb);
myAnimqb.onComplete.subscribe(fader);
    myAnim.animate();
	myAnimq.animate();
	myAnimt.animate();
	myAnimqth.animate();
	myAnimqb.animate();

}


$EVENT.onDOMReady(function(){						 
	
	keysquote = $DOM.get('quotebox_text_homepage', 'div');	
	keysquote.innerHTML = myQuotes[turnquote];
	keystitle = $DOM.get('titlehomepage', 'div');
	keystitle.innerHTML = myTitles[turnquote];
	
	if(keysquote != null){
		
    kicktimerquote();
	timerquote();
	
	
	}
	
});
