var queryString     = "";
var cookiePID       = "";
var urlPID          = "";
var hrblockQSCookie = "";
var qs              = "";
var tempQS          = "";
var iBegPos         = 0;
var time_entered    = "";
var siteID          = "";

var nvp_count           = 0;

var QSTRING_names       = new Array();
var QSTRING_values      = new Array();

function getNVPV(strURL, strParmName, bCaseSpecific)
{   
    // Description: returns value of a name/value pair in the passed URL string
    // Usage: getNVPV(url, 'ADCAMPAIGN', '1');
    //
    // Parameters:
    //   strURL: url to extract the name/value pair from
    //   strParmName: name part of name/value pair
    //   bCaseSpecific: when searching for name, use case passed to function. 1==true; 0==false
    //
    // Returns:
    //  the value of the nvp if found and "" if not found

    if (bCaseSpecific)
    { 
    }
    else
    {
        strParmName = strParmName.toLowerCase();
        strURL      = strURL.toLowerCase();
    }

    var strChar = "";

    if (strURL.indexOf("?"+strParmName+"=") != -1)
    {   strChar = "?";
    }
    else if (strURL.indexOf("&"+strParmName+"=") != -1)
    {   strChar = "&";
    }
    else
    {   return "";
    }

    var strTemp1 = strURL.substring(strURL.indexOf(strChar+strParmName+"=")+strParmName.length+2, strURL.length);

    if (strTemp1.indexOf("&", 0) == -1)
    {   return strTemp1;
    }
    else
    {   return strTemp1.substring(0, strTemp1.indexOf("&"));
    }
}

function splitQueryString()
{
    // splits url query string into array elements
    var query       = window.parent.location.search.substring(1);

    var pairs       = query.split("&");
    var argname     = "";
    var value       = "";

    for (var i=0;i<pairs.length;i++)
    {
        var pos = pairs[i].indexOf('=');

        if (pos >= 0)
        {
            argname = pairs[i].substring(0,pos);
            value   = pairs[i].substring(pos+1);

            if (argname.toLowerCase()=="orpid" && value != "")
            {
                orpid_index     = nvp_count;
            }

            QSTRING_names[QSTRING_names.length]     = argname;
            QSTRING_values[QSTRING_values.length]   = value;

            nvp_count++;
        }
    }
}

function getQueryValue(name)
{
    // returns name/value pair value if parsed in splitQueryString() function else returns null
    var value       = null;
    var lowerName   = name.toLowerCase();

    for (var i=0;i<QSTRING_names.length;i++)
    {
        if (QSTRING_names[i].toLowerCase()==lowerName)
        {
            value = QSTRING_values[i];
            break;
        }
    }
    return value;
}

function searchEngineCheck()
{
    bDebug  = getQueryValue("bugit");
    // logic is... 
    // if (no partner id passed in url and no partner id in cookie) AND
    //   if (not from paid search) AND
    //      if (from search engine) THEN
    //          write appropriate partner id assigned to that search engine to the cookie
    //          so it gets passed along to otp

    var bNo_URL_PID      = false;
    var bNo_COOKIE_PID   = false;

    var cookVal          = "";
    var cookpid          = "";
    var urlpid           = "";
    var searchPID        = "";
    var srchsim          = "";
    var srchTerm         = "";
    
    var bNoReferrerSearch= true;

    cookVal = getCookie("hrblockQSCookie");

    cookVal = "&" + cookVal;

    cookpid = getNVPV(cookVal, 'otpPartnerId', false);

    // if no partner id in cookie OR if it is 0 (hrblock) then write/overwrite it with search engine partner id if 
    // visitor came here via a search engine
    if ((typeof cookpid)=="undefined" || cookpid=="" || cookpid==null || cookpid==0) 
    {
      bNo_COOKIE_PID    = true;
    }
//if (bDebug) alert("cookpid="+cookpid);
    qs       = window.parent.location.search;
    urlpid   = getNVPV(window.parent.location.search, 'otpPartnerId', false);

    if ((typeof urlpid)=="undefined" || urlpid=="" || urlpid==null) 
    {
      bNo_URL_PID   = true;
    }

//if (bDebug) alert("bNo_URL_PID="+bNo_URL_PID);
//if (bDebug) alert("bNo_COOKIE_PID="+bNo_COOKIE_PID);

    if (bNo_URL_PID && bNo_COOKIE_PID)
    {
        // check if visitor came from paid search
        var paidSearch = 0;

        if (window.location.search.indexOf('omnisource=') != -1)
        {
            paidSearch = 1;
        }
        
        if (paidSearch!="1")
        {
            // if we came from a search engine, then write that partner id out to the cookie
            // get referring search engine and set appropriate partner ID
            
            // this line allows us to simulate search engine referrals
            srchsim = getQueryValue("srchsim");
            
            var referrer_search = "";
            
            if (document.referrer != null)
            {
                if (document.referrer.indexOf("?") != -1)
                {
                    referrer_search = document.referrer.substr(document.referrer.indexOf("?")); 
                    bNoReferrerSearch  = false;
                }
            }            

            if ((document.referrer.indexOf('google.com') > -1)          || (srchsim=="google") )
            {
                searchPID   =  2054;
                srchTerm    =  referrer_search=="" ? "" : getNVPV(referrer_search, 'q', false); 
            } 
            else if ((document.referrer.indexOf('yahoo.com') > -1)      || (srchsim=="yahoo") ) 
            {
                searchPID   =  2055;
                srchTerm    = referrer_search=="" ? "" : getNVPV(referrer_search, 'p', false); 
            } 
            else if ((document.referrer.indexOf('msn.com') > -1)        || (srchsim=="msn") ) 
            {
                searchPID   =  2056;
                srchTerm    = referrer_search=="" ? "" : getNVPV(referrer_search, 'q', false);                
            } 
            else if ((document.referrer.indexOf('aol.com') > -1)        || (srchsim=="aol") ) 
            {
                searchPID   =  2057;
                srchTerm    = referrer_search=="" ? "" : getNVPV(referrer_search, 'query', false); 
                
                if (srchTerm=="")
                {
                    srchTerm    = referrer_search=="userQuery-nfd" ? "" : getNVPV(referrer_search, 'userQuery', false); 
                }               
            } 
            else if ((document.referrer.indexOf('netscape.com') > -1)   || (srchsim=="netscape") ) 
            {
                searchPID   =  2058;
                srchTerm    = referrer_search=="" ? "" : getNVPV(referrer_search, 'query', false); 
                
                if (srchTerm=="")
                {
                    srchTerm    = referrer_search=="userQuery-nfd" ? "" : getNVPV(referrer_search, 'userQuery', false); 
                }                
            } 
            else if ((document.referrer.indexOf('ask.com') > -1)  || (srchsim=="ask") ) 
            {
                searchPID   =  2059;
                srchTerm    = referrer_search=="" ? "" : getNVPV(referrer_search, 'q', false);
                
                if (srchTerm=="")
                {
                    srchTerm    = referrer_search=="" ? "" : getNVPV(referrer_search, 'ask', false); 
                }
            }  
            
            if (searchPID != "")
            {
                // if the cookie was written from a tunneled visit, delete it first before proceeding
                // if "&tpage=1" is found in the cookie, then ALWAYS overwrite it since it was a tunnel cookie

                cookieTunnelInd = getNVPV(hrblockQSCookie, 'tpage', false);

                if ((typeof cookieTunnelInd)!="undefined" || cookieTunnelInd!="" || cookieTunnelInd!=null)
                {   
                    if (cookieTunnelInd=="1")
                    {
                        setCookie("hrblockQSCookie", "", null, "/");
                    }
                }
                
                if (bNoReferrerSearch)
                {
                    srchTerm="norefsrch";
                }

                setCookie("hrblockQSCookie", "otpPartnerId="+searchPID+"&PartnerId="+searchPID+"&srchterm="+srchTerm, null, "/");
            }
        }
    }   
}

function IDcheck() {

	var qs = window.parent.location.search;

	// check if CID is in the URL
	// if yes, then assign CID=XXXX to hrblockCIDcookie
	// if not, then do nothing

	var url_cid  = '';
	url_cid      = getNVPV(window.parent.location.search, 'CID', false);

	if((typeof url_cid) != 'undefined' && url_cid != '' && url_cid != null) {
		setCookie('hrblockCIDcookie', 'CID=' + url_cid, null, "/");
	}

	// check if CampaignID is in the URL
	// if yes, then assign CampaignID=XXXX to hrblockCampaignIDcookie
	// if not, then do nothing

	var url_campaignid  = '';
	url_campaignid      = getNVPV(window.parent.location.search, 'CampaignID', false);

	if((typeof url_campaignid) != 'undefined' && url_campaignid != '' && url_campaignid != null) {
		setCookie('hrblockCampaignIDcookie', 'CampaignID=' + url_campaignid, null, "/");
	}
}

function getCookie(Name)
{
    var search = Name + "=";
    if (document.cookie.length > 0)
    {
        // if there are any cookies
        offset = document.cookie.indexOf(search);
        if (offset != -1)
        {   // cookie exists
            offset += search.length;

            // set index of beginning of value
            end = document.cookie.indexOf(";", offset);

            // set index of end of cookie value
            if (end == -1)
            {   end = document.cookie.length;
            }

            return unescape(document.cookie.substring(offset, end));
        }
    }
}

function getexpirydate(nbrOfDays)
{
    var UTCstring;
    Today       = new Date();
    nomilli     =Date.parse(Today);
    Today.setTime(nomilli+nbrOfDays*24*60*60*1000);
    UTCstring   = Today.toUTCString();
    return UTCstring;
}

function setCookie(cookieName, cookieValue)
{
    var args    = setCookie.arguments;
    var arglen  = setCookie.arguments.length;

    var expires = (arglen > 2) ? args[2] : null;
    var path    = (arglen > 3) ? args[3] : null;
    var domain  = (arglen > 4) ? args[4] : null;
    var secure  = (arglen > 5) ? args[5] : false; // true or false not null

    //document.cookie = cookieName + "=" + escape (cookieValue)+
    document.cookie = cookieName + "=" + cookieValue+
    ((expires == null) ? ""         : ("; expires = " + getexpirydate(expires))) +
    ((path    == null) ? ""         : ("; path=   "   + path))   +
    ((domain  == null) ? ""         : ("; domain=   " + domain)) +
    ((secure  == true) ? "; secure" : "");

}


function checkCookie(){
 
   //var sPath = window.location.pathname;
   //var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);

   //if(sPage != "index.html")
   //{
   // document.signon.Target.value = 'chat';
   //}

   hrblockQSCookie = getCookie("hrblockQSCookie");
   hrblockQSCookie = "&" + hrblockQSCookie;
   
   cookiePID = getNVPV(hrblockQSCookie, 'otpPartnerId', false);

   if ((typeof cookiePID)=="undefined" || cookiePID=="" || cookiePID==null) {
      cookiePID   = null;
   }

   qs  = window.parent.location.search;
   urlPID = getNVPV(window.parent.location.search, 'otpPartnerId', false);

   if ((typeof urlPID)=="undefined" || urlPID=="" || urlPID==null) {
      PartnerID     = null;
   }

   if(cookiePID == null){
      partnerID         = 0;
   } else {
      partnerID         = cookiePID;
   }

   taxType  = getQueryValue("TaxType");

    if (taxType == null)
    {   // if no TaxType specified then assume opp for unavailable check below
        taxType = "opp";   // default to opp if TaxType nvp not specified
    }
   
   document.signon.PartnerID.value      = partnerID;
   //document.signon.siteId.value         = siteId;
   document.signon.time_entered.value   = time_entered;      
   
   setCookie("OTPCookie", taxType, 365, "/", ".hrblock.com");

}

function processCookie()
{
    var queryString     = "";
    var cookiePID       = "";
    var urlPID          = "";
    var hrblockQSCookie = "";
    var qs              = "";
    var tempQS          = "";
    var iBegPos         = 0;
	var cookieTunnelInd = "";

    // if the cookie was written from a tunneled visit, delete it first before proceeding
    // if "&tpage=1" is found in the cookie, then ALWAYS overwrite it since it was a tunnel cookie
    hrblockQSCookie = getCookie("hrblockQSCookie");
    hrblockQSCookie = "&" + hrblockQSCookie;

    cookieTunnelInd = getNVPV(hrblockQSCookie, 'tpage', false);

    if ((typeof cookieTunnelInd)!="undefined" || cookieTunnelInd!="" || cookieTunnelInd!=null)
    {   if (cookieTunnelInd=="1")
        {
            setCookie("hrblockQSCookie", "", null, "/");
         }
    }

    // ********
    // FIRST: try to get otpPartnerId from cookie
    // ********
    hrblockQSCookie = getCookie("hrblockQSCookie");
    hrblockQSCookie = "&" + hrblockQSCookie;
    cookiePID       = getNVPV(hrblockQSCookie, 'otpPartnerId', false);

    if ((typeof cookiePID)=="undefined" || cookiePID=="" || cookiePID==null)
    {   cookiePID   = null;
    }

    // ********
    // SECOND: try to get otpPartnerId from the url
    // ********
    qs  = location.search;
    urlPID = getNVPV(location.search, 'otpPartnerId', false);

    if ((typeof urlPID)=="undefined" || urlPID=="" || urlPID==null)
    {   urlPID      = null;
    }

    // *******************************
    // THIRD: determine what, if any, value to write to cookie
    // *******************************

    if (urlPID==null && cookiePID==null)
    {   // cookiePID and urlPID not found, write cookie with value 0 (hrblock.com) as session cookie
        partnerId   = 0;
        setCookie("hrblockQSCookie", "otpPartnerId="+partnerId+"&PartnerID="+partnerId, null, "/");
    }
    else if (urlPID != null && cookiePID == null)
    {   // no cookie but urlPID present, write entire query string to cookie as session cookie
        partnerId   = urlPID;
        if (qs.indexOf("?")!=-1) qs = qs.slice(qs.indexOf("?")+1);
        tempQS  = qs.toLowerCase();
        iBeginPos   = tempQS.indexOf("otppartnerid");
        qs = qs.substring(0,iBeginPos)+"otpPartnerId="+qs.substring(iBeginPos+13,qs.length);
        setCookie("hrblockQSCookie", qs+"&PartnerID="+urlPID, null, "/");
    }
    else if (urlPID == null && cookiePID != null)
    {   // do nothing, cookie already exists and no url value
        partnerId   = cookiePID;
    }
    else if (urlPID != null && cookiePID != null)
    {   // both found, only write cookie if they are different so initial query string remains intact
        if (urlPID != cookiePID)
        {   // cookiePID overrides urlPID so do nothing
                partnerId   = cookiePID;
        }
        else
        {   partnerId   = urlPID;
        }
    }
    else
    {   partnerId   = -1;
    }
}

var partnerId   = "";
processCookie();

function showDownPage()
{        
        var otpWin;

        if (otpWin = window.open(sysprop_returnUser_maint_url,"otpstatus","width=560,height=280,scrollbars=yes"))
        {
        }
        else
        {
            alert(sysprop_returnUser_maint_msg);
        }
}

function FindAction(Entity){

    checkCookie();

    if (Entity == 'Register' )
    {
        SubmitValidation();
        return true;
    }
    else if (Entity == 'ForgotPassword' )
    {
        window.location = 'ForgotPassword.aspx?BackPage=Login&'
                }
    else if (Entity == 'Update' )
    {
        window.location = 'Login.aspx?Target=UpdateUserInformation&taxtype=OTP&PartnerID='
    }
    else if (Entity == 'Policy' )
    {
        openCTWindow('SecurityPolicy','/universal/privacy.html','status,resizable,width=' + parseInt(Math.min(screen.availWidth,800)) + ',height=' + parseInt(Math.min(screen.availHeight,600)-25) + ',left=0,top=0,screenX=0,screenY=0,scrollbars=1');
    }
    else if (Entity == 'Login' )
    {
        return true;
    }

} //end FindAction()

// several functions require the split query string so the splitQueryString() call
// has been moved inline - 2004/12/28 pintar
splitQueryString();

// check if a search engine partner id should be written to the cookie
searchEngineCheck();

// check if CID or CampaignID should be written to a cookie
IDcheck();

function doTaxes()
{   //document.location="/taxes/doing_my_taxes/";
        document.location="/taxes/products/product.jsp?productId=31";
}

function doExtension()
{   //document.location="/taxes/doing_my_taxes/products/extension.html";
        document.location="/taxes/products/product.jsp?productId=69";
}    

function otpLogin() {
    if(document.getElementById('txtusername').value != '' && document.getElementById('txtpassword').value != '') {
        if ( (typeof sysprop_showPopUnder) !='undefined' && sysprop_showPopUnder==1 ) {
            try {
                window.open('','popunderotp','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=10,height=10,left=2000,top=2000').close();
            } catch(e) { }
        }
        if ( (typeof sysprop_otpStatus)!='undefined' && (sysprop_otpStatus==1 || sysprop_otpStatus==2)) {
            showDownPage();
            return false;
        } else {
            FindAction('Login');
        }
    }
}

function validateZipCode()
{
    var strZip      = document.getElementById('tfZipCode').value
    var ValidChars  = "0123456789.";
    var returnCode  = true;
    var Char;

    if (strZip == '')
    {    
        alert("Please enter a zip code.");
        return false;
    }

    for (i = 0; i < strZip.length; i++)
    {
        Char = strZip.charAt(i);
        if (ValidChars.indexOf(Char) == -1)
        {
            alert("Please enter a valid zip code.");
            return false;
        }
    }

    if (strZip.length != 5)
    {
        alert("Please enter a 5 digit zip code.");
        return false;
    }

    window.location="/universal/office_locator.html?zip="+strZip;
    return false;
}

function loadinparent(url){
    top.location.href = url;
}


var pS = new Array();

//online and office
pS[30] = "/loginRedirect.html?TaxType=TCL&productId=30&FV=T&HT=F&";
pS[31] = "/taxes/products/product.jsp?productId=31?";
pS[32] = "/loginRedirect.html?TaxType=OPP&productId=32&FV=T&HT=F&";
pS[33] = "/loginRedirect.html?TaxType=SIG&productId=33&FV=T&HT=F&";
pS[44] = "/loginRedirect.html?TaxType=TCL&productId=44&FV=T&HT=F&Target=ATA&";
pS[62] = "/loginRedirect.html?TaxType=PTS&productId=62&FV=T&HT=F&";
pS[64] = "/taxes/products/product.jsp?productId=64?";
pS[65] = "/universal/office_locator.html?";
pS[80] = "/loginRedirect.html?TaxType=OPS&productId=80&FV=T&HT=F&";

//software
/*
pS[35] = "http://store.taxcut.com/dr/v2/ec_Main.Entry17c/SID-33195/SP-10023/PID-862520/PN-1/V1-862520/CUR-840/CID-0";
pS[36] = "http://store.taxcut.com/dr/v2/ec_Main.Entry17c/SID-33195/SP-10023/PID-862523/PN-1/V1-862523/CUR-840/CID-0";
pS[37] = "http://store.taxcut.com/dr/v2/ec_Main.Entry17c/SID-33195/SP-10023/PID-862522/PN-1/V1-862522/CUR-840/CID-0";
pS[38] = "http://store.taxcut.com/dr/v2/ec_Main.Entry17c/SID-33195/SP-10023/PID-862524/PN-1/V1-862524/CUR-840/CID-0";
pS[40] = "http://store.taxcut.com/dr/v2/ec_Main.Entry17c/SID-33195/SP-10023/PID-862525/PN-1/V1-862525/CUR-840/CID-0";
pS[81] = "http://store.taxcut.com/dr/v2/ec_Main.Entry17c/SID-33195/SP-10023/PID-862521/PN-1/V1-862521/CUR-840/CID-0";
pS[82] = "http://store.taxcut.com/dr/v2/ec_Main.Entry17c/SID-33195/SP-10023/PID-862526/PN-1/V1-862526/CUR-840/CID-0";
pS[83] = "http://store.taxcut.com/dr/v2/ec_Main.Entry17c/SID-33195/SP-10023/PID-862527/PN-1/V1-862527/CUR-840/CID-0";
*/
pS[34] = "/taxes/products/product.jsp?productId=34&";
pS[35] = "/taxes/products/product.jsp?productId=34&";
pS[36] = "/taxes/products/product.jsp?productId=34&";
pS[37] = "/taxes/products/product.jsp?productId=34&";
pS[38] = "/taxes/products/product.jsp?productId=34&";
pS[40] = "/taxes/products/product.jsp?productId=34&";
pS[81] = "/taxes/products/product.jsp?productId=34&";
pS[82] = "/taxes/products/product.jsp?productId=34&";
pS[83] = "/taxes/products/product.jsp?productId=34&";

var pL = new Array();

// office and online
pL[30] = "/taxes/products/product.jsp?productId=30";
pL[31] = "/taxes/products/product.jsp?productId=31";
pL[32] = "/taxes/products/product.jsp?productId=32";
pL[33] = "/taxes/products/product.jsp?productId=33";
pL[39] = "/taxes/products/product.jsp?productId=39";
pL[44] = "/taxes/products/product.jsp?productId=44";
pL[62] = "/taxes/products/product.jsp?productId=62";
pL[64] = "/taxes/products/product.jsp?productId=64";
pL[65] = "/taxes/products/product.jsp?productId=65";
pL[80] = "/taxes/products/product.jsp?productId=80";
//software
pL[34] = "/taxes/products/product.jsp?productId=34";
pL[35] = "/taxes/products/product.jsp?productId=33";
pL[36] = "/taxes/products/product.jsp?productId=36";
pL[37] = "/taxes/products/product.jsp?productId=37";
pL[38] = "/taxes/products/product.jsp?productId=38";
pL[40] = "/taxes/products/product.jsp?productId=40";
pL[81] = "/taxes/products/product.jsp?productId=81";
pL[82] = "/taxes/products/product.jsp?productId=82";
pL[83] = "/taxes/products/product.jsp?productId=83";

function staticPageStartNow(requestedProductId)
{ 
staticProductStartNow(requestedProductId)
}
function staticProductStartNow(requestedProductId)
{ 
    // Read the hrblockQSCookie to retrieve (if available) the otpPartnerId and other parms
    // that may have been passed into inital visit to hrblock.com.  
    
    // if no cookie value is found, use otpPartnerId=0
    
    var cookieValue = getCookie("hrblockQSCookie");    
    
    // Sometimes we pass additional name/value pairs to start now links which
    // need to be appended to the target start now link. 
    // Add additional parms to this method following one of these two methods:
    // staticPageStartNow(31,"&newparm1=newvalue1","&newparm2=newvalue2");
    // staticPageStartNow(31,"&newparm1=newvalue1&newparm2=newvalue2");
    
    var additionalParms = "";
    
    var args    = staticProductStartNow.arguments;
    var argsLen = staticProductStartNow.arguments.length;
            
    for(var i=0; i<argsLen; i++) 
    {       
        if (args[i].toString().charAt(0)=="&")
        { 
            additionalParms = args[i];
        }
    }
    
    var parms = cookieValue + additionalParms;    
    
    document.location = pS[requestedProductId] + parms;
}

function staticProductLearnMore(requestedProductId)
{ 
    document.location = pL[requestedProductId];
}

function staticPageLearnMore(requestedProductId)
{ 

staticProductLearnMore(requestedProductId);
}

var calcURLS =new Array();

calcURLS[0]='';
calcURLS[1]='';

//DeductionFind (aka Occupational Planner)
calcURLS[2]='/taxes/tax_tips/tax_planning/jobdeduction_finder.html';

//2006 AMT Calculator
calcURLS[3]='/taxes/tools/2006_amtcalc/frameset.jsp';

//2006 Withholding
calcURLS[4]='/taxes/tools/2006_whcalc/frameset.jsp';

//2006 Savers Credit Calculator
calcURLS[5]='/taxes/tools/2006_saverscalc/frameset.jsp';

//Checklist Tool
calcURLS[6]='/taxes/tax_tips/tax_planning/tax_checklist.html';

//Rate Tables
calcURLS[7]='/taxes/tax_calculators/rate_tables/filing_status.html';

//Advice JSP pages
calcURLS[8]='/learning/advice/advice_generator/osadviceoptions.jsp';

//2006 DayCare Calculator
calcURLS[9]='/taxes/tools/2006_daycarecalc/frameset.jsp';

//2006 Education Tax Benefit Calculator
calcURLS[10]='/taxes/tools/2006_educalc/frameset.jsp';

//2006 Self-employment Calculator
calcURLS[11]='/taxes/tools/2006_secalc/frameset.jsp';

//2005 Tax Estimator
calcURLS[12]='/taxes/tools/2005_taxcalc/frameset.jsp';

//2005 DayCare Calculator
calcURLS[13]='/taxes/tools/2005_daycarecalc/frameset.jsp';

//2005 AMT Calculator
calcURLS[14]='/taxes/tools/2005_amtcalc/frameset_2.jsp';

//2005 Educaton Tax Benefit Calculator
calcURLS[15]='/taxes/tools/2005_educalc/frameset.jsp';

//2005 Savers Credit Calculator
calcURLS[16]='/taxes/tools/2005_saverscalc/frameset.jsp';

//2005 Self-employment Calculator
calcURLS[17]='/taxes/tools/2005_SEcalc/new_frameset.jsp';


function showCalcs(indx)
{
 var calcLinks =new Array('none','taxest','dedfind','amt','with')
if (indx==3 || indx==4 || indx==5 || indx==8 || indx==9 || indx==10 || indx==11 || indx==12 || indx==13 || indx==14 || indx==15 || indx==16)
	 WinOpen_(calcURLS[indx],875,500)
else if ( indx==6 || indx==7)
	{
	     var tmpURL=document.location.pathname;

		 if (tmpURL.indexOf('tax_calculators/index.html')>0)
		 {
				if (currCalc==1)
				{			
					if (confirm ('You are now exiting the Tax Estimator. The information you have entered will not be saved. Do you want to continue?'))
						document.location=calcURLS[indx]
					else
						return ;
				}
				else
					document.location=calcURLS[indx]
				
			}
         else
			 document.location=calcURLS[indx]
	}
else if (indx==1 || indx==2)
{
	 var tmpURL=document.location.pathname;
	 if (tmpURL.indexOf('tax_calculators/index.html')>0)
	 		displayCalc(indx);
	 else
			document.location="/taxes/tax_calculators/index.html?calcIndx="+indx
}
else 
 document.location="/taxes/tax_calculators/index.html?calcIndx="+indx


}


// specifically for calculators as the start button should open this in a new window

function staticProductStartNowNewWin(requestedProductId)
{ 
    // Read the hrblockQSCookie to retrieve (if available) the otpPartnerId and other parms
    // that may have been passed into inital visit to hrblock.com.  
    
    // if no cookie value is found, use otpPartnerId=0
    
    var cookieValue = getCookie("hrblockQSCookie");    
    
    // Sometimes we pass additional name/value pairs to start now links which
    // need to be appended to the target start now link. 
    // Add additional parms to this method following one of these two methods:
    // staticPageStartNow(31,"&newparm1=newvalue1","&newparm2=newvalue2");
    // staticPageStartNow(31,"&newparm1=newvalue1&newparm2=newvalue2");
    
    var additionalParms = "";
    
    var args    = staticProductStartNowNewWin.arguments;
    var argsLen = staticProductStartNowNewWin.arguments.length;
            
    for(var i=0; i<argsLen; i++) 
    {       
        if (args[i].toString().charAt(0)=="&")
        { 
            additionalParms = args[i];
        }
    }
    
    var parms = cookieValue + additionalParms;    
    

	window.open(pS[requestedProductId] + parms,'productwin',
'left=20,top=20,width=900,height=500,toolbar=1,resizable=1');

}

