window.addEvent('domready', function(){
	
	var rollovers = $$('.roll');
	
	for(var i=0; i<rollovers.length; i++){
		
		var fileName = rollovers[i].get('src');
		
		rollovers[i].set('sourceFile', fileName.substr(0, fileName.length - 4));
		rollovers[i].set('sourceExt', fileName.substr(fileName.length - 4));
		
		rollovers[i].addEvent('mouseenter', function(){
			this.set('src', this.get('sourceFile') + '-over' + this.get('sourceExt'));
		});
		
		rollovers[i].addEvent('mouseleave', function(){
			this.set('src', this.get('sourceFile') + this.get('sourceExt'));
		});
			
	}
	
});

function SwapImage(iImg, iID)
{
	document.images[iID].src	= iImg;
}

function ShowDropDown(iButton, iMenu, iImg)
{
	// X and Y Coordinate Variables
	var X	= 0;
	var Y	= 0;

	// Get the Menu Cell
	var MenuDiv				= document.getElementById(iMenu);
		
	// Set it to be Visible to the User
	MenuDiv.style.position		= "absolute";
	MenuDiv.style.visibility	= "visible";
	MenuDiv.style.display		= "block";
	
	// Get the Mouse Position
	var MenuButton			= document.getElementById(iButton);
	
	// Change the Menu Button Image
	MenuButton.style.backgroundImage = "url(" + iImg + ")";
	MenuButton.style.backgroundRepeat = "no-repeat";
	MenuButton.style.backgroundPosition = "center";

	while (MenuButton != null)
	{
		Y += MenuButton.offsetTop;
		X += MenuButton.offsetLeft;
		MenuButton = MenuButton.offsetParent;
	}

	MenuDiv.style.left			= X + "px";
	MenuDiv.style.top			= (Y + 28) + "px";
}

function HideDropDown(iMenu, iButton)
{
	// Get the Menu Cell
	var MenuDiv					= document.getElementById(iMenu);
	
	// Set the Style
	MenuDiv.style.visibility	= "hidden";
	
	// Get the Mouse Position
	var MenuButton			= document.getElementById(iButton);
	
	// Change the Menu Button Image
	MenuButton.style.backgroundImage = "none";
}

function DeleteItem(iPage, iMessage)
{
	var confirmed = window.confirm(iMessage);
	if (confirmed)
	{
		window.location = iPage;
	}
}

function CharLeft(Form, Field, Limit)
{
	var iForm	= document.forms[Form].elements[Field];
	var iChar	= document.getElementById('CharRem');
	var iRem	= Limit - iForm.value.length;
	
	iChar.innerHTML = iRem + " Characters Remaining";
	
	if (iRem < 0)
	{
		iForm.value = iForm.value.substr(0, Limit);
	}
}