// JavaScript Document

var btn1_dom;
var btn2_dom;	
var btn3_dom;	
var prevBtn_dom;	
var nextBtn_dom;
var sectionsHolder_dom;
var numericControl_dom;			
//take this value from home.css
var widthSections = 705;

var sectionsScroll;

function scrollConfig(){

	var dinamicInfo_dom = document.getElementById("dinamicInfo");
	var divChilds = dinamicInfo_dom.getElementsByTagName("DIV");

	var i;
	for(i = 0; i < divChilds.length; i++){
		switch(divChilds[i].className){
			case "holder":
				sectionsHolder_dom = divChilds[i];
				break;
				
			case "previous":
				prevBtn_dom = divChilds[i].getElementsByTagName("A").item(0);
				break;
				
			case "next":
				nextBtn_dom = divChilds[i].getElementsByTagName("A").item(0);			
				break;
				
			case "numeric":
				numericControl_dom = divChilds[i];
				var numericBtnsList = divChilds[i].getElementsByTagName("A");
				btn1_dom = numericBtnsList.item(0);
				btn2_dom = numericBtnsList.item(1);	
				btn3_dom = numericBtnsList.item(2);
				break;
				
			default:
		};
	};
	
	var maxSections = 3;
	sectionsScroll = new ScrollEffect(sectionsHolder_dom, 900, 13);
	sectionsScroll.initScroll(widthSections, maxSections, numericControl_dom);

	//alert(sectionsScroll.wasInitScroll)
	
	btn1_dom.onclick = function(){
		sectionsScroll.doScroll("numericButton", 1);		
	};

	btn2_dom.onclick = function(){
		sectionsScroll.doScroll("numericButton", 2);		
	};
	
	btn3_dom.onclick = function(){
		sectionsScroll.doScroll("numericButton", 3);		
	};	
	
	prevBtn_dom.onclick = function(){
		sectionsScroll.doScroll("scrollArrow", -1);				
	};
	
	nextBtn_dom.onclick = function(){
		sectionsScroll.doScroll("scrollArrow", 1);				
	};	
};


if(window.addEventListener){
	window.addEventListener("load", scrollConfig, false);
}else{
	window.attachEvent("onload", scrollConfig);
};

