var delay=50;
var percent=5;
var alpha1=100, alpha2=0,alpha3=0,alpha4=0,max=100;
var oneToTwo=true;
var twoToThree=false;
var threeToFour=false;
var fourToOne=false;
var timer=false;
var step=percent*max/100;

window.onresize=bottom;

function setOpacity(domId, val) {
  obj = document.getElementById(domId);
  if (val==0) obj.style.visibility='hidden';
  else obj.style.visibility='visible';
  obj.style.opacity = val/100;
  obj.style.filter = 'alpha(opacity=' + val + ')';
}
function startAnimation() {
	delay1=delay;
	setOpacity("seed1",alpha1);
	setOpacity("seed2",alpha2);
	if (oneToTwo) {alpha1+=step; alpha2-=step;}
	else {alpha1-=step; alpha2+=step;}
	if (oneToTwo && alpha1>=max){oneToTwo=false;delay1=2000;}
	else if (!oneToTwo && alpha1<=0){oneToTwo=true;delay1=2000;}
	timer=setTimeout(startAnimation, delay1);
}
function startAnimation4() {
	delay1=delay;
	setOpacity("seed1",alpha1);
	setOpacity("seed2",alpha2);
	setOpacity("seed3",alpha3);
	setOpacity("seed4",alpha4);

	if (oneToTwo) {alpha1-=step; alpha2+=step;}
	else if(twoToThree){alpha2-=step;alpha3+=step;}
	else if(threeToFour){alpha3-=step;alpha4+=step;}
	else if(fourToOne){alpha4-=step;alpha1+=step;}
	
	if (oneToTwo && alpha2>=max){oneToTwo=false;delay1=2000;twoToThree=true;}
	else if (twoToThree && alpha3>=max){ 	
		twoToThree=false;delay1=2000;threeToFour=true;
	}
	else if(threeToFour && alpha4>=max){
		threeToFour=false;delay1=2000;fourToOne=true;
	}
 	else if(fourToOne && alpha1>=max){
		fourToOne=false;delay1=2000;oneToTwo=true;
	}	
	timer=setTimeout(startAnimation4, delay1);

}
function getBrowserHeight() {
        if (window.innerHeight) return window.innerHeight;
        else if (document.documentElement && document.documentElement.clientHeight != 0) return document.documentElement.clientHeight;
        else if (document.body) return document.body.clientHeight;
        return 0;
}
function getBrowserWidth() {
        if (window.innerWidth) return window.innerWidth;
        else if (document.documentElement && document.documentElement.clientWidth != 0) return document.documentElement.clientWidth;
        else if (document.body) return document.body.clientWidth;
        return 0;
}
function bottom(){
	var fht=130;
	var hht=200;
	var cht=getBrowserHeight()-fht-hht-txtht;
	var content=document.getElementById("textDiv");
	if(content) content.style.height=cht+"px";

	var bwid=getBrowserWidth();
	if (bwid<800) bwid=800;
	else if (bwid>1024) bwid=1024;
	if(content) {
		content=document.getElementById("textDiv");
		content.style.width=(bwid-420)+"px";
	}
	content=document.getElementById("footerDiv");
	content.style.width=(bwid-30)+"px";
}


