


function popWin(pageToLoad,winName,width,height)
  {
    /* Opens a pop-up window on the user's desktop.
       The window will be in the center of the screen (if supported)

       Arguments:
        pageToLoad - The URL of a page to load in the browser window.
                     This can be a relative URL or fully qualified.
        winName    - Name of the new window.
        width      - The horizontal size of the new window.
        height     - The vertical size of the new window.
    */
    xpos=0;
    ypos=0;
    if (screen.width)
    {
      xpos=(screen.width-width)/2;
      ypos=(screen.height-height)/2;
    }
    args="width="+width+",height="+height+",location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,hotkeys=0,screenx="+xpos+",screeny="+ypos+",left="+xpos+",top="+ypos;
    newwindow = window.open(pageToLoad,winName,args);

    if (window.focus) {
      newwindow.focus();
    }
  }

  function popScrollWin(pageToLoad,winName,width,height)
  {
    /* Opens a pop-up window on the user's desktop.
       The window will be in the center of the screen (if supported)

       Arguments:
        pageToLoad - The URL of a page to load in the browser window.
                     This can be a relative URL or fully qualified.
        winName    - Name of the new window.
        width      - The horizontal size of the new window.
        height     - The vertical size of the new window.
    */
    xpos=0;
    ypos=0;
    if (screen.width)
    {
      xpos=(screen.width-width)/2;
      ypos=(screen.height-height)/2;
    }
    args="width="+width+",height="+height+",location=0,menubar=0,resizable=0,scrollbars=1,status=0,titlebar=0,toolbar=0,hotkeys=0,screenx="+xpos+",screeny="+ypos+",left="+xpos+",top="+ypos;
    newwindow = window.open(pageToLoad,winName,args);
    if (window.focus) {
      newwindow.focus();
    }

  }

  function switchImgByURL()
{
  if (document.images)
  {
    for (var ctr=0; ctr<switchImgByURL.arguments.length; ctr+=2)
    {
        img = document.getElementById(switchImgByURL.arguments[ctr]);
        if(img && img.src)
        {
            img.src = switchImgByURL.arguments[ctr+1];
        }
    }
  }
}

function showHideElement(id, forceDisplay)
{
  try
  {
    var elm = document.getElementById(id);
    if(elm.style.display == 'none' || forceDisplay)
    {
      elm.style.display = "block";
      return true;
    }
    else
    {
      elm.style.display = "none";
      return false;
    }
  }
  catch(e){}
}

function resetFields() {
   for ( i=0; i < document.forms[0].elements.length; i++) {
      if ( ! ( document.forms[0].elements[i].readOnly  || document.forms[0].elements[i].disabled) ) {

         if (( document.forms[0].elements[i].type == 'text' ) || ( document.forms[0].elements[i].type == 'textarea' ) || ( document.forms[0].elements[i].type == 'password' )) {
            document.forms[0].elements[i].value = '';
         }

         if ( document.forms[0].elements[i].type == 'checkbox' ) {
            document.forms[0].elements[i].checked = false;
         }

         if ( document.forms[0].elements[i].type == 'select-one' && ( document.forms[0].elements[i].length != 0 )) {
            document.forms[0].elements[i].options[0].selected = true;
         }

      }
   }
}

