﻿/// <reference name="MicrosoftAjax.debug.js" />
/// <reference path="Common.js" />
/// <reference path="JSHashtable.js" />

var g_iProgressDelay;
var gInitProdCount;
var gHashProds = new Solarweb.Common.Collections.Hashtable();

function pageLoad()
{   
  g_iProgressDelay = -1;
  
  initProductsPage();  
  if (gHashProds.get_id()==null)
        {
          gHashProds.set_id('gHashProds');
          gHashProds.initialize();
          Sys.Application.addComponent(gHashProds);
          getSessionProducts(); 
        }
}

function initProductsPage()
{   
  var iCountOfPclms = getCountOfPclmsChecked();
  if(iCountOfPclms > 0)
  {
    if(iCountOfPclms === 9)
    {
        // everything checked
        $get('chkPCLMSelectAll').checked = true;
    }
    else
    {
        // something checked
        // not everything checked
        $get('chkPCLMSelectAll').checked = false;
    }
  } 
  else
  {
    // no pclms checked
    $get('chkPCLMSelectAll').checked = false;    
  }     
}

function getCountOfPclmsChecked()
{
  var iCount = 0;
  for(var i=1; i<=9; i++)
  {
    if($get('chkPclm_' + i.toString()).checked === true)
        iCount++;
  }
  return iCount;
}

if( typeof(Sys) !== 'undefined' )
  Sys.Application.notifyScriptLoaded();