//
// Terry M. Byrd
// rotate.js
// June 2006
// Modified September 2006
// tmbyrd rev4
// function to update page content without a refresh 
// requires prototype and scriptaculous for special effects
//  
function tmb(url,target) {
	// xmlhttprequest object
	document.getElementById(target).innerHTML = ' ';    
	if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = function() {tmbDone(target);};
        req.open("GET", url, true);
        req.send(null);
    // if ie/win
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = function() {tmbDone(target);};
            req.open("GET", url, true);
            req.send();
        }
    }
}    
 
function tmbDone(target) {
    // if reqob loaded
    if (req.readyState == 4) {
        // if ok then go for it
        if (req.status == 200) {
            results = req.responseText;
            document.getElementById(target).innerHTML = results;
        } else {
            document.getElementById(target).innerHTML="tmb error:\n" +
                req.statusText;
        }
    }
}
 
function webheadone() {
	tmb('d/content.php?b=1', 'webhead');
	tmbDone('webhead');
	setTimeout("new Effect.Fade('webhead')", 6000);
	setTimeout("Transition1()", 7000); 
	}
 function Transition1() {
	webheadtwo();
	new Effect.Appear('webhead', { from: 0.0-0.5});
	}

function webheadtwo() {
	tmb('d/content.php?b=2', 'webhead');
	tmbDone('webhead');
	setTimeout("new Effect.Fade('webhead')", 6000); 
	setTimeout("Transition2()", 7000); 
	}
function Transition2() {
	webheadthree();
	new Effect.Appear('webhead', { from: 0.0-0.5 }); 
	}

function webheadthree() {
	tmb('d/content.php?b=3', 'webhead');
	tmbDone('webhead');
	setTimeout("new Effect.Fade('webhead')", 6000); 
	setTimeout("Transition3()", 7000); 
	}
function Transition3() {
	webheadfour();
	new Effect.Appear('webhead', { from: 0.0-0.5 }); 
	}

function webheadfour() {
	tmb('d/content.php?b=4', 'webhead');
	tmbDone('webhead');
	setTimeout("new Effect.Fade('webhead')", 6000); 
	setTimeout("Transition4()", 7000); 
	}
function Transition4() {
	webheadfive();
	new Effect.Appear('webhead', { from: 0.0-0.5 }); 
	}

function webheadfive() {
	tmb('d/content.php?b=5', 'webhead');
	tmbDone('webhead');
	setTimeout("new Effect.Fade('webhead')", 6000); 
	setTimeout("Transition5()", 7000); 
	}
function Transition5() {
	webheadsix();
	new Effect.Appear('webhead', { from: 0.0-0.5 });
	}

// stop here on last banner
function webheadsix() {
	tmb('d/content.php?b=6', 'webhead');
	tmbDone('webhead');
	}

// begin - start with banner one
window.onload = function() {
	webheadone();
	}
 
