
/**********************************************************************************   
AnimationIntro 
*   Copyright (C) 2001 Thomas Brattli
*   This script was released at DHTMLCentral.com
*   Visit for more great scripts!
*   This may be used and changed freely as long as this msg is intact!
*   We will also appreciate any links you could give us.
*
*   Made by Thomas Brattli
*
*   Script date: 09/04/2001 (keep this date to check versions) 
*********************************************************************************/
function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=lib_bwcheck()

/***************************************************************************
Variables to set.

Remember that if you want another font, font-size or whatever you set 
that in the .clDivs class in the styletag!
****************************************************************************/
numberOfLetters=4 //How many letters do you have

ypos=0 //The Y position of the letters, relative to the center

//The x positions of the letters, relative to center.
//This is the tricky part, when you change font-size or type and letters 
//be sure to play with the values in this array, if not your letters
//will not arrange correctly. (note the testing variable)
xpos=new Array()
xpos[0] = 0
xpos[1] = 0
xpos[2] = 0
xpos[3] = 0

//To make the xpos a little simpler to set you can set this value to 1
//If you do no animation will happen, but the letters will place themself
//where they will end at the end of the animation. 
testing=0

//There are 3 different animation you can use.
//Set this variable to 1,2 or 3 for the different ones,
//or set it to 4 for random
animation=4

aspeed=10 //The timer animation speed. 


/********************************************************************************
Object constructor
********************************************************************************/
function makeObj(obj,speed,xmove,ymove,works){
	this.el=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;	
  	this.css=bw.dom || bw.ie4?this.el.style:bw.ns4?this.el:0;
	this.moveIt=b_moveIt;
}

// A unit of measure that will be added when setting the position of a layer.
var px = bw.ns4||window.opera?"":"px";

function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x+px; this.css.top=this.y+px;}
/***************************************************************************
Initiating page and starting animation
****************************************************************************/
var posArray,oZdivs;
function introInit(){
//	pageXcenter = bw.op5||bw.ns4 ||bw.ns6?innerWidth/2:document.body.offsetWidth/2
//	pageYcenter = bw.op5||bw.ns4||bw.ns6?innerHeight/2:document.body.offsetHeight/2
	pageYcenter = 0
	pageXcenter = 392

	oZdivs = new Array()
	for(var i=0; i<numberOfLetters; i++){
		oZdivs[i] = new makeObj('div'+i)
		oZdivs[i].moveIt(1000,0)
		oZdivs[i].css.visibility = "visible"
	}
	if (animation==5) animation = Math.round(Math.random()*2)+1
	if (!testing) eval('anim4(0)')
	else testIt()
}
function testIt(){
	alert(pageYcenter)
	for(var i=0; i<oZdivs.length; i++){
    	oZdivs[i].moveIt((pageXcenter+xpos[i]),(pageYcenter+ypos))
	}	
}
/***************************************************************************
Intro 4
****************************************************************************/
xPath4 = new Array(1710,1600,1490,1300,1185,1080,980,880,795,720,665,605,550,500,450,405,360,320,290,265,230,200,175,150,128,110,95,80,66,52,40,30,25,15,10,5,0)
yPath4 = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
function anim4(num){
	if (num<oZdivs.length){
		animX(num,'xPath4','yPath4',aspeed,0,'anim4('+(num+1)+')')
	}else endanim(0)
}
/***************************************************************************
Animation function
****************************************************************************/
function animX(divnum,arrayX,arrayY,speed,num,fn){
	arrayXr = new Array(); arrayYr = new Array()
	arrayXr = eval(arrayX); arrayYr = eval(arrayY)
	arrayX = "'"+arrayX+"'"; arrayY = "'"+arrayY+"'"

	pageX = bw.op5||bw.ns4 ||bw.ns6?innerWidth:document.body.offsetWidth;

	if (num<arrayXr.length){
			if(arrayXr[num]+(pageXcenter+xpos[divnum]) <= pageX - 190) {

    	oZdivs[divnum].moveIt(arrayXr[num],arrayYr[num]+(pageYcenter+ypos))
		}
		num ++;
		setTimeout("animX("+divnum+","+arrayX+","+arrayY+","+speed+","+num+",'"+fn+"')",speed)
	}else eval(fn)
}
/***************************************************************************
This is what happens when the animation is over. If
you want something else to happen edit here!
****************************************************************************/
function endanim(num){

		var flag;
		flag = new makeObj('flag')
		flag.css.left = pageXcenter + xpos[3];
		flag.css.visibility = "visible"

}

/***************************************************************************
Starting the intro when the page is loaded.
****************************************************************************/
onload = introInit;
