var MouseOverForecolor = 'RED';
var MouseOutForecolor = '#000000';
var MouseOverBackground='#ffffcc';
//var MouseOutBackgroundColor = MouseOverForecolor;
var MouseOutBackgroundColor='';
// This function accepts an input button object, and dynamically changes the
// background color, and the forecolor. This function should be called in response
// to the onMouseOver event of the input type button control.
// The color definitions(MouseOverForecolor and MouseOutForecolor) are stored in
// the styleIE.asp and styleNS.asp pages.
// [Note that this will ONLY work in IE4+, and not in Netscape]
function MouseOverHandler(btn) {
		btn.style.color=MouseOverForecolor;
		btn.style.backgroundColor=MouseOverBackground;
	}

// This function accepts an input button object, and dynamically changes the
// background color, and the forecolor. This function should be called in response
// to the onMouseOut event of the input type button control.
// The color definitions(MouseOverForecolor and MouseOutForecolor) are stored in
// the styleIE.asp and styleNS.asp pages.	
// [Note that this will ONLY work in IE4+, and not in Netscape]
function MouseOutHandler(btn) {
	btn.style.color=MouseOutForecolor;
	btn.style.backgroundColor=MouseOutBackgroundColor;
}
	
function isEmail(email) {
	var invalidChars = " /:,;";
	var atPos;
	var periodPos;
	var badChar;
		
	if (email == "") {
		return false;
	}
		
	for(i=0; i<invalidChars.length; i++) {
		badChar = invalidChars.charAt(i);
		if (email.indexOf(badChar,0) != -1) {
			return false;
		}
	}
		
	atPos = email.indexOf("@",1);
	if (atPos == -1) {
		return false;
	}
		
	if (email.indexOf("@",atPos+1) != -1) {
		return false;
	}
		
	periodPos = email.indexOf(".",atPos)
	if (periodPos == -1) {
		return false;
	}
		
	if (periodPos + 3 > email.length) {
		return false;
	}
		
	return true;
}

//Functions build for Immedient.com

	function ProcessBack() {
		window.history.go(-1);
	}

	function ProcessSave() {
		if (ValidateForm()) {
			document.forms[0].DoAction.value='N'
			document.forms[0].submit();
		}
	}
	function ProcessUpdate() {
		if (ValidateForm()) {
			document.forms[0].DoAction.value='U'
			document.forms[0].submit();
		}
	}
	function ProcessDelete() {
		document.forms[0].DoAction.value='D'
		document.forms[0].submit();
	}
	
	function CheckLength(FieldName,setLength) {
		var maxFieldLength=0;
		maxFieldLength=setLength;
		setLength = setLength - 1;
		
		if (FieldName.value.length==setLength)
		    alert('You have reached the Maxlength for this field which is ' + maxFieldLength + ' characters.');
	}

	function CheckFinalLength(FieldName,Size) {
		if (FieldName.value.length > Size) {
			alert('There is too much Text in field ' + FieldName.id + '.  The limit is ' + Size + ' Characters.');
			FieldName.select();
		}
	}
	
	function LaunchInCenter(url, name, height, width) {
	  var str = "height=" + height + ",innerHeight=" + height;
	  str += ",width=" + width + ",innerWidth=" + width;
	  if (window.screen) {
	    var ah = screen.availHeight - 30;
	    var aw = screen.availWidth - 10;

	    var xc = (aw - width) / 2;
	    var yc = (ah - height) / 2;

	    str += ",left=" + xc + ",screenX=" + xc;
	    str += ",top=" + yc + ",screenY=" + yc;
	  }
	  return window.open(url, name, str);
	}
	function ShowCalendar(ReturnTo,WhichOne) {
		LaunchInCenter('Calendar.asp?ReturnTo=' + ReturnTo,'',269,190);				
	}

	


