var current_image = 0;
var next_image = 1;

var image = new Array();
var slogan = new Array();
var payoff = new Array();

function initEyesPoint() {
  
   image = $$(".EPImage");
   
	if(image.size()>1) { 
		payoff = $$(".EPTitle");
		slogan = $$(".EPSubTitle");
 
        for(i=0; i < image.length-1; i++) {
            image[i].style.display = "none";
            image[i].removeClassName("nodisplay");
            payoff[i].style.display = "none";
            payoff[i].removeClassName("nodisplay");
            slogan[i].style.display = "none";
            slogan[i].removeClassName("nodisplay");
        }
		Change();
	}
	
}

function Change() {
	 setTimeout("nextimage()", 5000);	
}

function nextimage() {

new Effect.Fade(slogan[current_image],{ duration: 0.3,
afterFinish: function() { 
    Effect.Fade(payoff[current_image],{ duration: 0.2}); 
    Effect.Fade(image[current_image],{ duration: 3.0});
     }
});


	new Effect.Appear(image[next_image], { duration: 3.0});
    new Effect.Appear(slogan[next_image], { duration: 1,queue: 'end'});
    new Effect.Appear(payoff[next_image], { duration: 2,
    afterFinish: function() { 
    if(next_image == (image.length-1)) {
		current_image = next_image;
		next_image = 0;
	} else {
		current_image = next_image;
		next_image++;
	}
	Change();
    }
    
    });
    
	
}
function resetBoxBot()
{
    var elms = $$(".BotBoxTT");Prototype.Browser
    var h = 0;
    elms.each(function (elm)
    {
        i = elm.getHeight();
        if (i>h) h = i;
    });
    if (h>245)
    {
        elms.each(function (elm)
        {   
            elm.setStyle(
            {
                minHeight: 'auto',
                height: h+'px'
            });
           // elm.previousSiblings()[0].style.bottom = '0px';
        });
    }
//    for(i=0; i < elm.length; i++)  
//        if (elm[i].clientHeight > h) h = elm[i].clientHeight;
//    if(h<245) h = 245;
//    for(i=0; i < elm.length; i++)  
//       elm[i].style.height = h +"px";c
 
     
}
Event.observe(window, 'load', function() {
    initEyesPoint();
    resetBoxBot();
    });
//Event.observe(window, 'resize', function() {
//    resetBoxBot();
//    });

