home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 May / CHIPCD200305.iso / super / altn / md_en.exe / GLOBALS.JS < prev    next >
Encoding:
Text File  |  2003-04-07  |  3.6 KB  |  102 lines

  1. function Get(field, value){
  2.     var url = document.forms[0].action += '&' + field + '=';
  3.     if (value != null)
  4.         url += value;
  5.     else
  6.         url += 'Yes';
  7.     document.location = url;
  8. }
  9.  
  10. function Mesg(Msg){
  11.     if (Msg.length > 0){alert(Msg);}
  12. }
  13.  
  14. var composeWindowCount = 0;
  15. function openWin(url, winName, width, height, features){
  16.     if(is_ie || is_nav){
  17.     var w = screen.availWidth;
  18.     var h = screen.availHeight;
  19.     }
  20.     var leftPos,topPos;
  21.     if((winName.indexOf('GetMail') != -1) && (is_ie))
  22.         leftPos = (w-width)/1.02, topPos = (h-height)/1.08;
  23.     else if(winName.indexOf('GetMail') != -1 && is_nav)
  24.         leftPos = (w-width)/1.86, topPos = (h-height)/1.86;
  25.     else if(is_ie)
  26.         leftPos = (w-width)/2, topPos = (h-height)/2;
  27.     else if(is_nav)
  28.         leftPos = (w-width)/3, topPos = (h-height)/3;
  29.     else
  30.         leftPos = 250, topPos = 250;
  31.     var hWin;
  32.     if(features == "compose"){
  33.         hWin = window.open(url, winName+(composeWindowCount++),'directories=no,location=no,menubar=no,status=no,scrollbars=yes,resizable=yes,titlebars=no,toolbar=no,width=' + width + ',height=' + height+ ',screenX=' + topPos + ',screenY=' + leftPos+',top=' + topPos + ',left=' + leftPos);
  34.     }else if (features == "yes"){
  35.         hWin = window.open(url, winName, 'directories=no,location=no,menubar=no,status=no,scrollbars=yes,resizable=yes,titlebars=no,toolbar=no,width=' + width + ',height=' + height+ ',screenX=' + topPos + ',screenY=' + leftPos+',top=' + topPos + ',left=' + leftPos);
  36.     }else if (features == "no"){
  37.         hWin = window.open(url, winName, 'directories=no,location=no,menubar=no,status=no,scrollbars=no,resizable=no,titlebars=no,toolbar=no,width=' + width + ',height=' + height+ ',screenX=' + topPos + ',screenY=' + leftPos +',top=' + topPos + ',left=' + leftPos);
  38.     }
  39.     if(!hWin.opener){hWin.opener = window;}
  40.     hWin.focus();
  41. }
  42.  
  43. function Post(field, value){
  44.     document.forms[0].action += '&' + field + '=';
  45.     if (value != null)
  46.         document.forms[0].action += value;
  47.     else
  48.         document.forms[0].action += 'Yes';
  49.  
  50.     if (typeof(Validate) == 'undefined' || Validate())
  51.         document.forms[0].submit();
  52. }
  53.  
  54. function SetOption(name, value){
  55.     for (var i=0; i<document.forms[0].length; i++){
  56.         if (document.forms[0].elements[i].name == name)
  57.             var element = document.forms[0].elements[i];
  58.     }
  59.     if (element == null)
  60.         return;
  61.  
  62.     if (element.type == 'checkbox'){
  63.         if (element.value == value)element.checked = true;
  64.     }else if (element.type == 'radio'){
  65.         for (var i=0; i<document.forms[0].length; i++){
  66.             if (document.forms[0].elements[i].name == name && document.forms[0].elements[i].value == value)document.forms[0].elements[i].checked = true;
  67.         }
  68.     }else if (element.type == 'select-one'){
  69.         for (var i=0; i<element.length; i++){
  70.             var elementValue = element.options[i].value.toLowerCase();var passedValue = value.toLowerCase();
  71.             if ( elementValue == passedValue )element.selectedIndex = i;
  72.         }
  73.     }else if(element.type == 'select-multiple'){
  74.         for (var i=0; i<element.length; i++){
  75.             var elementValue = element.options[i].value.toLowerCase();
  76.             var passedValue = value.toLowerCase();
  77.             if ( elementValue == passedValue )
  78.                 element.options[i].selected = true;
  79.         }
  80.     }else if (element.type == 'text'){
  81.         element.value = value;
  82.     }
  83. }
  84.  
  85. function SelectAll(){
  86.     for (var i=0;i<document.forms[0].elements.length;i++){        
  87.         document.forms[0].elements[i].checked=!document.forms[0].elements[i].checked;
  88.         }
  89. }
  90.  
  91. /* List View Functions */
  92. function Sort(SortKey){
  93.     var F=document.forms[0];
  94.     if (F.Sort.value.indexOf(SortKey) == -1)
  95.         F.Sort.value = SortKey;
  96.     else if (F.Sort.value.indexOf('Rev') == -1)
  97.         F.Sort.value = 'Rev' + SortKey;
  98.     else
  99.         F.Sort.value = SortKey;
  100.     F.submit();
  101. }
  102.