var rel_url="/"

 var http_request = false;
var url='http://go.mappoint.net/hrblock/locationservice.asmx'
//http://preview.mappoint.net/hrblock/locationservice.asmx

var lastZip;
var addressStatus ='';
var addressVal='';
var mapURL='';
 function createHTTPRequest()
 {
  //alert('create HTTP request')
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return null;
      }
 }
  function makePOSTRequest(url, parameters) {
	  createHTTPRequest();
      http_request.onreadystatechange = alertContents;
     
	  //alert('url'+url)
	  http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }
var calcid=''
function getAddress(zipCode,tmpcalcid)
  {
	  calcid=tmpcalcid;
	  if (zipCode==lastZip || zipCode=='' )
	  {
		  return; 
	  }
//alert('about to hit server')
      createHTTPRequest();      

	lastZip=zipCode
	var maptmpurl='';

			if (rel_url.length > 4)
			{
			maptmpurl='../../calcs/soap.jsp';
			}
			else
			maptmpurl='/calcs/soap.jsp';


//maptmpurl='http://titan:2007/calcs/soap.jsp'

			var submitstr = "zipCode="+zipCode;				                           

  http_request.onreadystatechange = receiveResponse;
      http_request.open('POST', maptmpurl, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", submitstr.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(submitstr);

//alert('request sent for '+submitstr)
}

function trimall(d) {
a = d.replace(/^\s+/, '');
return a.replace(/\s+$/, '');
}


function receiveResponse()
{

	 var returnVal=""
	 if (http_request.readyState == 4)
	  {

         if (http_request.status == 200) 
		 {
				var restxt=http_request.responseText
//alert(restxt)
				if (window.ActiveXObject)
				  {
				  var doc=new ActiveXObject("Microsoft.XMLDOM");
				  doc.async="false";
				  doc.loadXML(restxt);
				  }
				// code for Mozilla, Firefox, Opera, etc.
				else
				  {
				  var parser=new DOMParser();
				  var doc=parser.parseFromString(trimall(restxt),"text/xml");
				  }


				var rootel=doc.documentElement;

				var resCnt=rootel.getElementsByTagName("NumberOfLocations");
				

				if (parseInt(resCnt[0].childNodes[0].nodeValue) >0)
				{
					var add1=(rootel.getElementsByTagName("Address1"))[0].childNodes[0].nodeValue;

					addressVal=add1+"<br/>";
					var add2='';//(rootel.getElementsByTagName("Address2"))[0].childNodes[0].nodeValue;

					if((rootel.getElementsByTagName("Address2"))[0].childNodes[0]!=null)
					addressVal+=add2+"<br/>";
					

					var city=(rootel.getElementsByTagName("City"))[0].childNodes[0].nodeValue;
					var zip=(rootel.getElementsByTagName("Zip"))[0].childNodes[0].nodeValue;
					var st=(rootel.getElementsByTagName("State"))[0].childNodes[0].nodeValue;
					var phn=(rootel.getElementsByTagName("Phone"))[0].childNodes[0].nodeValue;
					var map=(rootel.getElementsByTagName("MapUrl"))[0].childNodes[0].nodeValue;

					addressVal+=city+"<br/>"+st+"  "+zip+"<br/>"+phn+"<br/><br/> <a href=\"javascript:officeLocator('"+lastZip+"')\"><u>Find other offices</u></a>";
					mapURL=map;
					addressStatus='success'

					//alert('setting the address for ',calcid)
					lzSetCanvasAttribute('address', addressVal,calcid);
				  lzSetCanvasAttribute('mapURL', mapURL,calcid);
					return;
				}
			

		}
		addressStatus='error'
	}
	addressStatus='error'
}

function callAdvice(ag1)
{

document.forms['adviceform'].indexList.value=ag1;
var adviceURL=rel_url+'print/taxEst2006Advice.html';

var x=window.open(adviceURL,'taxest2006AdviceWin','height=620,width=498,scrollbars=1')

}
function calltaxest2007Advice(ag1)
{

document.forms['taxest2007advice'].indexList.value=ag1;
var adviceURL=rel_url+'print/taxEst2007Advice.html';

var x=window.open(adviceURL,'taxest2007AdviceWin','height=620,width=498,scrollbars=1')

}

function callWHAdvice(ag1)
{

document.forms['whadviceform'].indexList.value=ag1;
var adviceURL=rel_url+'print/WH2008Advice.html';

var x=window.open(adviceURL,'wh2008AdviceWin','height=620,width=498,scrollbars=1')

}



function callCheckList(ag2)
{
document.forms['checkListform'].indexList.value=ag2;
var checklistURL=rel_url+'print/taxEst2006CheckList.html';

var x=window.open(checklistURL,'taxest2006CheckListWin','height=620,width=498,scrollbars=1')

}

function calltaxest2007CheckList(ag2)
{
document.forms['taxest2007Checklist'].indexList.value=ag2;
var checklistURL=rel_url+'print/taxEst2007CheckList.html';

var x=window.open(checklistURL,'taxest2007CheckListWin','height=620,width=498,scrollbars=1')

}

function storeData() {
      var poststr = "";
			poststr += "sumFilingStatus="+Estimator.FilingStatus ;				                           
			poststr += "&sumTPAge="+ Estimator.TPAge;						                          
			poststr += "&sumSPAge="+ Estimator.SPAge;					                    
			poststr += "&sumDeduct_SelfBlind="+ 0;			       
			poststr += "&sumDeduct_SpouseBlind="+0 ;			     
			poststr += "&sumDeduct_DedOther="+0 ;				       
			poststr += "&sumDeduct_SPDedOther="+0 ;			   
			poststr += "&sumExempt_Dependents="+ Estimator.FBasic.Exempt_Dependents ;			         
			poststr += "&sumExempt_Under17="+Estimator.FBasic.Exempt_Under17 ;				           
			poststr += "&sumExempt_DisabledChild="+Estimator.FBasic.Exempt_DisabledChild ;			                       
			poststr += "&sumExempt_Under14to16="+ Estimator.FBasic.Exempt_Under14to16;			                     
			poststr += "&sumExempt_Student19to24="+Estimator.FBasic.Exempt_Student19to24   ;
			poststr += "&sumOther_Dependents="+ Estimator.FBasic.Other_Dependents;			
			poststr += "&sumSelfWages="+ Estimator.SelfWages;				              
			poststr += "&sumSpouseWages="+ Estimator.SpouseWages;				        
			poststr += "&sumQualifyingDiv="+ Estimator.FBasic.QualifyingDividend;				       
			poststr += "&sumHeldOneYrOrLess="+Estimator.FBasic.HeldOneYrOrLess  ;				                 
			poststr += "&sumHeldGTOneYr="+Estimator.FBasic.HeldGTOneYr ;				               
			poststr += "&sumOtherIncLoss="+ Estimator.FBasic.OtherIncLoss;				             
			poststr += "&sumSocSecBen="+Estimator.FBasic.SocSecBen  ;				         
			poststr += "&sumDeductibleIRA="+0 ;				              
			poststr += "&sumStudentLoanInt="+ Estimator.FBasic.StudentLoanInt;				               
			poststr += "&sumOtherAdjToInc="+ Estimator.FBasic.OtherAdjToInc;				             
			poststr += "&sumDeduct_Med="+ Estimator.FBasic.Deduct_Med;				               
			poststr += "&sumDeduct_SLTax="+ Estimator.FBasic.Deduct_SLTax;				        
			poststr += "&sumDeduct_InvestInt="+ Estimator.FBasic.Deduct_InvestInt;		      
			poststr += "&sumDeduct_Charity="+ Estimator.FBasic.Deduct_Charity;				         
			poststr += "&sumDeduct_DeductInt="+Estimator.FBasic.Deduct_DeductInt  ;			             

			poststr += "&sumW4Allow_SelfPayPeriod="+ 0;			                 
			poststr += "&sumW4Allow_SpousePayPeriod="+0 ;			          
			poststr += "&sumDeduct_TPFedlIncTaxToDate="+Estimator.FBasic.Deduct_TPFedlIncTaxToDate ;		    poststr += "&sumDeduct_SPFedlIncTaxToDate="+ Estimator.FBasic.Deduct_SPFedlIncTaxToDate;		    poststr += "&sumDeduct_TPAmtFedlIncTaxPerPayChk="+ 0;		     
			poststr += "&sumDeduct_SPAmtFedlIncTaxPerPayChk="+ 0;		       
			poststr += "&sumDeduct_TPNoOfPayChkRmngs="+ 0;		                                          
			poststr += "&sumDeduct_SPNoOfPayChkRmngs="+ 0;
			poststr += "&sumTaxCalc_DepCare="+Estimator.TaxCalc_DepCare ;
			poststr += "&sumDeduct_SaversCredit="+ 0;
			poststr += "&sumDeduct_OtherCredits="+ Estimator.FBasic.Deduct_OtherCredits ;
			poststr += "&sumDeduct_RETax="+0 ;
			poststr += "&sumTaxPmt_EstTaxPaid="+ Estimator.FBasic.TaxPmt_EstTaxPaid ;
			poststr += "&sumDeduct_RealEstate="+ Estimator.FBasic.Deduct_RealEstate;  		
			poststr += "&sumDeduct_Tuition="+Estimator.FBasic.Deduct_Tuition ;     		 
			poststr += "&sumInterestInc="+Estimator.FBasic.InterestInc ;        		
			poststr += "&sumOrdinaryDividend="+ Estimator.FBasic.OrdinaryDividend;   		 
			poststr += "&sumSLRefund="+Estimator.FBasic.SLRefund ;           		
			poststr += "&sumTPSEIncome="+Estimator.FBasic.TPSEIncome ;         		
			poststr += "&sumSPSEIncome="+ Estimator.FBasic.SPSEIncome;         		 
			poststr += "&sumSPSEExpense="+ Estimator.FBasic.SPSEExpense;        		 
			poststr += "&sumTPSEExpense="+ Estimator.FBasic.TPSEExpense;        		
			poststr += "&sumDeduct_DeductJobTax="+Estimator.FBasic.Deduct_DeductJobTax ;		
			poststr += "&sumTPIncLoss="+0 ;				              
			poststr += "&sumSPIncLoss="+ 0; //You will owe or Refund.

			if(document.forms['taxestform'].totPayments.value<0)
				poststr += "&sumTextSelected='Refund'"
			
			else
				poststr += "&sumTextSelected=You will owe"

			poststr += "&sumTaxPmt_Total="+ document.forms['taxestform'].totTaxes.value;
			poststr += "&sumWHtoDate="+document.forms['taxestform'].sumWHtoDate.value ;
			poststr += "&sumFutureWH="+0 ;
			poststr += "&sumTotalTax="+document.forms['taxestform'].totTaxes.value ;
			poststr += "&sumDeduct_EducationCreditLifeTmCrdt="+ document.forms['taxestform'].lifeTimeCredit.value;
			poststr += "&sumExempt_TotExemptions="+document.forms['taxestform'].totExemptions.value ;
			poststr += "&sumRegTax="+ document.forms['taxestform'].regTax.value;
			poststr += "&sumAltMinTax="+ document.forms['taxestform'].AMT.value;
			poststr += "&sumAGI="+ document.forms['taxestform'].AGI.value;
			poststr += "&sumDeduct_EducationCredit="+ 0;
			poststr += "&sumDeduct_StdDed="+ document.forms['taxestform'].stdDed.value;				        
			poststr += "&sumTaxCalc_TotalCredits="+ document.forms['taxestform'].eic.value;
			poststr += "&sumRefChldTaxCrdt="+ document.forms['taxestform'].refChildTaxCredit.value;
			poststr += "&sumTaxAfterCredit="+document.forms['taxestform'].taxAfterCredit.value ;
			poststr += "&sumSelfEmploymentTax="+ document.forms['taxestform'].selfEmploymentTax.value ;
			poststr += "&sumChildCareCredit="+document.forms['taxestform'].childCareCredit.value ;
			poststr += "&sumEducationCreditResult="+ 0;
			poststr += "&sumCTaxCredit="+document.forms['taxestform'].childTaxCredit.value ;
			poststr += "&sumDeduct_TotItemized="+document.forms['taxestform'].Deduct_TotItemized.value ;
			poststr += "&sumTaxCalc_TaxIncome="+ document.forms['taxestform'].taxableIncome.value;
			poststr += "&sumPostalZip="+  document.forms['taxestform'].zipCode.value;
			poststr += "&sumGr_Std_Itm="+  document.forms['taxestform'].grtStandDed.value;

			/*		
			we are not capturing sumDeduct_RealEstate, sumSLRefund
			  
			*/	  
	  
			if (rel_url.length > 4)
			{
			makePOSTRequest('../../calcs/main.jsp', poststr);
			}
			else
			makePOSTRequest('/calcs/main.jsp', poststr);
   }

  
  
  function storeWHData() {
      var poststr = "";
		var tmpStatusArray =new Array('Single','Married filing jointly','Married filing separately','Head of household','Qualifying widow(er)')          
var tmpFrequencyArray =new Array('Weekly','Biweekly','Twice a month','Once a month')
		poststr += 'FilingStatus='+ tmpStatusArray[document.forms['withholdingform'].FilingStatus.value];
		poststr += '&totOweAmt='+ document.forms['withholdingform'].totOweAmt.value;
		poststr += '&qrtEstTax='+ document.forms['withholdingform'].qrtEstTax.value;
		poststr += '&tpPayPeriod='+ tmpFrequencyArray[document.forms['withholdingform'].tpPayPeriod.value];
		poststr += '&spPayPeriod='+ tmpFrequencyArray[document.forms['withholdingform'].spPayPeriod.value];
		poststr += '&tpfedIncWHAmt='+ document.forms['withholdingform'].tpfedIncWHAmt.value;
		poststr += '&spfedIncWHAmt='+ document.forms['withholdingform'].spfedIncWHAmt.value;
		poststr += '&tpnoChksAmt='+ document.forms['withholdingform'].tpnoChksAmt.value;
		poststr += '&spnoChksAmt='+ document.forms['withholdingform'].spnoChksAmt.value;
		poststr += '&tpGrossPayAmt='+ document.forms['withholdingform'].tpGrossPayAmt.value;
		poststr += '&spGrossPayAmt='+ document.forms['withholdingform'].spGrossPayAmt.value;
		poststr += '&tpBox3Status='+ document.forms['withholdingform'].tpBox3Status.value;
		poststr += '&tpBox5Amt='+ document.forms['withholdingform'].tpBox5Amt.value;
		poststr += '&tpBox6Amt='+ document.forms['withholdingform'].tpBox6Amt.value;
		poststr += '&tpResult='+ document.forms['withholdingform'].tpResult.value;
		poststr += '&spBox3Status='+ document.forms['withholdingform'].spBox3Status.value;
		poststr += '&spBox5Amt='+ document.forms['withholdingform'].spBox5Amt.value;
		poststr += '&spBox6Amt='+ document.forms['withholdingform'].spBox6Amt.value;
		poststr += '&spResult='+ document.forms['withholdingform'].spResult.value;
		poststr += '&tpcurrPayAmt='+ document.forms['withholdingform'].tpcurrPayAmt.value;
		poststr += '&spcurrPayAmt='+ document.forms['withholdingform'].spcurrPayAmt.value;
		poststr += '&resultText='+ document.forms['withholdingform'].resultText.value;
		poststr += '&taxPmtTot='+ document.forms['withholdingform'].taxPmtTot.value;
		poststr += '&tpothAmt='+ document.forms['withholdingform'].tpothAmt.value;
		poststr += '&spothAmt='+ document.forms['withholdingform'].spothAmt.value;
		poststr += '&tpfedIncTaxAmt='+ document.forms['withholdingform'].tpfedIncTaxAmt.value;
		poststr += '&spfedIncTaxAmt='+ document.forms['withholdingform'].spfedIncTaxAmt.value;
		poststr += '&tpssTaxAmt='+ document.forms['withholdingform'].tpssTaxAmt.value;
		poststr += '&spssTaxAmt='+ document.forms['withholdingform'].spssTaxAmt.value;
		poststr += '&tpmedTaxAmt='+ document.forms['withholdingform'].tpmedTaxAmt.value;
		poststr += '&spmedTaxAmt='+ document.forms['withholdingform'].spmedTaxAmt.value;
		poststr += '&tpsiTaxAmt='+ document.forms['withholdingform'].tpsiTaxAmt.value;
		poststr += '&spsiTaxAmt='+ document.forms['withholdingform'].spsiTaxAmt.value;
		poststr += '&tpretAmt='+ document.forms['withholdingform'].tpretAmt.value;
		poststr += '&spretAmt='+ document.forms['withholdingform'].spretAmt.value;
		poststr += '&tpinsAmt='+ document.forms['withholdingform'].tpinsAmt.value;
		poststr += '&spinsAmt='+ document.forms['withholdingform'].spinsAmt.value;
		
		
		poststr += '&zipCode='+ document.forms['withholdingform'].zipCode.value;
		poststr += '&tpflxAcntAmt='+ document.forms['withholdingform'].tpflxAcntAmt.value;
		poststr += '&spflxAcntAmt='+ document.forms['withholdingform'].spflxAcntAmt.value;

	 // makePOSTRequest('http://titan:2007/calcs/mainWH.jsp', poststr);
			if (rel_url.length > 4)
			{
			makePOSTRequest('../../calcs/mainWH.jsp', poststr);
			}
			else
			makePOSTRequest('/calcs/mainWH.jsp', poststr);

			
   }
  
  
  
  function alertContents() {
//      if (http_request.readyState == 4) 
  //       if (http_request.status == 200) 
		 
  }



function hideCalc()
{
	document.getElementById("calcDiv").style.visibility='hidden'
	document.getElementById("calcDiv").style.display='none'

}

function convertFormat(x)
{

var op=''
if (x.indexOf(',')>0)
{
  for (var i=0; i<x.length; i++)
  {
	  if (x.charAt(i)!=',' )
	  {
		op+=''+x.charAt(i);
	  }
  }
}
else
{
	return parseInt(x)
}
  return parseInt(op)
}

function calljs(t)
{
var reportURL=rel_url+'print/Tax_Estimator_Report.html';

var x=window.open(reportURL,'printWindow','height=620,width=480,scrollbars=0')
storeData();
}

function callWHPrint(t)
{
var reportURL=rel_url+'print/wh2008printsummary.html';

var x=window.open(reportURL,'whprintWindow','height=620,width=500,scrollbars=1')
storeWHData();
}

function calltaxest2007Print(t)
{
var reportURL=rel_url+'print/taxest2007printsummary.html';

var x=window.open(reportURL,'taxest2007printWindow','height=620,width=500,scrollbars=1')

}


function callhelp(t)
{
	var helpURL=rel_url+'help/frames.html';

	document.forms['helpform'].module.value=t;

	var x=window.open(helpURL,'helpWindow','height=400,width=650,scrollbars=0')

}

function calltaxest2007help(t)
{
	var helpURL='help/taxest2007/frames.html';

	document.forms['taxest2007Help'].module.value=t;

	var x=window.open(helpURL,'2007taxesthelp','height=400,width=650,scrollbars=0')

	updatetracking('Help')
}

function callamt2007help(arg)
	{
	var helpURL=rel_url+'help/amtest2007/frames.html';
	document.forms['amt07helpform'].module.value=arg;
	var x=window.open(helpURL,'amt07helpWindow','height=400,width=650,scrollbars=0')

	}

function callWHhelp(t)
{
	var helpURL=rel_url+'help/WHframes.html';

	document.forms['whhelpform'].module.value=t;

	var x=window.open(helpURL,'helpWindow','height=400,width=650,scrollbars=0')

}


function officeLocator(x)
{

webAnalytics(document.getElementById('tmplink'), 'trackvars:prop21=office_locator_taxest&','trackevents:event14' ,'linkname:office_locator_taxest', 'type:o')
 WinOpen_('/universal/office_locator.html')
}

 var currCalc=0;



/***********************************************************************************************
		
				CODE FOR MULTI CALCULATOR ENVIRONMENT

**************************************************************************************************/

var currCalc=0;
var calcsEnabled =new Array()


function checkCalc(calc)
{
 for (var i=0;i<calcsEnabled.length ; i++)
 {
	 if (calcsEnabled[i]==calc)
	 {
		 return true;
	 }
 }
return false;
}
	var miniArray;

function callTaxEstimator2007()
{


	var flashver= checkFlash()

	if (  isNaN(flashver) || flashver <6)
	{
	    WinOpen_(calcURLS[18],875,500)
	}
else
	{

		hideCalc();
		var linkURL =document.location.pathname;
		linkURL=linkURL.substring(0,linkURL.lastIndexOf('/'))
		rel_url=linkURL+'/';
		
		
		lzLPSRoot =rel_url ;
		var x =lzEmbed({url: 'taxest2007.lzx.swf?&lzproxied=false&__lzhistconn=4444&__lzhisturl=' + escape('lps/includes/h.html?h=')+'&miniflag=false&closeflag=true', bgcolor: '#eeeeee', width: '560', height: '522', id: 'lzapp', accessible: 'false'}, lzCanvasRuntimeVersion);
		lzHistEmbed(lzLPSRoot);
	
	
		document.getElementById("calcDiv").style.visibility='visible'
		document.getElementById("calcDiv").style.display='block'
		document.getElementById('calcDiv').innerHTML=x;
	}

}


function callAMTEstimator2007()
{
	var flashver= checkFlash()
	if (flashver <6 || isNaN(flashver) )
	{
		webAnalytics('', 'trackvars:prop21=AMT_calc_indx_jsp&','trackevents:event14' ,'linkname:AMT_calc_indx_jsp', 'type:o')
	    WinOpen_(calcURLS[4],875,500)
	}

else{
	
		hideCalc();
		var linkURL =document.location.pathname;
		linkURL=linkURL.substring(0,linkURL.lastIndexOf('/'))
		rel_url=linkURL+'/';
	
	
		lzLPSRoot =rel_url ;
		var x =lzEmbed({url: 'amtest2007.lzx.swf?&lzproxied=false&__lzhistconn=4444&__lzhisturl=' + escape('lps/includes/h.html?h=')+'&miniflag=false&closeflag=true', bgcolor: '#eeeeee', width: '560', height: '550', id: 'lzapp', accessible: 'false'}, lzCanvasRuntimeVersion);
		lzHistEmbed(lzLPSRoot);

		document.getElementById("calcDiv").style.visibility='visible'
		document.getElementById("calcDiv").style.display='block'
		document.getElementById('calcDiv').innerHTML=x;

	webAnalytics('', 'trackvars:prop21=AMT_calc_indx&','trackevents:event14' ,'linkname:AMT_calc_indx', 'type:o')

}
}




/**************************************************************************************88

With holding

*****************************************************************************************/

function callWithholding2008()
{
	var flashver= checkFlash()
if (flashver <6 || isNaN(flashver) )
	{

		webAnalytics('', 'trackvars:prop21=Withholding_calc_indx_jsp&','trackevents:event14' ,'linkname:Withholding_calc_indx_jsp', 'type:o')
	    WinOpen_(calcURLS[4],875,500)
	}

else{
		hideCalc();
		var linkURL =document.location.pathname;
		linkURL=linkURL.substring(0,linkURL.lastIndexOf('/'))
		rel_url=linkURL+'/';
				
		lzLPSRoot =rel_url ;
		var x =lzEmbed({url: 'withholding.lzx.swf?&lzproxied=false&__lzhistconn=4444&__lzhisturl=' + escape('lps/includes/h.html?h=')+'&miniflag=false&closeflag=true', bgcolor: '#eeeeee', width: '560', height: '538', id: 'lzapp', accessible: 'false'}, lzCanvasRuntimeVersion);
		
		lzHistEmbed(lzLPSRoot);
		document.getElementById("calcDiv").style.visibility='visible'
		document.getElementById("calcDiv").style.display='block'
	
		document.getElementById('calcDiv').innerHTML=x;
		webAnalytics('', 'trackvars:prop21=Withholding_calc_indx&','trackevents:event14' ,'linkname:Withholding_calc_indx', 'type:o')

}


}


function runWHCalc(P,I,E,R)
{
	
	var arrPersonal =P.split('*')
	document.forms['withholdingform'].FilingStatus.value=arrPersonal[0]
	document.forms['withholdingform'].zipCode.value=arrPersonal[1]

	var arrPaycheck =new Array();
	arrPaycheck=I.split('*')
	document.forms['withholdingform'].tpPayPeriod.value=convertFormat(arrPaycheck[0])
	
	document.forms['withholdingform'].spPayPeriod.value=convertFormat(arrPaycheck[1])
	document.forms['withholdingform'].tpGrossPayAmt.value=convertFormat(arrPaycheck[2])
	document.forms['withholdingform'].spGrossPayAmt.value=convertFormat(arrPaycheck[3])
	document.forms['withholdingform'].tpfedIncWHAmt.value=convertFormat(arrPaycheck[4])
	document.forms['withholdingform'].spfedIncWHAmt.value=convertFormat(arrPaycheck[5])
	document.forms['withholdingform'].tpfedIncTaxAmt.value=convertFormat(arrPaycheck[6])
	document.forms['withholdingform'].spfedIncTaxAmt.value=convertFormat(arrPaycheck[7])
	document.forms['withholdingform'].tpssTaxAmt.value=convertFormat(arrPaycheck[8])
	document.forms['withholdingform'].spssTaxAmt.value=convertFormat(arrPaycheck[9])
	document.forms['withholdingform'].tpmedTaxAmt.value=convertFormat(arrPaycheck[10])
	document.forms['withholdingform'].spmedTaxAmt.value=convertFormat(arrPaycheck[11])
	document.forms['withholdingform'].tpsiTaxAmt.value=convertFormat(arrPaycheck[12])
	document.forms['withholdingform'].spsiTaxAmt.value=convertFormat(arrPaycheck[13])
	document.forms['withholdingform'].tpretAmt.value=convertFormat(arrPaycheck[14])
	document.forms['withholdingform'].spretAmt.value=convertFormat(arrPaycheck[15])
	document.forms['withholdingform'].tpinsAmt.value=convertFormat(arrPaycheck[16])
	document.forms['withholdingform'].spinsAmt.value=convertFormat(arrPaycheck[17])
	document.forms['withholdingform'].tpflxAcntAmt.value=convertFormat(arrPaycheck[18])
	document.forms['withholdingform'].spflxAcntAmt.value=convertFormat(arrPaycheck[19])
	document.forms['withholdingform'].tpothAmt.value=convertFormat(arrPaycheck[20])
	document.forms['withholdingform'].spothAmt.value=convertFormat(arrPaycheck[21])
	document.forms['withholdingform'].tpcurrPayAmt.value=convertFormat(arrPaycheck[22])
	document.forms['withholdingform'].spcurrPayAmt.value=convertFormat(arrPaycheck[23])
	document.forms['withholdingform'].tpnoChksAmt.value=convertFormat(arrPaycheck[24])
	document.forms['withholdingform'].spnoChksAmt.value=convertFormat(arrPaycheck[25])

	var arrTaxes =E.split('*')

	document.forms['withholdingform'].totOweAmt.value=convertFormat(arrTaxes[0])
	document.forms['withholdingform'].qrtEstTax.value=convertFormat(arrTaxes[1])

	var arrResults =R.split('*')

	document.forms['withholdingform'].tpBox3Status.value=arrResults[0];
	document.forms['withholdingform'].tpBox5Amt.value=convertFormat(arrResults[1]);
	document.forms['withholdingform'].tpBox6Amt.value=convertFormat(arrResults[2]);
	document.forms['withholdingform'].tpResult.value=convertFormat(arrResults[3]);
	document.forms['withholdingform'].spBox3Status.value=arrResults[4];
	document.forms['withholdingform'].spBox5Amt.value=convertFormat(arrResults[5]);
	document.forms['withholdingform'].spBox6Amt.value=convertFormat(arrResults[6]);
	document.forms['withholdingform'].spResult.value=convertFormat(arrResults[7]);
	document.forms['withholdingform'].taxPmtTot.value=convertFormat(arrResults[8]);


	if (arrResults[9]=='R')
		document.forms['withholdingform'].resultText.value='Your refund will be ';
	else if (arrResults[9]=='O')
		document.forms['withholdingform'].resultText.value='Your will owe ';
	else
		document.forms['withholdingform'].resultText.value='We recommend:';


	//getAddress(document.forms['withholdingform'].zipCode.value,'3333')
	  
	  
  if (addressStatus=='success')
	{
	  //alert('setting the address'+addressVal)
	  lzSetCanvasAttribute('address', addressVal,'3333');
	  lzSetCanvasAttribute('mapURL', mapURL,'3333');
		  

	}
	

}

function fetchRefund()
{
	return  document.forms['withholdingform'].totPayments.value;
}
function callCalculationWH()
{
		WHEstimator.FBasic.W4Allow_SelfNextPay = new Date;
		WHEstimator.FBasic.W4Allow_SpouseNextPay = new Date;
		WHEstimator.TaxRates.SetTaxRatesForYear( CURRENT_YEAR );
	
		var TextSelected;
		var TPBox3Status;
		var TPBox5Amt;
		var TPBox6Amt;
		var TPResult;
		var SPBox3Status;
		var SPBox5Amt;
		var SPBox6Amt;
		var SPResult;
		var TaxPmt_Total;


		WHEstimator.FBasic.CalcSLTax_TPTotWH(WHEstimator.FilingStatus);
		WHEstimator.FBasic.CalcSLTax_SpouseTotWH(WHEstimator.FilingStatus);
		WHEstimator.FBasic.CalcTaxPmt_Total();

		if ( WHEstimator.FBasic.TaxPmt_Total < 0 )
		{
			TextSelected = "Your refund will be ";

		} else
		{
			TextSelected = "You will owe ";

		}

		if ( WHEstimator.Estimator_SelfWages > 0 || WHEstimator.FBasic.Deduct_TPNoOfPayChkRmngs > 0 )
		{
		  TPBox3Status = this.Calc_TaxCalc_StatusWHTP();
		}
		else
		{
		TPBox3Status = "-"
		}

		TPBox5Amt = this.Calc_TaxCalc_SelfAllowance();
		var B6 = this.CalcTaxCalc_Box6TP();
		if ( B6 == "No Change" )
		{
		TPBox6Amt = this.CalcTaxCalc_Box6TP();
		}
		else
		{
		TPBox6Amt = ( this.CalcTaxCalc_Box6TP());
		}
		var TPR = this.CalcTaxCalc_TPEstmdRsltAfterWHAdjust();
		if ( TPR == "No Change" )
		{
		TPResult = this.CalcTaxCalc_TPEstmdRsltAfterWHAdjust();
		}
		else
		{
		TPResult = (this.CalcTaxCalc_TPEstmdRsltAfterWHAdjust());
		}

		if(  WHEstimator.FilingStatus == MARRIED_JOINT_FILER )
		{
		SPBox3Status = this.Calc_TaxCalc_StatusWHTP();
		}
		else
		{
		if ( WHEstimator.Estimator_SpouseWages > 0  || WHEstimator.FBasic.Deduct_SPNoOfPayChkRmngs > 0 )
		{
		   SPBox3Status = this.Calc_TaxCalc_StatusWHTP();
		}
		else
			{
			SPBox3Status = "-"
			}
		}

		SPBox5Amt = this.Calc_TaxCalc_SpouseAllowance();
		var B6SP = this.CalcTaxCalc_Box6SP();
		if ( B6SP == "No Change" )
			{
		SPBox6Amt = this.CalcTaxCalc_Box6SP();
		}
		else
			{
		 SPBox6Amt = ( this.CalcTaxCalc_Box6SP());
		}
		var SPR = this.CalcTaxCalc_SPEstmdRsltAfterWHAdjust();
		if ( SPR == "No Change" )
			{
		SPResult = this.CalcTaxCalc_SPEstmdRsltAfterWHAdjust();
		}
		else
		{
		 SPResult = ( this.CalcTaxCalc_SPEstmdRsltAfterWHAdjust());
		}
		var TPT = this.CalcTaxCalc_TPEstmdRsltAfterWHAdjust_st();
		if ( TPT < 0 )
					 {
					 TextSelected = "Your refund will be ";

					 } else
					 {
						  TextSelected = "You will owe ";

					 }

		if ( TPT ==  "No Change" )
		{
		TextSelected = "We recommend:";
		TaxPmt_Total = this.CalcTaxCalc_TPEstmdRsltAfterWHAdjust_st();
		}
		else
		{
		TaxPmt_Total = (( FormatDollarAmont(Math.abs(this.CalcTaxCalc_TPEstmdRsltAfterWHAdjust_st()))));
		}


	//getAddress(document.forms['withholdingform'].zipCode.value,'3333')
	  
	  
	  if(addressStatus=='success')
		{
	  //alert('setting the address'+addressVal)
	  lzSetCanvasAttribute('address', addressVal,'3333');
	  lzSetCanvasAttribute('mapURL', mapURL,'3333');
	}

		document.forms['withholdingform'].tpBox3Status.value=TPBox3Status;
		document.forms['withholdingform'].tpBox5Amt.value=TPBox5Amt;
		document.forms['withholdingform'].tpBox6Amt.value=TPBox6Amt;
		document.forms['withholdingform'].tpResult.value=TPResult;
		document.forms['withholdingform'].spBox3Status.value=SPBox3Status;
		document.forms['withholdingform'].spBox5Amt.value=SPBox5Amt;
		document.forms['withholdingform'].spBox6Amt.value=SPBox6Amt;
		document.forms['withholdingform'].spResult.value=SPResult;
		document.forms['withholdingform'].taxPmtTot.value=TaxPmt_Total;
		document.forms['withholdingform'].resultText.value=TextSelected;

		lzSetCanvasAttribute('TextSelected', TextSelected,'3333');
		lzSetCanvasAttribute('TPBox3Status',  TPBox3Status,'3333'); 
		lzSetCanvasAttribute('TPBox5Amt',TPBox5Amt,'3333') ;   
		lzSetCanvasAttribute('TPBox6Amt',TPBox6Amt,'3333');    
		lzSetCanvasAttribute('TPResult',TPResult,'3333');    
		lzSetCanvasAttribute('SPBox3Status',SPBox3Status,'3333'); 
		lzSetCanvasAttribute('SPBox5Amt',     SPBox5Amt,'3333');    
		lzSetCanvasAttribute('SPBox6Amt',     SPBox6Amt,'3333');    
		lzSetCanvasAttribute('SPResult',      SPResult,'3333');     
		lzSetCanvasAttribute('TaxPmt_Total',  TaxPmt_Total,'3333'); 


}

function callDeduction()
{
	
	var flashversion=checkFlash();

		if(isNaN(flashversion))
		{
			flashversion=0;
		}
	
           if (flashversion <7)
           {
	
			omniName='Deduction_Finder_'+referlink+'_html'
			document.location.href="../tax_tips/tax_planning/jobdeduction_finder.html"
		      return; 
		   }
		   else{	
		
				
			omniName='Deduction_Finder'
			var x =lzEmbed({url: 'deduction_finder_main.lzx.swf?&lzproxied=false&__lzhistconn=2222&__lzhisturl=' + escape('lps/includes/h.html?h='), bgcolor: '#eeeeee', width: '545', height: '511', id: 'lzapp1', accessible: 'false'}, lzCanvasRuntimeVersion);
		
			document.getElementById("calcDiv").style.visibility='visible'
			document.getElementById("calcDiv").style.display='block'	
				
			document.getElementById('calcDiv').innerHTML=x;

		}

}
