/**
 * Project:     
 * File:        
 * @author:     Michael D. Wailes   mwailes@holonyx.com
 * Version:     
 * Description: 
 *
 */

// JavaScript Document
/*--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--*/
/*
* This function controls the visibility of any element that is passed to it
* by way of a toggle switch. Exp: Click and you see it, click again and you don't */
function toggleON(thisElement){
	document.getElementById(thisElement).style.display = '';
        
}
/*--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--*/

/*--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--*/
/*
* This function controls the visibility of any element that is passed to it
* by way of a toggle switch. Exp: Click and you see it, click again and you don't */
function toggleOFF(thisElement){
	document.getElementById(thisElement).style.display = 'none';
        	}

/*--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--*/



/*--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--*/
/*
* This function controls the visibility of any element that is passed to it
* by way of a toggle switch. Exp: Click and you see it, click again and you don't */
function toggleOld(thisElement){
	if (document.getElementById(thisElement).style.display=='none'){
		document.getElementById(thisElement).style.display = '';
                
	} else {
		document.getElementById(thisElement).style.display = 'none';
                
	}
}
/*--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--*/



/*--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--*/
/*
* This function controls the visibility of any 2 elements that is passed to it
* by way of a toggle switch. Exp: Click and you see it, click again and you don't */
function toggleOld2(thisElement, thisElement2){
	if (document.getElementById(thisElement).style.display=='none'){
		document.getElementById(thisElement).style.display = '';
                document.getElementById(thisElement2).style.display = '';
	} else {
		document.getElementById(thisElement).style.display = 'none';
                document.getElementById(thisElement2).style.display = 'none';
	}
}
/*--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--*/



/*--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--*/
/*
* This function controls the visibility of any 3 elements that is passed to it
* by way of a toggle switch. Exp: Click and you see it, click again and you don't */
function toggleOld3(thisElement, thisElement2, thisElement3){
	if (document.getElementById(thisElement).style.display=='none'){
		document.getElementById(thisElement).style.display = '';
                document.getElementById(thisElement2).style.display = '';
                document.getElementById(thisElement3).style.display = '';
                
	} else {
		document.getElementById(thisElement).style.display = 'none';
                document.getElementById(thisElement2).style.display = 'none';
                document.getElementById(thisElement3).style.display = 'none';
                
	}
}
/*--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--*/




/*--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--*/
/*
* This function controls the visibility of any 4 elements that is passed to it
* by way of a toggle switch. Exp: Click and you see it, click again and you don't */
function toggleOld4(thisElement, thisElement2, thisElement3, thisElement4){
	if (document.getElementById(thisElement).style.display=='none'){
		document.getElementById(thisElement).style.display = '';
                document.getElementById(thisElement2).style.display = '';
                document.getElementById(thisElement3).style.display = '';
                document.getElementById(thisElement4).style.display = '';
	} else {
		document.getElementById(thisElement).style.display = 'none';
                document.getElementById(thisElement2).style.display = 'none';
                document.getElementById(thisElement3).style.display = 'none';
                document.getElementById(thisElement4).style.display = 'none';
	}
}
/*--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--*/




/*--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--*/
/*
*This function determines the age of the contact based on the birthday input*/
function howOld(thisElement, thisElement2){// "thisElement" and "thisElement2" is passed from the calling element
	//Determines the current date
	var rightnow  = new Date();
	var theDay = rightnow.getDate();
	var theMonth = rightnow.getMonth() + 1;// We add "1" here because by default, JS looks at January as "0"
	var theYear = rightnow.getFullYear();

	//Adds a leading zero to any single digit days or months eg: the first day of the month becomes "01"
	if(theDay <10){
		theDay = "0"+ theDay;
	}
	
	if(theMonth <10){
		theMonth = "0"+ theMonth;
	}
	
	//Retrieves the birthdate from the form
	var birthDate = document.getElementById(thisElement).value;
	//Breaks the birthdate string down into three seperate strings: day, month, and year
	var birthMonth = birthDate.substr(0,2);
	var birthDay = birthDate.substr(3,2);
	var birthYear = birthDate.substr(6,4);
	//Age calculation at its most basic level
	var age = theYear - birthYear;
	
	//Adjusts age based on current month and day
	if(birthMonth > theMonth){
		age = (theYear - birthYear) -1;
	} if ((birthMonth == theMonth) && (birthDay > theDay)){
		age = (theYear - birthYear) -1;
	} 	if ((birthMonth == theMonth) && (birthDay < theDay)) {
		age = theYear - birthYear;
	}
	
	//Outputs the age!
	document.getElementById(thisElement2).value = age;
		
}
/*--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--*/



/*--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--*/
//This function handles the "same as primary" checkbox for address entry
	function usePrimAddress(form){ 
		var idx;
    		{
    			form.propAddress.value= form.primAddress.value;
                        form.propCity.value = form.primCity.value;
                        form.propState.value = form.primState.value;
                        form.propZip.value = form.primZip.value;
    		
    		}
    	}
    	
/*--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--*/


