// JavaScript Document

/*************************************************************/
/**				AQ.COM UTILITY JAVASCRIPT					**/
/**				CREATED: 1/12/2010							**/
/**				BY: TOM DIETRICH							**/
/**				V 1.0 - INITIAL RELEASE						**/
/*************************************************************/

/************************************************************************************/
/*
 *  MACROMEDIA UTILITY JAVASCRIPTS
 */
/************************************************************************************/
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
/************************************************************************************/

/************************************************************************************/
/*
 *	SPRY UTILITY FOR SAFARI
 */
/************************************************************************************/
function spryPositionFix(){
	var liElements = document.getElementsByTagName('li');
	if(navigator.platform.indexOf('Mac') != -1){
		if(navigator.userAgent.indexOf('Firefox') != -1){
			if(/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){
				var ffVersion = new Number(RegExp.$1);
				if(ffVersion >= 3){
					for(i=0;i < liElements.length;i++){
						if(liElements[i].className=='hometab'){
							liElements[i].style.width = '55px';
						}
					}
					/*
					var aElements = document.getElementById('navigationRolloverLink');
					for(a=0;a < aElements.length;a++){
						if(aElements[a].id=='navigationRolloverLink'){
							aElements[a].style.paddingLeft = '5px';
							aElements[a].style.paddingRight = '5px';
						}
					}
					*/
				}else if(ffVersion >= 2){
					for(i=0;i < liElements.length;i++){
						if(liElements[i].className=='hometab'){
							liElements[i].style.width = '60px';
						}
					}
					/*
					var aElements = document.getElementById('navigationRolloverLink');
					for(a=0;a < aElements.length;a++){
						if(aElements[a].id=='navigationRolloverLink'){
							aElements[a].style.paddingLeft = '5px';
							aElements[a].style.paddingRight = '5px';
						}
					}
					*/
				}
			}
		}
	}
	if(navigator.userAgent.indexOf('Safari') != -1){
	  	for(i=0;i<liElements.length;i++){
			if(liElements[i].className=='hometab'){
				liElements[i].style.width='55px';
			}
		}
	}
	if(navigator.userAgent.indexOf('Opera') != -1){
	  	for(i=0;i<liElements.length;i++){
			if(liElements[i].className=='hometab'){
				liElements[i].style.width='55px';
			}
		}
	}
}
/************************************************************************************/

/************************************************************************************/
/*
 *	DROPDOWN DISPLAY AND HIGHLIGHT FUNCTIONS
 */
/************************************************************************************/
function dispDropDown(OBJ) {
	OBJ.style.display = '';
	OBJ.style.visibility = 'visible';
}
function hideDropDown(OBJ) {
	OBJ.style.display = 'none';
	OBJ.style.visibility = 'hidden';
}
function hiliteDropDown(OBJ) {
	OBJ.style.background = '#000066';
}
function unliteDropDown(OBJ) {
	OBJ.style.background = '';
}
/************************************************************************************/

/************************************************************************************/
/*
 *	AJAX INITIALIZATION ROUTINE
 */
/************************************************************************************/
// INITIALIZE AJAX OBJECT
function initAjax(){
	var xmlHttp;
	try{
		// FIREFOX, OPERA, SAFARI
		xmlHttp=new XMLHttpRequest();
	}	
	catch (e){
		// INTERNET EXPLORER
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
			try{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e){
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	return xmlHttp;
}
/************************************************************************************/

/************************************************************************************/
/*
 *	AUTO-TABBING FUNCTION FOR FORM FIELDS
 *	OLD REFERENCE, POSSIBLY OUT-DATED
 */
/************************************************************************************/
// OLD AUTO-TAB ROUTINE
/*
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len,e){
	var keyCode = (isNN) ? e.which : e.keyCode; 
	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
	if(input.value.length >= len && !containsElement(filter,keyCode)){
		input.value = input.value.slice(0, len);
		input.form[(getIndex(input)+1) % input.form.length].select();
	}
	function containsElement(arr,ele){
		var found = false, index = 0;
		while(!found && index < arr.length){
			if(arr[index] == ele){
				found = true;
			}else{
				index++;
				return found;
			}
		}
		function getIndex(input){
			var index = -1, i = 0, found = false;
			while(i < input.form.length && index == -1){
				if(input.form[i] == input){
					index = i;
				}else{
					i++;
					return index;
				}
			return true;
			}
		}
	}
}
*/
// NEQ AUTO-TAB ROUTINE
function autoTab(FIELD,NEXT){
	if(FIELD.value.length == FIELD.maxLength){
		FIELD.form.elements[NEXT].focus();
	}
}
/************************************************************************************/

/************************************************************************************/
/*
 *	TOOL TIP CONTENT ARRAY & FUNCTION
 */
/************************************************************************************/
// CALCULATOR TOOL TIP ARRAY
var calcToolTipArray = new Array();
calcToolTipArray[0] = "<p>Many experts suggest buying a life insurance policy equal to 10 to 20 times your annual income\. Annual income is an important factor in determining your needs\, but it\'s not the only one\.</p>";
calcToolTipArray[1] = "<p>A dependant is anyone who depends on your income\. The amount of life insurance you need will depend on the total amount your family needs\, before taxes\, to maintain their current standard of living\, typically 60\%\-75\% of total income\. Families with higher incomes typically fall into the lower end of that range\.</p>";
calcToolTipArray[2] = "<p>Your age correlates with the amount of life insurance you will need\. The younger you are\, the more life insurance need you will have\. Why\? Because you have a longer time to work before retirement\, which means you have a higher earning potential\.</p>";
calcToolTipArray[3] = "<p>Without your work income\, your family will face an annual shortfall\. The number of years the benefits are needed will cover this shortfall until circumstances change \(for instance\ when your children graduate from college\.\)</p>";
calcToolTipArray[4] = "<p>A 4\% assumption has been incorporated in the calculation\. You may enter your own data and override these assumptions to gain an even more personalized analysis\.</p>";
calcToolTipArray[5] = "<p>A 6\% assumption has been incorporated in the calculation\. You may enter your own data and override these assumptions to gain an even more personalized analysis\.</p>";
// CALCULATOR TOOL TIP CHANGE FUNCTION
function tipChange(NUMBER){
	var toolTipArea = document.getElementById("tipbox");
	toolTipArea.innerHTML = calcToolTipArray[NUMBER];
}
//  TIPBOX SHOW
function showTipBox2(){
	document.getElementById("tipBox2").style.visibility = 'visible';
	document.getElementById("tipBox2").style.display = 'block';
}
//  TIPBOX HIDE
function hideTipBox2(){
	document.getElementById("tipBox2").style.visibility = 'hidden';
	document.getElementById("tipBox2").style.display = 'none';
}
/************************************************************************************/

/************************************************************************************/
/*
 *	FORM DISPLAY & HIDE FUNCTIONS
 */
/************************************************************************************/
//  APPFORM ELEMENTS
function contchg(){
	if((appform.ContType.selectedIndex>2) && (appform.ContType.selectedIndex<5)){
		contblock.style.display='block';
	}else{
		contblock.style.display='none';
		cblockwipe();
	}
}
function cblockwipe(){
	appform.Cont1.value='';
	appform.ContRel1.value='';
	appform.ContPct1.value='';
	appform.Cont2.value='';
	appform.ContRel2.value='';
	appform.ContPct2.value='';
	appform.Cont3.value='';
	appform.ContRel3.value='';
	appform.ContPct3.value='';
	appform.Cont4.value='';
	appform.ContRel4.value='';
	appform.ContPct4.value='';
}
//  APPFORM2 ELEMENTS
function addresschg(){
	if(appform2.addressyrs.value == 'LessThan5'){
		address.style.display='block';
		address.style.visibility='visible';
	}else if(appform2.addressyrs.value == 'MoreThan5'){
		address.style.display='none';
		address.style.visibility='hidden';
	}
}
//  APPFORM3 ELEMENTS
function ownerchg(){
	if (appform3.ownerq.value == 2){
		ownerblk.style.display='block';
		relblk.style.display='block';
		caveatblk.style.display='none';
		ownerlbl(0);
	}else if(appform3.ownerq.value == 3){
		ownerblk.style.display='block';
		relblk.style.display='block';
		caveatblk.style.display='none';
		ownerlbl(1);
	}else if(appform3.ownerq.value == 1){
		ownerblk.style.display='none';
		relblk.style.display='none';
		caveatblk.style.display='none';
		ownerlbl(0);
	}else if(appform3.ownerq.value == 4) {
		ownerblk.style.display='block';
		relblk.style.display='block';
		caveatblk.style.display='block';
		ownerlbl(2);
	}
}
function ownerwipe(){
	appform3.OwnerName.value=''; 
	appform3.OwnerAddress.value='';
	appform3.OwnerCity.value='';
	appform3.OwnerStateID.value='';
	appform3.OwnerZip.value='';
	appform3.OwnerRelationship.value='';
	appform3.OwnerPhone.value='';
}
function ownerlbl(TYPE){
	switch(TYPE){
		case 0:
			document.getElementById("ownerLabel").innerHTML='Owner Name:';
			document.getElementById("ownerIDLabel").innerHTML='SSN:';
			document.appform3.OwnerRelationship.value='';
		break;
		case 1:
			document.getElementById("ownerLabel").innerHTML='Business Name:';
			document.getElementById("ownerIDLabel").innerHTML='Tax ID:';
			document.appform3.OwnerRelationship.value='Business';
		break;
		case 2:
			document.getElementById("ownerLabel").innerHTML='Name of Trust:';
			document.getElementById("ownerIDLabel").innerHTML='Tax ID:';
			document.appform3.OwnerRelationship.value='Trust';
		break;
	}
}
function inforcereset(){
	appform3.inforcecompany1.value='';
	appform3.inforcecompany2.value='';
	appform3.inforcecompany3.value='';
	appform3.inforcecompany4.value='';
	appform3.inforcepolicyno1.value='';
	appform3.inforcepolicyno2.value='';
	appform3.inforcepolicyno3.value='';
	appform3.inforcepolicyno4.value='';
	appform3.inforcecover1.value='';
	appform3.inforcecover2.value='';
	appform3.inforcecover3.value='';
	appform3.inforcecover4.value='';
	appform3.inforceyear1.value='';
	appform3.inforceyear2.value='';
	appform3.inforceyear3.value='';
	appform3.inforceyear4.value='';
	/*
	appform3.no1.checked=true;
	appform3.no2.checked=true;
	appform3.no3.checked=true;
	appform3.no4.checked=true;
	*/
}
function Typechg(){
	if (appform3.InsType.value == 1) {
		personal.style.display='block';
		business.style.display='none';
		appform3.bp1.checked=false;
		appform3.bp2.checked=false;
		appform3.bp3.checked=false;
		appform3.bp4.checked=false;
		appform3.bp5.value='';
		appform3.Assets.value='';
		appform3.NetWorth.value='';
		appform3.Liabilities.value='';
		appform3.Percent.value='';
		appform3.InForceYou.value='';
		appform3.busno1.checked=true;
	}else if(appform3.InsType.value == 2){
		business.style.display='block';
		personal.style.display='none';
		appform3.pp1.checked=false;
		appform3.pp2.checked=false;
		appform3.pp3.checked=false;
		appform3.pp4.value='';
		appform3.income.value='';
		appform3.networth.value='';
	}
}
function benechg(){
	if (appform3.BeneType.selectedIndex == 0){
		spouseblock.style.display='block';
		beneblock.style.display='none';
		bblockwipe();
	}else if((appform3.BeneType.selectedIndex>=1) && (appform3.BeneType.selectedIndex<=2)){
		spouseblock.style.display='none';
		beneblock.style.display='none';
		bblockwipe();
	}else if(appform3.BeneType.selectedIndex>2){
		spouseblock.style.display='none';
		beneblock.style.display='block';
	}else{
		beneblock.style.display='none';
		bblockwipe();
	}
}
function bblockwipe() {
	appform3.Bene1.value='';
	appform3.BeneRel1.value='';
	appform3.BenePct1.value='';
	appform3.Bene2.value='';
	appform3.BeneRel2.value='';
	appform3.BenePct2.value='';
	appform3.Bene3.value='';
	appform3.BeneRel3.value='';
	appform3.BenePct3.value='';
	appform3.Bene4.value='';
	appform3.BeneRel4.value='';
	appform3.BenePct4.value='';
}

//  APPFORM4 ELEMENTS
function physhide(){
	appform4.DrFirstName.value='';
	appform4.DrLastName.value='';
	appform4.DrAddress1.value='';
	appform4.DrAddress2.value='';
	appform4.DrCity.value='';
	appform4.DrStateID.value='';
	appform4.DrZip.value='';
	appform4.DrPhone1.value='';
	appform4.DrPhone2.value='';
	appform4.DrPhone3.value='';
	/*
	appform4.VisitMonth.selectedIndex = 0;
	appform4.VisitDay.selectedIndex = 0;
	appform4.VisitYear.selectedIndex = 0;
	*/
	appform4.Reason.value='';
	appform4.DrTreatment.value='';
}
/************************************************************************************/

/************************************************************************************/
/*
 *  PODCAST DISPLAY JAVASCRIPTS
 */
/************************************************************************************/
function switchPodcast(NUMBER){
	//	ONLY WORK IF WE ARE TRYING TO DISPLAY SOMETHING THAT ISN'T BEING DISPLAY
	if(document.getElementById(NUMBER).style.display == 'none' && document.getElementById(NUMBER).style.visibility == 'hidden'){
		//  FIRST, HIDE THEM ALL
		//  2005
		document.getElementById('2005').style.display = 'none';
		document.getElementById('2005').style.visibility = 'hidden';
		//  2006
		document.getElementById('2006').style.display = 'none';
		document.getElementById('2006').style.visibility = 'hidden';
		//  2007
		document.getElementById('2007').style.display = 'none';
		document.getElementById('2007').style.visibility = 'hidden';
		//  2008
		document.getElementById('2008').style.display = 'none';
		document.getElementById('2008').style.visibility = 'hidden';
		//  2009
		document.getElementById('2009').style.display = 'none';
		document.getElementById('2009').style.visibility = 'hidden';
		//  2010
		document.getElementById('2010').style.display = 'none';
		document.getElementById('2010').style.visibility = 'hidden';
		//	NEXT, SHOW THE ONE WE ARE TRYING TO SHOW
		document.getElementById(NUMBER).style.display = 'block';
		document.getElementById(NUMBER).style.visibility = 'visible';
	}
}

/************************************************************************************/


/************************************************************************************/
/*
 * SHARE THIS LINK CONFIGURATION
 */
/************************************************************************************/

var addthis_config = { 
		services_compact: 'email, facebook, twitter, delicious, digg, blogger, more',          
		services_exclude: 'google, myspace, favorites, messenger'}

/************************************************************************************/
/*
 *  LIFE INSURANCE STATES JUMP MENU
 */
/************************************************************************************/

function MM_jumpMenuGo(objId,targ,restore){ //v9.0
  var selObj = null;  with (document) { 
  if (getElementById) selObj = getElementById(objId);
  if (selObj) eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0; }
}

