

/////////////////////////////////////////////////////////////////////
formName="";
function hideMForms(formName, state) {
//	alert('hide em: ' + formName);
	if(document.getElementById(formName))
	{
		state?document.getElementById(formName).style.visibility ="hidden":document.getElementById(formName).style.visibility ="visible";
	}
}


/////////////////////////////////////////////////////////////////////

function submitMe(formName) {
	var formObj = formName;
  //  alert(formObj);
    formObj.submit();
    return false;
}

/////////////////////////////////////////////////////////////////////

function isString(a) {
    return typeof a == 'string';
}

function isUndefined(a) {
    return typeof a == 'undefined';
} 

/////////////////////////////////////////////////////////////////////

function showList(id)
{
	var className = document.getElementById(id).className;

	if(className == 'Hide')
		document.getElementById(id).className = 'Show';
	else if(className == 'Show')
		document.getElementById(id).className = 'Hide';
}

/////////////////////////////////////////////////////////////////////

/*
function textField(id, text, replace)
{
	var textfield = document.getElementById(id);

	if(replace.length==0 && text==textfield.value)
		textfield.value='';
	else if(textfield.value.length==0)
		textfield.value=text;
}
*/

function textField(t, text)
{
	if(t.value==text)
		t.value='';
	else if(t.value=='')
		t.value=text;
}

/////////////////////////////////////////////////////////////////////

/*
function doSubmit(ID, Value)
{
	var item = document.getElementById(ID);
	if(item.value==Value)
		item.value='';
}
*/

function doSubmit(values)
{
	var fieldID;
	var fieldValue;
	var item;

	for(var i=0;values.length>i;i++)
	{
		fieldID=values[i]['id'];
		fieldValue=values[i]['value'];
		item = document.getElementById(fieldID);

		if(item.value==fieldValue)
			item.value='';
	}
}




/////////////////////////////////////////////////////////////////////

function displayBlock(id)
{
	if(document.getElementById(id)!=null && document.getElementById(id)!='undefined')
	{
		var ul = document.getElementById(id);
		if(ul.style.display=='none' || ul.style.display=='')
			ul.style.display='block';
		else if(ul.style.display=='block')
			ul.style.display='none';
	}
}

/////////////////////////////////////////////////////////////////////

function addClass(t, classValue)
{
	var item;
	
	if(isString(t))
		item = document.getElementById(t);
	else
		item = t;

	var itemClass = item.className;

	if(itemClass.length>0)
	{
		if(itemClass.search(classValue)>-1)
			item.className = itemClass.replace(classValue, '');
		else
			item.className+=' '+classValue;
	}
	else
		item.className=classValue;
}

/////////////////////////////////////////////////////////////////////

function popWindow(url)
{
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=768,height=227,left = 50%,top = 50%');");

}

/////////////////////////////////////////////////////////////////////

function alertWindow(t)
{
	url='popup.php?Email='+t//.firstChild.nodeValue;
	//alert(url);
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=300,height=285,left = 50%,top = 50%');");

}

/////////////////////////////////////////////////////////////////////


function syncMainCopy() 
{
	container = document.getElementById("content");
	alert(container);
	maincopy = document.getElementById("maincopy");
	alert(maincopy);
	wrapper = document.getElementById("wrapper");
	alert(wrapper);
	
	
	daPageHeight = wrapper.offsetHeight;
	daOffSetHeight = container.offsetHeight;
	//maincopy.top = maincopy.offsetTop;
	
	daTop = maincopy.offsetHeight;
	
alert(daPageHeight +' - ' +' - '+ daTop);
	maincopy.style.height = (daPageHeight - daTop) - 50+ "px";
}

/////////////////////////////////////////////////////////////////////

function addAlerts()
{
	var lnks = document.getElementsByTagName('a');
//	var val = 0;
	for(var i=0;lnks.length>i;i++)
	{
		var tmphref = lnks[i].href;
		if(tmphref.search('mailto:')>-1)
		{
		//	var newHref=tmphref.split(':');
		//	newHref=newHref[1];
		//	alert(newHref);
		//	lnks[i].href='javascript:;';
/* rewrote it so the function gets added correctly and that the mailto: address is grabbed from the href when the function is called.  also added a return false so you don't need to overwrite the default mailto href with a blank javascript call (That is an easy fix if the client requested that the emails be removed.*/
			lnks[i].onclick=function() {
				passhref = this.href.split(':');
				passhref = passhref[1];
				alertWindow(passhref); 
				return false;
			}
		}
	}
}

/////////////////////////////////////////////////////////////////////

window.onload = function() {
	window.onload;
	addAlerts();
	//syncMainCopy();
}


/////////////////////////////////////////////////////////////////////

