
$(document).ready(function() {
	var i = 0;
	var j = 0;
	imageX = new Array();
	img_1 = new Array();
	for (j = 1; j < 34; j++) {
		img_1[j] = "img/animation/"+j+".png";
	}
	for(i=1; i<34; i++) 
	{
		imageX[i] = new Image();
		imageX[i].src=img_1[i];
	}
	 
	timeoutVar = 100;
	img1 = new Image();
	img1.src = "img/club_news.png";
	img2 = new Image();
	img2.src = "img/club_news_hover.png";
	img3 = new Image();
	img3.src = "img/download_forms.png";
	img4 = new Image();
	img4.src = "img/download_forms_hover.png";

	//setTimeout(,7400+step*timeoutVar);
	for (step = 1; step < 34; step++) {
		setTimeout("dothemethod("+step+")",7400+step*timeoutVar);	
	}
});

function dothemethod(step) {

	var imgs = document.getElementById("imageWords").getElementsByTagName("img"); 
	if (step == 1) {
		//imgs[0].style.width = "240%";
		//imgs[0].style.height = "110%";
		//document.getElementById("image").style.width = 100%;
	}
	imgs[0].src = "img/animation/"+step+".png";

}
function handleTopper() {
		var topperManager = new jsAnimManager();
		topAnim = document.getElementById("topper");
		var animTop = topperManager.createAnimObject("topper");
		animTop.add({property: Prop.wait, duration: 4000});
		animTop.add({property: Prop.opacity, to:1, duration: 1000});
}
function handleRight() {
	var rightManager = new jsAnimManager();
	rightAnim = document.getElementById("rightArea");
	var animRight = rightManager.createAnimObject("rightArea");
	var rightBodyManager = new jsAnimManager();
	rightBodyAnim = document.getElementById("rightBody");
	var animRightBody = rightManager.createAnimObject("rightBody");	
	animRight.add({property: Prop.wait, duration: 4000});
	animRightBody.add({property: Prop.wait, duration: 5400});
	animRight.add({property: Prop.opacity, to: 1, duration: 1500});
	animRightBody.add({property: Prop.opacity, to: 1, duration: 500});
	animRight.add({property: Prop.width, to: 768, duration: 500});
	//animRight.add({property: Prop.opacity, to:1, duration: 500});
}	
function handleLeft() {
	var leftManager = new jsAnimManager();
	leftAnim = document.getElementById("leftNav");
	var animLeft = leftManager.createAnimObject("leftNav");
	animLeft.add({property: Prop.wait, duration: 5400});
	
	setTimeout("document.getElementById(\"leftNav\").style.display = \'block\'",5400);
	setTimeout("document.getElementById(\"bottomFootPic\").style.display = \'block\'",5400);
	
	animLeft.add({property: Prop.opacity, to:1, duration: 1500});
	setTimeout("document.getElementById(\"wrapper\").style.background = \'url(\"img/bg_left.png\") repeat-y scroll 0 0 transparent\'",5400);
}	
function onLoadFunc() {
	var manager = new jsAnimManager();
	logo = document.getElementById("image");
	var anim = manager.createAnimObject("image");
	var anim2 = manager.createAnimObject("image");
	var anim3 = manager.createAnimObject("image");
	var anim4 = manager.createAnimObject("bwLogoHolder");
	
	anim4.add({property: Prop.wait, duration: 8100});
	anim4.add({property: Prop.opacity, to: 1, duration: 2000});
	
	manager.registerPosition("image", false);  
	
	logo.setPosition(0,300);
	
	anim.add({property: Prop.opacity, to: 1, duration: 2000});
	anim.add({property: Prop.wait, duration: 500});
	anim2.add({property: Prop.wait, duration: 2500});
	anim3.add({property: Prop.wait, duration: 2500});
	
	var nextDur = 1000;
	var imgHeight = 396/1.6;
	var imgWidth = 437/1.7;
	anim.add({property: Prop.width, to: imgWidth, duration: nextDur});
	anim2.add({property: Prop.height, to: imgHeight, duration: nextDur});
	anim3.add({property: Prop.position, to: new Pos(-129, 126), duration: nextDur});
	


	
	handleTopper();
	handleRight();
	handleLeft();
	//handleAnimation();
}
