
    // changes the field class to error 
    function showErrorCss( FieldName )
    {
        document.getElementById(FieldName).className = 'error';
    }
    
	
	// used to turn a field on for display 
    function displayField( FieldId, displayFlag )
	{
        if (displayFlag == 1)
        {
            document.getElementById(FieldId).style.display = 'block'
        } else {
            document.getElementById(FieldId).style.display = 'none'
        }
    }
	
	// if you cant figure it out, please pack up your stuff and leave!! ;)~
	function redirect(url)
	{
		window.location = url;
		return true;
	}	

	// up to you to go through and edit. 
	function clearDefaultFields(form)
	{	
		form.EmailAddress.value = (form.Salutation.value == 'Email')? '' : form.Email.value;
		form.FirstName.value = (form.FirstName.value == 'First Name')? '' : form.FirstName.value;
	}		
	
	function valTest( fld, val ) 
	{
		fld.value=(fld.value==val?"":fld.value==""?val:fld.value)
	}	
	
	function unCheckCheckBoxes ( calling_id, form_id, array )
	{
		
		var FullJoinChecks 	= $('ListBox').getElements('input[name^=ListId]') ;
		ImageIdCount = 15;
		
		FullJoinChecks.each(function(el, i) {
			if ( el.id != calling_id ) {
			ImageIdCount = ImageIdCount + i ;
			var ImgElement = 'checkImage' + ImageIdCount ;
			$('checkImage13').setProperty('src') = '/_includes/templates/default/images/check_off.gif' ;
			el.checked = false;
				
			}
		}, null);		
	
	}
	
	
	/* handles redirection of user to the unsub process page */
	function UnsubUser( UserEmail, testing, MID )
	{
		/* pass true here to pass a testing flag to process page, this will skip the actual submission to elabs */
		if ( testing ) 
		{
			var TestingFlag = '&SkipElabs=true' ;
		}
		
		/* we need the users email */
		if ( UserEmail )
		{
			/* url to the process page */
			var unsubProcessPage = '/_includes/process/_includes_process_unsub.php' ;
			
			/* check if the testing flag was set, if so append the testing flag to skip elabs */
			if ( typeof TestingFlag != 'undefined' )
			{
				var url = unsubProcessPage + '?email=' + UserEmail + TestingFlag + '&MID=' + MID ;
			} else {
				var url = unsubProcessPage + '?email=' + UserEmail  + '&MID=' + MID ;
			}
			
			/* use redirect function to redirect to the url */
			redirect(url);
		}
	}
	
	function ElementHide ( element )
	{
		if ( typeof element != 'undefined' ) 
		{
            document.getElementById(element).style.display = 'none'
		}
	
	}
	
	
	function ElementShow ( element )
	{
		if ( typeof element != 'undefined' ) 
		{
            document.getElementById(element).style.display = 'block'
		}
	
	}
	
	
	
	
