var final = 1;
var final2 = final-.20;
var current = 0;
var fps = .07;
var ie = (document.all) ? 1 : 0;
var p = (ie) ? "filter" : "MozOpacity";

/* n is the element node
   v is the opacity value, from 0 to 1. */

function op(n,v){
    v = (ie) ? "alpha(opacity="+Math.round(v*100)+")" : v;

    if (n!=null) {
    	n.style[p] = v;
    }
}

function animate() {
	phase1(1);
}

function phase1(x) {
	h1 = self.header.document.getElementsByTagName('h1');
	el = h1[0];
/*	for (a in el.style) {
		txt=txt+a + ' = ' +el[a] +'<br>';
	}
	alert('');
*/
	if (current<final) {
		current += fps;
//		el.style.left=current;
		op(el, current);
		setTimeout("phase1("+x+")", 100);
	} else if (x==1) {
		phase2();
	}
/*
	wnd = window.open();
	wnd.document.write(txt);
	wnd.document.close();
	*/
}

function phase2() {

	h1 = self.header.document.getElementsByTagName('h1');
	el = h1[0];
	if (current>final2) {
		current -= fps;
		op(el, current);
		setTimeout("phase2()",100);
	} else {
		phase1(0);
	}
}
