﻿// JScript File
function sethighlighted(pThisRow)
{
    pThisRow.style.color ="black";
    pThisRow.style.backgroundColor="#d6d6d6";
}

function resethighlight(pThisRow)
{
    pThisRow.style.color ="black";
    pThisRow.style.backgroundColor="";
}

/*===========================Online Distribution Search ====================================*/

function GetProductTypesForDistributionChannel_Search(pDropDown)
{
    lReturnValue = Online_Distribution_Index.GetAllProductTypesDistributionChannel(pDropDown.options[pDropDown.selectedIndex].value);
    lReturnPartsRecords = lReturnValue.value.split("|");
    lDropDown = document.getElementById("ctl00_ContentPlaceHolder2_ddl_ProductType");
    for (i = lDropDown.options.length; i >= 0; i--) 
	{
      lDropDown.options[i] = null; //clear out the list;
    }
    lDropDown.options[0] = new Option("SELECT");
    
    for (i=0;i < lReturnPartsRecords.length; i++)
    {
        lReturnParts = lReturnPartsRecords[i].split("~");
        lDropDown.options[i+1] = new Option(lReturnParts[1]);
        lDropDown.options[i+1].value = lReturnParts[0]
       
    }
}

function GetAllPolicyNumbersThisProductTypeDistribution_Search(pDropDown)
{
    lDistributionChannel = document.getElementById("ctl00_ContentPlaceHolder2_ddl_DistributionChannel").value;
    lReturnValue = Online_Distribution_Index.GetAllPolicyNumbersThisProductTypeDistribution(lDistributionChannel,pDropDown.options[pDropDown.selectedIndex].value);
    lReturnPartsRecords = lReturnValue.value.split("|");
    lDropDown = document.getElementById("ctl00_ContentPlaceHolder2_ddl_PolicyNumber");
    for (i = lDropDown.options.length; i >= 0; i--) 
	{
      lDropDown.options[i] = null; //clear out the list;
    }
    lDropDown.options[0] = new Option("SELECT");
    
    for (i=0;i < lReturnPartsRecords.length; i++)
    {
        lReturnParts = lReturnPartsRecords[i].split("~");
        lDropDown.options[i+1] = new Option(lReturnParts[1]);
        lDropDown.options[i+1].value = lReturnParts[0]
       
    }
}


/*===========================Online Distribution Search FROM Search Results ====================================*/

function GetProductTypesForDistributionChannel_SearchResults(pDropDown)
{
    lReturnValue = Online_Distribution_SearchResults.GetAllProductTypesDistributionChannel(pDropDown.options[pDropDown.selectedIndex].value);
    lReturnPartsRecords = lReturnValue.value.split("|");
    lDropDown = document.getElementById("ctl00_ContentPlaceHolder2_ddl_ProductType");
    for (i = lDropDown.options.length; i >= 0; i--) 
	{
      lDropDown.options[i] = null; //clear out the list;
    }
    lDropDown.options[0] = new Option("SELECT");
    
    for (i=0;i < lReturnPartsRecords.length; i++)
    {
        lReturnParts = lReturnPartsRecords[i].split("~");
        lDropDown.options[i+1] = new Option(lReturnParts[1]);
        lDropDown.options[i+1].value = lReturnParts[0]
       
    }
}

function GetAllPolicyNumbersThisProductTypeDistribution_SearchResults(pDropDown)
{
    lDistributionChannel = document.getElementById("ctl00_ContentPlaceHolder2_ddl_DistributionChannel").value;
    lReturnValue = Online_Distribution_SearchResults.GetAllPolicyNumbersThisProductTypeDistribution(lDistributionChannel,pDropDown.options[pDropDown.selectedIndex].value);
    lReturnPartsRecords = lReturnValue.value.split("|");
    lDropDown = document.getElementById("ctl00_ContentPlaceHolder2_ddl_PolicyNumber");
    for (i = lDropDown.options.length; i >= 0; i--) 
	{
      lDropDown.options[i] = null; //clear out the list;
    }
    lDropDown.options[0] = new Option("SELECT");
    
    for (i=0;i < lReturnPartsRecords.length; i++)
    {
        lReturnParts = lReturnPartsRecords[i].split("~");
        lDropDown.options[i+1] = new Option(lReturnParts[1]);
        lDropDown.options[i+1].value = lReturnParts[0]
       
    }
}


/*===========================Custom Validators for Checkout ====================================*/

function NoPoBox(source, arguments)
{
     lValue  = arguments.Value.toLowerCase();
     if (lValue.indexOf("po box") > -1 || lValue.indexOf("p.o. box") > -1 || lValue.indexOf("p o  box") > -1 )
      {
         arguments.IsValid=false;
      }
      else 
      {
         arguments.IsValid=true;
      }

}





