


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;
}

Array.prototype.in_array = function(search_term) {
  var i = this.length;
  if (i > 0) {
	 do {
		if (this[i] === search_term) {
		   return true;
		}
	 } while (i--);
  }
  return false;
}

function checkAll()
{
	checkboxElements = document.getElementsByTagName("input");

	for ( i=0; i<checkboxElements.length; i++ )
	{
		if ( "checkbox" == checkboxElements[i].getAttribute("type") )
		{
			checkboxElements[i].setAttribute("checked", "checked");
		}
	}
}

//uses firefox's console
function consoleLog(str)
{
 if (typeof console !== 'undefined') 
 {
	console.log(str);
 }
 
}