// write to layer

function writeto(name, message) {
    if (document.layers) {
        document.layers[name].document.close();
        document.layers[name].document.write(message);
        document.layers[name].document.close();
    } else {
        if (document.all) {
            eval("document.all." + name + ".innerHTML='" + message + "'");
        } else {
            document.getElementById(name).innerHTML = message;
        }
    }
}

// image fade

function high(which2) {
	theobject=which2;
	highlighting=setInterval("highlightit(theobject)",50);
}

function low(which2) {
	clearInterval(highlighting);
	if (which2.style.MozOpacity) which2.style.MozOpacity=0.3;
	else if (which2.filters) which2.filters.alpha.opacity=30;
}

function highlightit(cur2) {
	if (cur2.style.MozOpacity<1) cur2.style.MozOpacity=parseFloat(cur2.style.MozOpacity)+0.10;
	else if (cur2.filters&&cur2.filters.alpha.opacity<100) cur2.filters.alpha.opacity=parseFloat(cur2.filters.alpha.opacity)+25;
	//else if (cur2.filters&&cur2.filters.alpha.opacity<100) cur2.filters.alpha.opacity+=25;
	else if (window.highlighting) clearInterval(highlighting);
}

// toggle display/hide

function toggle( targetId ){
	ie4 = (document.all)? true:false
	ns6 = (!document.all && document.getElementById)?true:false
	if (ie4){
  		target = document.all[targetId];
  			if (target.style.display == "none"){
				document.all["being"].style.display = "none";
				document.all["loving"].style.display = "none";
				document.all["saving"].style.display = "none";
				document.all["sharing"].style.display = "none";
				document.all["interacting"].style.display = "none";
  				target.style.display = "";
  			} 
			else {
  				target.style.display = "none";
  			}
  	}
	else if (ns6){
  		target = document.getElementById(targetId);
  			if (target.style.display == "none"){
				document.getElementById("being").style.display = "none";
				document.getElementById("loving").style.display = "none";
				document.getElementById("saving").style.display = "none";
				document.getElementById("sharing").style.display = "none";
				document.getElementById("interacting").style.display = "none";
  				target.style.display = "";
  			} 
			else {
  				target.style.display = "none";
  			}
  	}
}

// random image

function rand() {
	var randnum1 = Math.floor(Math.random()*3);
	var randnum = randnum1 + 1;
	document.write(randnum);
}
