function addLoadEvent(func)
{

	var oldonload = window.onload;
	
	if ( typeof window.onload != "function" )
	{
		window.onload = func;
	}
	else
	{
		window.onload = function()
		{
			oldonload();
			func();
		}
	}
}


function chkEmail(value)
{
	var filter = /^.+@.+\..{2,3}$/;
	
	if ( !filter.test(value) )
	{
		return false;
	}
	
	return true;
}

function chkReferrerForm(theForm)
{
	var errMsg = "";

	if ( theForm.name1.value == "" && theForm.name2.value == "" && theForm.name3.value == "" && theForm.name4.value == "" )
	{
		alert("You haven't entered any friends!");
		return false;
	}

	if ( theForm.name1.value != "" && !chkEmail(theForm.email1.value) )
	{
		errMsg += "- please enter a valid email for mate 1\n";	
	}

	if ( theForm.name2.value != "" && !chkEmail(theForm.email2.value) )
	{
		errMsg += "- please enter a valid email for mate 2\n";	
	}

	if ( theForm.name3.value != "" && !chkEmail(theForm.email3.value) )
	{
		errMsg += "- please enter a valid email for mate 3\n";	
	}
	
	if ( theForm.name4.value != "" && !chkEmail(theForm.email4.value) )
	{
		errMsg += "- please enter a valid email for mate 4\n";	
	}		

	if ( errMsg )
	{
		alert("The following errors have occurred:\n" + errMsg);
		return false;
	}

	return true;

}

var logoImage = null;	
var footerImage = null;	
var headerImage = null;	
		
function init_opacity() 
{
	//logoImage = new OpacityObject('logo','/includes/images/furniture/main-logo');
	//logoImage.setBackground();

	footerImage = new OpacityObject('footer','/includes/images/furniture/main-footer');
	footerImage.setBackground();
}

function init_opacity_alt() 
{
		
	footerImage = new OpacityObject('logo','/includes/images/furniture/dashboard-footer');
	footerImage.setBackground();

	headerImage = new OpacityObject('header','/includes/images/furniture/dashboard-header');
	headerImage.setBackground();

}

function init_opacity_alt2() 
{
		


	headerImage = new OpacityObject('header','/includes/images/furniture/dashboard-header');
	headerImage.setBackground();

}
