// Animation Controls
function extra_fadein() {
	if(extra_anitimer != 0){
		clearTimeout(extra_anitimer);	
	}
    if (extra_alphavalue < 100) {   
		extra_alphavalue += 20;
		//alert(alphavalue)
		document.getElementById('big_extra').style.opacity = extra_alphavalue/100;		
        extra_anitimer_a = setTimeout("extra_fadein()",100)
    }
    else {
	    clearTimeout(extra_anitimer_a)
		//waittimer = setTimeout("extra_fadeout()", waittimeronscreen);
		
	   //alert('fade out')
    }
}


function extra_fadeout() {
	//alert(ealphavalue )
	if(extra_wait_timer){
		clearTimeout(extra_wait_timer);	
	}
    if (extra_alphavalue > 0) {   
		extra_alphavalue -= 20;
		 document.getElementById('big_extra').style.opacity = (extra_alphavalue/100);
		//document.getElementById("extra_1").style.opacity = ealphavalue/100;
	     extra_anitimer = setTimeout("extra_fadeout()",100)
		//alert(ealphavalue)
    }
    else {
       clearTimeout(extra_anitimer);
	   document.getElementById('big_extra').style.display = 'none';
    }
}

function hideInformation(){
//	holderElement = document.getElementById('big_extra');		
//	holderElement.style.display = 'none';
	extra_fadeout();
	typer = false;

}





function efadeout() {
	//alert(ealphavalue )
	if(waittimer){
		clearTimeout(waittimer);	
	}
    if (ealphavalue >= 0) {   
		ealphavalue -= 20;
		target.style.opacity = (ealphavalue/100);
		//document.getElementById("extra_1").style.opacity = ealphavalue/100;
	     eanitimer= setTimeout("efadeout()",100)
		//alert(ealphavalue)
    }
    else {
       clearTimeout(eanitimer);
	   element.style.display = 'none';
    }
}

function efadein() {
    if (ealphavalue < 100) {   
		ealphavalue += 20;
		//alert(alphavalue)
		target.style.opacity = ealphavalue/100;		
        eanitimer= setTimeout("efadein()",100)
    }
    else {
	    clearTimeout(eanitimer)
		waittimer = setTimeout("efadeout()", waittimeronscreen);
		
	   //alert('fade out')
    }
}

function showextra(which){
	element = document.getElementById("extra_"+which);
	ealphavalue = 5;
	target = element;
	element.style.display = 'block';
	clearTimeout(eanitimer);
	target.style.opacity = 0;		
	efadein();

}

function hideextra(which){

	element = document.getElementById("extra_"+which);
	ealphavalue = 100;
	//alert(ealphavalue)
	target = element;
	efadeout();

}


function init() {
	//document.getElementById("infocontent").style.paddingTop = 1+'px';
	clearTimeout(movetimer);
	clearTimeout(anitimer);			
	
	fadeout();
}

var maxtop = -20;
var topnum;
var movetimer;
var moveto;


function movemessageup(){
	//alert('Move message up');
	//document.getElementById("infocontent").style.paddingTop = '0px';	
//	document.getElementById("infocontent").style.marginTop = maxtop+'px';
	
	if(topnum > maxtop){
		//alert(' maxtop: '+maxtop+' topnum: '+topnum)
		topnum --;
		document.getElementById("infocontent").style.marginTop = (maxtop)+'px';		
		document.getElementById("infocontent").style.paddingTop = topnum+'px';
		
		if(movetimer > 0){
			clearTimeout(movetimer);		
		}
		
		movetimer = setTimeout("movemessageup()",100);


	}else{
		//alert('clear mover')
		clearTimeout(movetimer);
	}
	
	
}
function movemessagedown(){
    if(movetimer > 0){
		//alert('movetimer: '+movetimer)
		clearTimeout(movetimer);
	}
	//alert('movetimer: '+movetimer)
	//alert('Move messaged down: '+document.getElementById("infocontent").style.paddingTop);
	topnum = (-1*maxtop);

	
	//document.getElementById("infocontent").style.paddingTop = '5px';
	//alert('After: '+document.getElementById("infocontent").style.paddingTop);
	if(top_mover == true){
		// vis PLUS +	
		document.getElementById("plus").style.display = 'block';
		// vis PLUS +

	
		}		document.getElementById("infocontent").style.marginTop = (maxtop)+'px';
		document.getElementById("infocontent").style.paddingTop = topnum+'px';
	
	/*
	if(topnum < 0){
		topnum += 1;
		document.getElementById("infocontent").style.paddingTop = topnum+'px';
		if(movetimer){
			clearTimeout(movetimer);		
		}
		movetimer= setTimeout("movemessagedown()",50)


	}else{
		clearTimeout(movetimer);
	}
	*/
	
}

	
var displayscroller;
function fadeout() {
    if (alphavalue > 0) {   
		alphavalue -= 10;
		/*
		if(fontsizes > 50){
			fontsizes-= 5;
		}
		*/
		//document.getElementById("information").style.fontSize = fontsizes+'%';
		document.getElementById("information").style.opacity = alphavalue/10;
		document.getElementById("information").style.filter = 'alpha(opacity='+ alphavalue*10+')';
        anitimer= setTimeout("fadeout()",100)

    }
    else {
		// back to margin top 0

		//alert(document.getElementById("infocontent").style.paddingTop)

		//movemessagedown();	
        clearTimeout(anitimer)
        clearTimeout(movetimer)		

        //movemessagedown();
		document.getElementById("infocontent").innerHTML = mainmessage;
		//document.getElementById("infocontent").style.paddingTop = topnum+'px';
		movemessagedown();		
		topnum = 0;		
		
        fadein();
		displayscroller = setTimeout("displayScroll()", textDisplaytime);


 
    }
}
function displayScroll(){
		movemessagedown();
		if(top_mover == true){
			// skjul PLUS +	
			document.getElementById("plus").style.display = 'none';		
			// skjul PLUS +
			top_mover = false;
			movemessageup();
			
		}		
}

function fadein() {

    if (alphavalue < 100) {
//		movemessagedown()
		alphavalue += 10;
		/*
		if(fontsizes < 90){
			fontsizes+= 5;
		}
		*/
		//document.getElementById("information").style.fontSize = fontsizes+'%';		
		document.getElementById("information").style.opacity = alphavalue/10;		
		document.getElementById("information").style.filter = 'alpha(opacity=' + alphavalue*10+')';
        anitimer= setTimeout("fadein()",100)
    }
    else {
		//alert(topnum)
        
		clearTimeout(anitimer);
	    if(movetimer > 0){
			//alert('movetimer: '+movetimer)
			clearTimeout(movetimer);
		}
		//topnum = 20;


		//movemessageup();			
		//alert('run top mover')

		
        //init();
    }
}


function fadeIn(){
	
	//flipper = new AppleInfoButton(document.getElementById("flipper"), document.getElementById("front"), "white", "white", showBack);
	//glassButton = new AppleGlassButton(document.getElementById("doneButton"), "Done", showFront);

	var fades = new Array;
	fades[0] = document.getElementById("eat");
	//fades[1] = document.getElementById("at");
	//fades[2] = document.getElementById("joes");
	transFader = new TransitionFader(fades, 250, 1000);
	transFader.start();
	alert('aye')
}
