home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / groupoffice-com-2.01 / javascript / common.js
Text File  |  2004-03-08  |  1KB  |  77 lines

  1. function popup(url,width,height)
  2. {
  3.     var popup = window.open(url, '_blank', 'width='+width+',height='+height+',scrollbars=yes,resizable=yes,status=yes');
  4.         if (!popup.opener) popup.opener = self;
  5.     popup.focus();
  6. }
  7.  
  8. function confirm_action(url, message)
  9. {
  10.     if (confirm(unescape(message)))
  11.     {
  12.         window.location=url
  13.     }
  14. }
  15.  
  16. function get_object(name)
  17. {
  18.     if (document.getElementById)
  19.     {
  20.         return document.getElementById(name);
  21.      }
  22.      else if (document.all)
  23.     {
  24.           return document.all[name];
  25.      }
  26.      else if (document.layers)
  27.     {
  28.           return document.layers[name];
  29.     }
  30.     return false;
  31. }
  32.  
  33. function check_checkbox(id)
  34. {
  35.     if(check_box = get_object(id))
  36.     {
  37.         if (!check_box.disabled)
  38.         {
  39.             check_box.checked = !check_box.checked;
  40.             if (check_box.onclick)
  41.             {
  42.                 check_box.onclick();
  43.             }
  44.         }
  45.     }
  46. }
  47.  
  48. function select_radio(id)
  49. {
  50.     if(radio_but = get_object(id))
  51.     {
  52.         radio_but.checked = true;
  53.         if (radio_but.onclick)
  54.         {
  55.             radio_but.onclick();
  56.         }
  57.     }
  58. }
  59.  
  60.  
  61. function getSelected(opt) 
  62. {
  63.     var selected = new Array();
  64.     var index = 0;
  65.     for (var i=0; i<opt.length;i++) 
  66.     {
  67.         if ((opt[i].selected) || (opt[i].checked)) 
  68.         {
  69.             index = selected.length;
  70.             selected[index] = new Object;
  71.             selected[index].value = opt[i].value;
  72.             selected[index].index = i;
  73.         }
  74.     }
  75.     return selected;
  76. }
  77.