/* General Javascript tools */

function spoofer(emaildomain, emailuser)
{
    var emailaddr = emailuser + '@' + emaildomain;
    document.write('<a href="mailto: ' + emailaddr + '">' + emailaddr + '</a>');
}

function pageBack(Instance)
{
	var thisPage = document.getElementById('txtpage'+Instance).value;
	
	document.getElementById('txtpage'+Instance).value = thisPage-1;
	
	document.forms['frmPaging'+Instance].submit();
}

function pageForward(Instance)
{
	var thisPage = document.getElementById('txtpage'+Instance).value;
	
	document.getElementById('txtpage'+Instance).value = (thisPage * 1)+1;
	
	document.forms['frmPaging'+Instance].submit();
}

function changeResults(Instance)
{
	document.getElementById('frmPaging'+Instance).submit();
}

function checkPagingEnter(e,formid)
{
	var characterCode;

	if(e && e.which)
	{ 
		e = e;
		characterCode = e.which;
	}
	else
	{
		e = event;
		characterCode = e.keyCode;
	}

	if(characterCode == 13)
	{ //if generated character code is equal to ascii 13 (if enter key)
		document.getElementById(formid).submit(); //submit the form
		return false;
	}
	else
		return true;
}


//for site wide search box
function clearSearch(defaultsearchstring, searchboxname)
{
	if (document.getElementById && defaultsearchstring==document.getElementById(searchboxname).value)
		document.getElementById(searchboxname).value='';
}

function setSearch(defaultsearchstring, searchboxname)
{
	if (document.getElementById && ''==document.getElementById(searchboxname).value)
		document.getElementById(searchboxname).value=defaultsearchstring;
}

//functions for changing bg color of row when viewing committees
function commover(id)
{
	var nametd = document.getElementById(id+"_name");
	var linktd = document.getElementById(id+"_link");
	
	nametd.style.backgroundColor = '#D6D6D6';
	linktd.style.backgroundColor = '#D6D6D6';
}

function commout(id)
{
	var nametd = document.getElementById(id+"_name");
	var linktd = document.getElementById(id+"_link");
	
	nametd.style.backgroundColor = '#F1F1F1';
	linktd.style.backgroundColor = '#F1F1F1';
}


//popup the members of the committee that is clicked on
function popcommembers(id)
{
	window.open ('/committeemembers.php?r='+id,'members','toolbar=0, scrollbars=1, location=0, status=yes,  menubar=0, resizable=yes, width=450, height=350');
}