function Fade(objID,CurrentAlpha,TargetAlpha,steps){
if (navigator.userAgent.indexOf('Gecko') != -1){ //if mozilla
continuefade="yes";
}else{
continuefade="yes";
}

if (continuefade="yes"){
		var obj = document.getElementById(objID);
		
		CurrentAlpha = parseInt(CurrentAlpha);
		if (isNaN(CurrentAlpha)){
			CurrentAlpha = parseInt(obj.style.opacity*100);
			if (isNaN(CurrentAlpha))CurrentAlpha=100;
		}
				
		var DeltaAlpha=parseInt((CurrentAlpha-TargetAlpha)/steps);
		var NewAlpha = CurrentAlpha - DeltaAlpha;
		
if (NewAlpha == 100 && (navigator.userAgent.indexOf('Gecko') != -1 && navigator.userAgent.indexOf('Safari') == -1)) NewAlpha = 99.99;
		obj.style.opacity = (NewAlpha / 100);
		obj.style.MozOpacity = obj.style.opacity;
		obj.style.KhtmlOpacity = obj.style.opacity;
		obj.style.filter = 'alpha(opacity='+NewAlpha+')';
		
		if (steps>1){
			setTimeout('Fade("'+objID+'",'+NewAlpha+','+TargetAlpha+','+(steps-1)+')', 50);
		}
}
}

function FadeIN(){
// I NEED TO SET THIS FADE IN FUNCTION TO BE ACTIVATED WHEN PREV. FUNC (makemod) IS COMPLETE
//alert("b fade in");
var timetomod = window.setTimeout("Fade('mainframe','',100,10)",500);
//	Fade('main','',100,10);
}
function FadeOUT(){
//alert("b fade out");
	Fade('mainframe','',0,10);
}

var timetomod="";
var timetofadein="";

function cleartimers(){
//alert("it went");
//alert (timetomod);
//if (timetomod!=""){
window.clearTimeout(timetomod);
//}
//if (timetofadein!=""){
window.clearTimeout(timetofadein);
//}
//alert(timetomod);
}

function modframe(newpage){
var current=frames['mainframe'].location.href;
if (current.indexOf(newpage)==-1){  //search 'current' for new page url
cleartimers();
FadeOUT();  //fade out
//alert(newpage);
//var newipage=newpage;
thisipage=newpage;
//alert(newipage);
var timetomod = window.setTimeout("makemod(thisipage)",800);
//setTimeout("makemod(thisipage)",800);
//setTimeout("alert(thisipage)",2000);
//alert("end");
}
}

function makemod(thesrc){
cleartimers();
//alert(thesrc);
var anchor="#i";  // individual image page anchor 
var frame='mainframe';
var current=frames[frame].location.href;
if (current.indexOf(thesrc)==-1){  //search 'current' for new page url
//frames['main'].location.href = thesrc+anchor;
document.getElementById("mainframe").src = thesrc;
//document.getElementById("mainframe").style.backgroundImage = 'url(/~pmwalsh/art-digital-imaging/images/flame.jpg)';
//parent.frames['mainframe'].document['body'].style.backgroundImage = 'url(/~pmwalsh/art-digital-imaging/images/color/flame.jpg)';
parent.frames['mainframe'].document['body'].style.backgroundColor = '#FF0000';
//var timetofadein = window.setTimeout("FadeIN()",800); 
//setTimeout("FadeIN()",800);  
}else{
//alert("new image is same as current");
}
}

