// JavaScript Document
function openWin(url, width, height)
{ 
    windowName = "popup";
    params = "toolbar=0,";
    params += "location=0,";
    params += "directories=0,";
    params += "status=0,";
    params += "menubar=0,";
    params += "scrollbars=1,";
    params += "resizable=1,"; 
    
    params += "width="+width+",";
    params += "height="+height;
    
    win = window.open(url, windowName, params);
    if(!win)
    {
      alert ("Turn off pop-up blockers");
    }
    else
    {
      win.opener.name = "opener";
      win.focus();    
    }
    //return win;
}

////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////// preload checkboxes, radio buttons and pull downs ///////////////////////////////////
/////////////// ideal for redisplay after captcha                ///////////////////////////////////
//Example:      sbPreloadPreviousValues(document.frmForm.SOME_Select_Radio_Checkbox, '<% = session.Contents("SOME_Select_Radio_Checkbox") %>');
//Details:                             ( ^^^^^^^ some input as DOM object ^^^^^^   , '^^^^^^    a string value to search     ^^^^^^        ');
function sbPreloadPreviousValues(oInput,sValues)
{
  if(typeof(oInput.selectedIndex) != 'undefined') //pull down
  {
    for(i=0;i<oInput.length;i++)
    {
      if(sValues == oInput[i].value)
      {
        oInput.selectedIndex = i;
        break;
      }
    }  
  }
  else if(typeof(oInput.length) == 'undefined') //single checkbox in group
  {
    if(sValues.indexOf(oInput.value) > -1)
      oInput.checked = true;
  }
  else //check each checkbox or radio button
  {
    var a_Values = sValues.split(",");
    for(i=0;i<oInput.length;i++)
    {
      for(j=0;j<a_Values.length;j++)
      {
        if( jQuery.trim(oInput[i].value) == jQuery.trim(a_Values[j]) )
          oInput[i].checked = true;
      }
    }
  }
}



