// JavaScript Document

function hide(id){
	if(document.getElementById(id).className != "hide"){
		document.getElementById(id).className = "hide";
	}else{ }
}
function show(id){
	if(document.getElementById(id).className == "hide"){
		document.getElementById(id).className == "";
	}else{ }
}

// Functions to fade objects in and out.  Thanks to brainerror.net
function fade(id, startAlpha, endAlpha, millisec){
	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(startAlpha > endAlpha) {
        for(i = startAlpha; i >= endAlpha; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
		setTimeout(function(){document.getElementById(id).className = "hide";}, millisec);
    } else if(startAlpha < endAlpha) {
        for(i = startAlpha; i <= endAlpha; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
} 

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 + ")";
}

function slideOut(id, triggerId, startPixels, endPixels, orientation){
	var obj = document.getElementById(id);
	var o = orientation;
	var st = startPixels;
	var end = endPixels;
	var trig = document.getElementById(triggerId);
	var t = 0;
	if(o == "v"){
		if(obj.className == "closed"){
			for(i = st; i <= end; i++){
				setTimeout("slideV('"+id+"', '"+i+"')", t);
				t++;
			}
			obj.className = "open";
	
		}else if(obj.className == "open"){
			for(i = end; i > 0; i--){
				setTimeout("slideV('"+id+"', '"+i+"')", t);
				t++;
			}
			obj.className = "closed";
		}else{}
	}else if (o == "h"){
		if(obj.className == "closed"){
			for(i = st; i <= end; i++){
				setTimeout("slideH('"+id+"', '"+i+"')", t);
				t++;
			}
			obj.className = "open";
	
		}else if(obj.className == "open"){
			for(i = end; i > 0; i--){
				setTimeout("slideH('"+id+"', '"+i+"')", t);
				t++;
			}
			obj.className = "closed";
		}else{}
	}
}		

function slideV(id, count){
	document.getElementById(id).style.height = count +"px";
}

function slideH(id, count){
	document.getElementById(id).style.width = count +"px";
}


