// The 321MediaGroup Website
var menustat = new Array();


function setup () {
// setTimeout("blow('menupic1')", 500);
// setTimeout("blow('menupic2')", 600);
// setTimeout("blow('menupic3')", 700);
// setTimeout("blow('menupic4')", 800);
// setTimeout("blow('menupic5')", 900);
// setTimeout("blow('menupic6')", 1000);

hide('menupic1');
hide('menupic2');
hide('menupic3');
hide('menupic4');
hide('menupic5');
hide('menupic6');

menustat['menupic1'] = 1;
menustat['menupic2'] = 1;
menustat['menupic3'] = 1;
menustat['menupic4'] = 1;
menustat['menupic5'] = 1;
menustat['menupic6'] = 1;

}


function reveal (w) {
    menustat[w] = 1;
    opacity (w, 0, 100, 1000);
    show(w);
}

function shy(w) {
//  setTimeout("blow(w)", 1000);
//  setTimeout("hide(w)", 2000);
    hide(w);
}

function blow (w) {
    if (menustat[w] > 0) {
	 menustat[w] = 0;
	 opacity (w, 100, 0, 1000);
    }
}


function show (w) {
    if (document.getElementById) {
	var peek = document.getElementById(w);
	peek.style.visibility = 'visible';
    }
}

function hide (w) {
    if (document.getElementById) {
	var peek = document.getElementById(w);
	peek.style.visibility = 'hidden';
    }
}

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) { 
	    setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
	    timer++; 
	} 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 

