/*  JS for STOCK AND FUND ANALYSIS search box Start   */
function quotepopWindow()
{
    tick=document.getElementById('stock').value;
    if(tick!="")
        open_new_window('http://www.zacks.com/research/qp_stock.php?t='+tick,'PQ','550','405','NO');
    else
    {
        alert('Please Enter Ticker!');
        document.getElementById('stock').focus();
    }
}
/*  JS for STOCK AND FUND ANALYSIS search box End   */
/*  JS for See all Categories/Sector list dropdown option Start   */
function getfunds()
{
    var keyselection = document.getElementById('selectcat');
    var keyvalue = keyselection.options[keyselection.selectedIndex];
    var fundVal = keyvalue.value;

    if (fundVal =='All')
    {
      fundVal = ''
    }
    document.location.href="http://www.zacks.com/funds/mutualfund/allmfs.php?rank_in=ALL&TableType=1Y&fundtype="+fundVal;
}
/*  JS for See all Categories/Sector list dropdown option End   */
/*  JS for Compare Multiple Funds input box Start   */
function validate(chkLogin)
{
    blnSubmit = true;
    tickCount = 0;

    Str1 = document.getElementById('t6').value.toUpperCase();

    strlen1 = Str1.length
    blnSubmit = chkTicker(strlen1);

    if(blnSubmit == true)
        tickCount = tickCount + 1;

    Str2 = document.getElementById('t2').value.toUpperCase();

    strlen2 = Str2.length

    if(strlen2 > 0)
    {
        blnSubmit = chkTicker(strlen2);

        if(blnSubmit == true)
            tickCount = tickCount + 1;
    }

    Str3    = document.getElementById('t3').value.toUpperCase();
    strlen3    = Str3.length

    if(strlen3 > 0)
    {
        blnSubmit = chkTicker(strlen3);

        if(blnSubmit == true)
            tickCount = tickCount + 1;
    }

    Str4    = document.getElementById('t4').value.toUpperCase();
    strlen4    = Str4.length

    if(strlen4 > 0)
    {
        blnSubmit = chkTicker(strlen4);

        if(blnSubmit == true)
            tickCount = tickCount + 1;
    }

    Str5    = document.getElementById('t5').value.toUpperCase();
    strlen5    = Str5.length

    if(strlen5 > 0)
    {
        blnSubmit = chkTicker(strlen5);

        if(blnSubmit == true)
            tickCount = tickCount + 1;
    }

    if(tickCount == 1)
    {
        alert("Please enter at least two ticker names");
        document.getElementById('t2').focus();
    }
    if(blnSubmit==true && tickCount > 1)
    {
        //if(chkLogin != '') //login state
        //{
            document.location.href="http://www.zacks.com/funds/fundcompare/comparefunds.php?opt=c&t1="+Str1+"&t2="+Str2+"&t3="+Str3+"&t4="+Str4+"&t5="+Str5;
        //}
        //else   //not login state
        //{
            //document.location.href= "http://www.zacks.com/funds/info/?adid=ZP_online_mutualfund&continue_to='http://www.zacks.com/funds/fundcompare/comparefunds.php?opt=c&t1="+Str1+"&t2="+Str2+"&t3="+Str3+"&t4="+Str4+"&t5="+Str5+"'";
        //    document.location.href= "http://www.zacks.com/funds/info/?adid=ZP_online_mutualfund";
        //}
    }
    return false;
}

/*  JS for Compare Multiple Funds input box End   */
/*  JS for Find Similar Mutual Funds input box Start   */
function validate1(chkLogin)
{
    var Str1 =document.getElementById('t1').value.toUpperCase();
    strlen1 = Str1.length
    blnSubmit = chkTicker(strlen1);
    if(blnSubmit == true)
    {
        //if(chkLogin != '') //login state
        //{
            document.location.href="http://www.zacks.com/funds/fundcompare/comparefunds.php?opt=f&t1="+Str1;
        //}
        //else //not login state
        //{
            //document.location.href="http://www.zacks.com/funds/info/?adid=ZP_online_mutualfund&continue_to='http://www.zacks.com/funds/fundcompare/comparefunds.php?opt=f&t1="+Str1+"'";
        //    document.location.href="http://www.zacks.com/funds/info/?adid=ZP_online_mutualfund";
        //}
    }
    return false;
}
/*  JS for Find Similar Mutual Funds input box End   */
/*  JS used for validate1(), validate() Start   */
function chkTicker(strlen1)
{
    blnSubmit = true;

    if(strlen1 == 0)
    {
        alert('Symbol cannot be empty');
        //document.getElementById('t1').focus();
        blnSubmit = false;
    }
    else if(strlen1 !='5')
    {
        alert('Symbol should be of 5 characters');
        //document.getElementById('t1').focus();
        blnSubmit = false;
    }
    return blnSubmit;
}

function getfamily()
{
    fund_family = document.getElementById("familyList").value;
    document.location.href="http://www.zacks.com/funds/fundcompare/findFamilyFunds.php?opt=ff&fundtype="+fund_family+"&familyButton=Find+in+Family";
}
/*  JS used for validate1(), validate() End   */
