// *****************************************************************************
// FILE
// Name             : fn_utility.js
// Date             : 2001-03-10
// Author           : AdNet
// Purpose          : A set of utility functions
// -----------------------------------------------------------------------------

function open_window(url, width, height)
{
     var left = (screen.width - width)/2;
     var top = (screen.height - height)/2;
     var status = 'scrollbars=yes,resizable=yes,menubar=no,toolbar=no' + ',width=' + width + ',height=' + height;
     // put ie args last otherwise netscape 4.x ignore remaining
     status += ',left=' + left + ',top=' + top;
     window.open(url, null, status);
}

function ImageON(image)
{
     if (document.images)
     {
          document[image].src=eval(image + 'on.src');
     }
}

function ImageOFF(image)
{
     if (document.images)
     {
          document[image].src=eval(image + 'off.src');
     }
}

function ImagePUSH(image)
{
     if (document.images)
     {
          document[image].src=eval(image + 'push.src');
     }
}

function ImageSEL(image)
{
     if (document.images)
     {
          document[image].src=eval(image + 'sel.src');
     }
}

function InputImageOFF(image)
{
     if (document.all)
     {
          // only internet explorer
          document.all.item(image).src = eval(image + 'off.src');
     }
}

function InputImagePUSH(image)
{
     if (document.all)
     {
          // only internet explorer
          document.all.item(image).src = eval(image + 'push.src');
     }
}

function CheckLabelSize (widget, size)
{
     var message = 'Votre saisie ne doit pas comporter plus de ' + size + ' caractères.';
     var objlabel = eval('document.forms[0].' + widget)

     if (objlabel.value.length > size)
     {
          window.alert(message);
          objlabel.value = objlabel.value.substr(0,size);
     }
}

// *****************************************************************************
// END OF FILE
// -----------------------------------------------------------------------------
