var queryString     = "";
var cookiePID       = "";
var urlPID          = "";
var main_cookie = "";
var qs              = "";
var tempQS          = "";
var iBegPos         = 0;
var time_entered    = "";
var siteID          = "";
var paidSearch      = 0;
var srchTerm        = "";
var bSearchEngine   = false;    // set to true if referrer is a search engine

var nvp_count           = 0;

var QSTRING_names       = new Array();
var QSTRING_values      = new Array();

function taxcutLogin(bNewWindow)
{   // only call this function if visitor hasn't selected a tax product yet
        if (bNewWindow)
        {
            window.open('/loginRedirect.html?TaxType=OPP&FV=T&HT=F&TaxYear=2007&PartnerID=0','','');
        }
        else
        {
           window.location = "/loginRedirect.html?TaxType=OPP&FV=T&HT=F&TaxYear=2007&PartnerID=0";
        }
}

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);
    query           = unescape(query);

    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 getSearchTerm()
{
    // If possible, get the search term passed to us from certain search engines.  This term can be
    // used for various purposes across the site

    // determine if referrer is available
    // determine if referrer is a search engine
    // extract search term from appropriate name/value pair
    
    if (document.referrer != null)
    {   // referrer information is available
        if (document.referrer.indexOf("?") != -1)
        {   // referrer sent a query string in url
            referrer_query = document.referrer.substr(document.referrer.indexOf("?")); 
        }
    }   
    else
    {
        return;
    }

    if ((document.referrer.indexOf('google.com') > -1) )
    {
        bSearchEngine = true;
        srchTerm    =  referrer_query=="" ? "" : getNVPV(referrer_query, 'q', false); 
    } 
    else if ((document.referrer.indexOf('yahoo.com') > -1)) 
    {
        bSearchEngine = true;
        srchTerm    = referrer_query=="" ? "" : getNVPV(referrer_query, 'p', false); 
    } 
    else if ((document.referrer.indexOf('msn.com') > -1)) 
    {
        bSearchEngine = true;
        srchTerm    = referrer_query=="" ? "" : getNVPV(referrer_query, 'q', false);                
    } 
    else if ((document.referrer.indexOf('aol.com') > -1)) 
    {
        bSearchEngine = true;
        srchTerm    = referrer_query=="" ? "" : getNVPV(referrer_query, 'query', false); 

        if (srchTerm=="")
        {
            srchTerm    = referrer_query=="userQuery-nfd" ? "" : getNVPV(referrer_query, 'userQuery', false); 
        }               
    } 
    else if ((document.referrer.indexOf('netscape.com') > -1)) 
    {
        bSearchEngine = true;
        srchTerm    = referrer_query=="" ? "" : getNVPV(referrer_query, 'query', false); 

        if (srchTerm=="")
        {
            srchTerm    = referrer_query=="userQuery-nfd" ? "" : getNVPV(referrer_query, 'userQuery', false); 
        }                
    } 
    else if ((document.referrer.indexOf('ask.com') > -1)) 
    {
        bSearchEngine = true;
        srchTerm    = referrer_query=="" ? "" : getNVPV(referrer_query, 'q', false);

        if (srchTerm=="")
        {
            srchTerm    = referrer_query=="" ? "" : getNVPV(referrer_query, 'ask', false); 
        }
    }  

    if (bSearchEngine && srchTerm=="")
    {
        srchTerm="search_term_not_available";
    }
}

function searchEngineCheck()
{
    // 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          = "";

    if (document.referrer != null)
    {
        getSearchTerm();
    }

    cookVal = getCookie("main_cookie");

    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 (but not if it was from paid search)
    if ((typeof cookpid)=="undefined" || cookpid=="" || cookpid==null || cookpid==0) 
    {
      bNo_COOKIE_PID    = true;
    }

    qs       = window.parent.location.search;
    qs       = unescape(qs);

    urlpid   = getNVPV(qs, 'otpPartnerId', false);

    if ((typeof urlpid)=="undefined" || urlpid=="" || urlpid==null) 
    {
        bNo_URL_PID   = true;
    }

    // check if visitor came from paid search

    if (bSearchEngine && qs.indexOf('omnisource=') != -1)
    {
        paidSearch = 1; // paidSearch value is referenced in the omniture code
    }

    if (bNo_URL_PID && bNo_COOKIE_PID)
    {

        
        if (paidSearch!="1")
        {
            // if we came from a search engine (but not paid search),  write that search engine partner id to the cookie
            
            // this line allows us to simulate search engine referrals
            srchsim = getQueryValue("srchsim");
            
            if (document.referrer != null)
            {
                if ((document.referrer.indexOf('google.com') > -1)          || (srchsim=="google") )
                {
                    searchPID   =  2054;
                } 
                else if ((document.referrer.indexOf('yahoo.com') > -1)      || (srchsim=="yahoo") ) 
                {
                    searchPID   =  2055;
                } 
                else if ((document.referrer.indexOf('msn.com') > -1)        || (srchsim=="msn") ) 
                {
                    searchPID   =  2056;
                } 
                else if ((document.referrer.indexOf('aol.com') > -1)        || (srchsim=="aol") ) 
                {
                    searchPID   =  2057;
                } 
                else if ((document.referrer.indexOf('netscape.com') > -1)   || (srchsim=="netscape") ) 
                {
                    searchPID   =  2058;
                } 
                else if ((document.referrer.indexOf('ask.com') > -1)  || (srchsim=="ask") ) 
                {
                    searchPID   =  2059;
                }  

                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(main_cookie, 'tpage', false);

                    if ((typeof cookieTunnelInd)!="undefined" || cookieTunnelInd!="" || cookieTunnelInd!=null)
                    {   
                        if (cookieTunnelInd=="1")
                        {
                            setCookie("main_cookie", "", null, "/");
                        }
                    }

                    setCookie("main_cookie", "otpPartnerId="+searchPID+"&PartnerId="+searchPID+"&srchterm="+srchTerm, null, "/");
                }
            }
        }
    }   
}

function IDcheck() {

	var qs = window.parent.location.search;
    qs = unescape(qs);

	// 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);
    url_cid      = getNVPV(qs, '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);
    url_campaignid      = getNVPV(qs, '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';
   //}

   main_cookie = getCookie("main_cookie");
   main_cookie = "&" + main_cookie;
   
   cookiePID = getNVPV(main_cookie, 'otpPartnerId', false);

   if ((typeof cookiePID)=="undefined" || cookiePID=="" || cookiePID==null) {
      cookiePID   = null;
   }

   qs  = window.parent.location.search;
   //urlPID = getNVPV(window.parent.location.search, 'otpPartnerId', false);
   urlPID = getNVPV(qs, '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 main_cookie = "";
    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
    main_cookie = getCookie("main_cookie");
    main_cookie = "&" + main_cookie;

    cookieTunnelInd = getNVPV(main_cookie, 'tpage', false);

    if ((typeof cookieTunnelInd)!="undefined" || cookieTunnelInd!="" || cookieTunnelInd!=null)
    {   if (cookieTunnelInd=="1")
        {
            setCookie("main_cookie", "", null, "/");
         }
    }

    // ********
    // FIRST: try to get otpPartnerId from cookie
    // ********
    main_cookie = getCookie("main_cookie");
    main_cookie = "&" + main_cookie;
    cookiePID       = getNVPV(main_cookie, 'otpPartnerId', false);

    if ((typeof cookiePID)=="undefined" || cookiePID=="" || cookiePID==null)
    {   cookiePID   = null;
    }

    // ********
    // SECOND: try to get otpPartnerId from the url
    // ********
    qs  = location.search;
    qs  = unescape(qs);

    //urlPID = getNVPV(location.search, 'otpPartnerId', false);
    urlPID = getNVPV(qs, '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("main_cookie", "otpPartnerId="+partnerId+"&PartnerID="+partnerId, null, "/");
    }
    else if (urlPID != null)
    {   
        if (urlPID == cookiePID)
        {
            // don't do anything since you might overwrite additional parm info in the cookie
            // that was captured during visitors first visit.
        }
        else
        {   // 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("main_cookie", qs+"&PartnerID="+urlPID, null, "/");
        }
    }
    else if (cookiePID != null)
    {   // do nothing, cookie already exists and no url value
        partnerId   = cookiePID;
    }    
}

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;
    }

    // ***********************************************************************************
    // begin special parms processing
    // ***********************************************************************************
    // parms that need to be passed to office_locator.html can be specified by calling this function as follows:
    // validateZipCode("parms_to_pass:name1=value&name2=value");
    var parmsToPassToLocator = "";
    var bAmpAdded    = 0;

    var argArray;
    var tempStr = "";

    for(var i=0; i<arguments.length; i++)
    {
       argArray = arguments[i].split(":");

       if (argArray[0].toLowerCase()=="parms_to_pass")
       {
            if (bAmpAdded==0)
            {
                parmsToPassToLocator += "&";
                bAmpAdded=1;
            }
            parmsToPassToLocator += argArray[1];
       }
    }
    // end special parms processing

    window.location="/universal/office_locator.html?zip="+strZip+parmsToPassToLocator;

    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[69] = "/loginRedirect.html?TaxType=TCL&HT=F&FV=F&OtpExt=1&";
//pS[80] = "/loginRedirect.html?TaxType=OPS&productId=80&FV=T&HT=F&";

pS[30] = "/loginRedirect.html?TaxType=TCL&FV=T&HT=F&TaxYear=2007&";            // tco basic
pS[31] = "/product.jsp?productId=31&";                                         // tco split page
pS[32] = "/loginRedirect.html?TaxType=OPP&FV=T&HT=F&TaxYear=2007&";            // tco premium
pS[33] = "/loginRedirect.html?TaxType=SIG&FV=T&HT=F&TaxYear=2007&";            // tco signature
pS[44] = "/loginRedirect.html?TaxType=TCL&FV=T&HT=F&Target=ATA&TaxYear=2007&"; // tco ata
pS[46] = "/loginRedirect.html?TaxType=TCL&FV=T&HT=F&OtpExt=1&TaxYear=2007&";   // extension   
pS[62] = "/loginRedirect.html?TaxType=PTS&FV=T&HT=F&TaxYear=2007&";            // tco online office
pS[64] = "/product.jsp?productId=64&";                                         // tco online services split
pS[65] = "/universal/office_locator.html?";                                    // tco office locator
pS[69] = "/loginRedirect.html?TaxType=TCL&HT=F&FV=F&OtpExt=1&TaxYear=2007&";   // tco extension
pS[80] = "/loginRedirect.html?TaxType=OPS&FV=T&HT=F&TaxYear=2007&";            // tco premium + state

//software
pS[34] = "/taxes/products/product.jsp?productId=34&tclm=1&";
pS[35] = "/taxes/products/product.jsp?productId=35&tclm=1&";
pS[36] = "/taxes/products/product.jsp?productId=36&tclm=1&";
pS[37] = "/taxes/products/product.jsp?productId=37&tclm=1&";
pS[38] = "/taxes/products/product.jsp?productId=38&tclm=1&";
pS[40] = "/taxes/products/product.jsp?productId=40&tclm=1&";
pS[81] = "/taxes/products/product.jsp?productId=81&tclm=1&";
pS[82] = "/taxes/products/product.jsp?productId=82&tclm=1&";
pS[83] = "/taxes/products/product.jsp?productId=83&tclm=1&";

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[69] = "/taxes/products/product.jsp?productId=69&";
pL[80] = "/taxes/products/product.jsp?productId=80&";
//software
pL[34] = "/taxes/products/product.jsp?productId=34&tclm=1&";
pL[35] = "/taxes/products/product.jsp?productId=35&tclm=1&";
pL[36] = "/taxes/products/product.jsp?productId=36&tclm=1&";
pL[37] = "/taxes/products/product.jsp?productId=37&tclm=1&";
pL[38] = "/taxes/products/product.jsp?productId=38&tclm=1&";
pL[40] = "/taxes/products/product.jsp?productId=40&tclm=1&";
pL[81] = "/taxes/products/product.jsp?productId=81&tclm=1&";
pL[82] = "/taxes/products/product.jsp?productId=82&tclm=1&";
pL[83] = "/taxes/products/product.jsp?productId=83&tclm=1&";

function staticPageStartNow(requestedProductId)
{ 
staticProductStartNow(requestedProductId)
}
function staticProductStartNow(requestedProductId)
{ 
    // Read the main_cookie 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("main_cookie");    
    
    // 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();

var omnivariable =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';
//changed to 2007
calcURLS[3]='/calcs/calculators2007/amtestimator2007/frameset.jsp'

omnivariable[3]='AMT_'

//2006 Withholding
calcURLS[4]='/taxes/tools/2006_whcalc/frameset.jsp';


//2006 Savers Credit Calculator
//calcURLS[5]='/taxes/tools/2006_saverscalc/frameset.jsp';
//changed to 2007
calcURLS[5]='/calcs/calculators2007/savers2007/frameset.jsp';
omnivariable[5]='savers_2007_'


//Checklist Tool
calcURLS[6]='/taxes/tax_tips/tax_planning/tax_checklist.html';
omnivariable[6]='checklist_'

//Rate Tables
calcURLS[7]='/taxes/tax_calculators/rate_tables/filing_status.html';
omnivariable[7]='ratetables_status'

//Advice JSP pages
calcURLS[8]='/learning/advice/advice_generator/osadviceoptions.jsp';

//2006 DayCare Calculator
//calcURLS[9]='/taxes/tools/2006_daycarecalc/frameset.jsp';
//changed to 2007

calcURLS[9]='/calcs/calculators2007/daycare2007/frameset.jsp';
omnivariable[9]='daycare_2007_'


//2006 Education Tax Benefit Calculator
//calcURLS[10]='/taxes/tools/2006_educalc/frameset.jsp';
//2007 Education Tax Benefit Calculator
calcURLS[10]='/calcs/calculators2007/eduestimator2007/frameset.jsp';
omnivariable[10]='edutax_2007_'



//2006 Self-employment Calculator
//calcURLS[11]='/taxes/tools/2006_secalc/frameset.jsp';
//2007 Self-employment Calculator
calcURLS[11]='/calcs/calculators2007/seestimator2007/frameset.jsp';
omnivariable[11]='selfemp_2007_'

//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';

//2005 Self-employment Calculator
calcURLS[18]='/calcs/calculators2007/taxestimator2007/frameset.jsp';
omnivariable[18]='Tax_Est2007_';
var omniName="";
function showCalcs(indx,referlink)
{
 var calcLinks =new Array('none','taxest','dedfind','amt','with')
if (  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;

		
		 document.location=calcURLS[indx]
	}
else if (indx==1 || indx==2 || indx==4 || indx==18 || indx==3)
{
	 
	 var tmpURL=document.location.pathname;
	 if (tmpURL.indexOf('tax_calculators/index.html')>0)
	{
	 		displayCalc(indx,referlink);
		trackWebAnalytics();
	}
	 else
			document.location="/taxes/tax_calculators/index.html?calcIndx="+indx+'&referlink='+referlink;
}
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 main_cookie 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("main_cookie");    
    
    // 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');

}

FLASH_MAX = 9; // the latest Flash plug-in version or higher
FLASH_VERSION = 0;
function flashversion()
{
var agent = navigator.userAgent.toLowerCase();
if(navigator.plugins != null && navigator.plugins.length > 0){
    var plugin = navigator.plugins['Shockwave Flash'];
    if(typeof plugin == 'object'){
        for(i=3; i<= FLASH_MAX; i++){
            if(plugin.description.indexOf(i+'.') != -1){
               FLASH_VERSION = i;
            }
        }
    }
}else if(document.all && agent.indexOf('win') != -1 && agent.indexOf('16bit') == -1){
    document.write('<'+'script language="VBScript"'+'> \n');
        document.write('set FlashObj = Nothing \n');
        document.write('on error resume next \n');
        document.write('For i = '+FLASH_MAX+' to 3 step -1 \n');
            document.write('set FlashObj = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n');
            document.write('If (Not(FlashObj is Nothing)) Then \n');
                document.write('FLASH_VERSION = i \n');
                document.write('Exit For \n');
            document.write('End If \n');
        document.write('Next \n');
    document.write('<'+'\/script'+'> \n');
}else if(agent.indexOf('webtv/2.5') != -1){
    FLASH_VERSION = 3;
}else if(agent.indexOf('webtv') != -1){
    FLASH_VERSION = 2;
}else{
    FLASH_VERSION = -1;
}
return FLASH_VERSION
}
 


