function clsOneProject(projectName, titleTagName)
{
	this.ProjectName = projectName;
	this.TitleTag = titleTagName;
	this.ProjCaption = '';
	this.ProjSubCaption = '';
	this.ProjDetails = '';
	this.ProjDescription = '';
	this.TagNames = new Array();
	this.InactiveThumbs = new Array();
	this.ActiveThumbs = new Array();
	this.LargeImgs = new Array();
	this.SetCount = 0;
}

function fAddProject(projectName, titleTagName)
{
	this.arrProjects[this.ProjectCount] = new clsOneProject(projectName, titleTagName);
	this.ProjectCount = this.ProjectCount + 1;
}

function fAddImageSet(projectName, tagName, inactiveThumb, activeThumb, largeImage)
{
	for (var i = 0; i < this.ProjectCount; i++)
	{
		if (this.arrProjects[i].ProjectName == projectName)
		{
			var j = this.arrProjects[i].SetCount;
			this.arrProjects[i].TagNames[j] = tagName;
			this.arrProjects[i].InactiveThumbs[j] = new Image();
			this.arrProjects[i].InactiveThumbs[j].src = inactiveThumb;
			this.arrProjects[i].ActiveThumbs[j] = new Image();
			this.arrProjects[i].ActiveThumbs[j].src = activeThumb;
			this.arrProjects[i].LargeImgs[j] = new Image();
			this.arrProjects[i].LargeImgs[j].src = largeImage;
			this.arrProjects[i].SetCount = j + 1;
		}
	}
}

function fAdvanceCurrentProject(iIncrement)
{
	var newIndex = this.iCurrentProject + iIncrement;
	
	if (newIndex >= this.ProjectCount)
	{
		newIndex = 0;
	}
	
	if (newIndex < 0)
	{
		newIndex = this.ProjectCount - 1;
	}
	
	this.SetCurrentProject(this.arrProjects[newIndex].ProjectName);
}

function fSetCurrentProject(projectName)
{
	for (var i = 0; i < this.ProjectCount; i++)
	{
		if (this.arrProjects[i].ProjectName == projectName)
		{
			this.CurrentProject = projectName;
			this.iCurrentProject = i;
			
			document.getElementById(this.arrProjects[i].TitleTag).className = 'projects_nav_current';
			document.getElementById(this.arrProjects[i].ProjDetails).style.display = 'inline';
			document.getElementById(this.arrProjects[i].ProjDescription).style.display = 'inline';
			
			for (var j = 0; j < this.arrProjects[i].SetCount; j++)
			{
				document.images[this.arrProjects[i].TagNames[j]].src = this.arrProjects[i].InactiveThumbs[j].src;
				if (j == 0)
				{
					document.images[this.LargeImgTagName].src = this.arrProjects[i].LargeImgs[0].src;
				}
			}
		}
		else
		{
			document.getElementById(this.arrProjects[i].TitleTag).className = 'projects_nav';
			document.getElementById(this.arrProjects[i].ProjDetails).style.display = 'none';
			document.getElementById(this.arrProjects[i].ProjDescription).style.display = 'none';
		}
	}
	document.getElementById(this.CaptionTagName).innerHTML = this.arrProjects[this.iCurrentProject].ProjCaption;
	document.getElementById(this.SubCaptionTagName).innerHTML = this.arrProjects[this.iCurrentProject].ProjSubCaption;
	//document.getElementById(this.DetailsTagName).innerHTML = this.arrProjects[this.iCurrentProject].ProjDetails;
	//document.getElementById(this.DescriptionTagName).innerHTML = this.arrProjects[this.iCurrentProject].ProjDescription;
	
	document.getElementById('aGhost').focus();
}

function fMouseOver(tagName)
{
	var iProject = this.iCurrentProject;
	
	for (var iSet = 0; iSet < this.arrProjects[iProject].SetCount; iSet++)
	{
		if (this.arrProjects[iProject].TagNames[iSet] == tagName)
		{
			document.images[tagName].src = this.arrProjects[iProject].ActiveThumbs[iSet].src;
		}
	}
}

function fMouseOut(tagName)
{
	var iProject = this.iCurrentProject;
	
	for (var iSet = 0; iSet < this.arrProjects[iProject].SetCount; iSet++)
	{
		if (this.arrProjects[iProject].TagNames[iSet] == tagName)
		{
			document.images[tagName].src = this.arrProjects[iProject].InactiveThumbs[iSet].src;
		}
	}
}

function fClick(tagName)
{
	var iProject = this.iCurrentProject;
	
	for (var iSet = 0; iSet < this.arrProjects[iProject].SetCount; iSet++)
	{
		if (this.arrProjects[iProject].TagNames[iSet] == tagName)
		{
			document.images[this.LargeImgTagName].src = this.arrProjects[iProject].LargeImgs[iSet].src;
		}
	}
	document.getElementById('aGhost').focus();
}

function fSetTagNames(tagName, tagCaption, tagSubCaption, tagDetails, tagDescription)
{
	this.LargeImgTagName = tagName;
	this.CaptionTagName = tagCaption;
	this.SubCaptionTagName = tagSubCaption;
	this.DetailsTagName = tagDetails;
	this.DescriptionTagName = tagDescription;
}

function fSetProjectDetails(projectName, caption, subCaption, details, description)
{
	for (var i = 0; i < this.ProjectCount; i++)
	{
		if (this.arrProjects[i].ProjectName == projectName)
		{
			this.arrProjects[i].ProjCaption = caption;
			this.arrProjects[i].ProjSubCaption = subCaption;
			this.arrProjects[i].ProjDetails = details;
			this.arrProjects[i].ProjDescription = description;
		}
	}
}

function clsProjects()
{
	this.arrProjects = new Array();
	this.ProjectCount = 0;
	this.AddProject = fAddProject;
	this.AddImageSet = fAddImageSet;
	this.CurrentProject = '';
	this.iCurrentProject = -1;
	this.SetCurrentProject = fSetCurrentProject;
	this.AdvanceCurrentProject = fAdvanceCurrentProject;
	this.LargeImgTagName = '';
	this.CaptionTagName = '';
	this.SubCaptionTagName = '';
	this.DetailsTagName = '';
	this.DescriptionTagName = '';
	this.SetTagNames = fSetTagNames;
	this.MouseOver = fMouseOver;
	this.MouseOut = fMouseOut;
	this.Click = fClick;
	this.SetProjectDetails = fSetProjectDetails;
}

var Projects = new clsProjects();
var preLoadedImages = new Array();

function preLoadImgs()
{
	if (document.images)
	{
		for (var i = 0; i < preLoadImgs.arguments.length; i++)
		{
			preLoadedImages[i] = new Image();
			preLoadedImages[i].src = preLoadImgs.arguments[i];
		}
	}
}

function swapImg(imgtagid, filename)
{
	if (document.images)
	{
		var n = navigator.appName;
		var v = parseInt(navigator.appVersion);
		var browsok = ((n == "Netscape") && (v >= 3));
		var browsok2 = ((n == "Microsoft Internet Explorer") && (v >= 4));
		if ((browsok) || (browsok2))
		{
			document.images[imgtagid].src = filename;
		}
	}
}




