home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2007 April / PCpro_2007_04.ISO / files / dsl / NVinst.exe / Scripts / HTTP / 127.0.0.3 / ReloadCMS / admin / slmv.js < prev    next >
Encoding:
Text File  |  2007-02-10  |  2.5 KB  |  62 lines

  1. function checkForCharacters(inputString, checkString, startingIndex)
  2. {
  3.   if (!startingIndex) startingIndex = 0;
  4.   return inputString.indexOf(checkString);
  5. }
  6.  
  7. is_firefox = checkForCharacters(navigator.userAgent, 'Firefox');
  8. is_ie      = checkForCharacters(navigator.userAgent, 'MSIE')
  9. is_opera   = checkForCharacters(navigator.userAgent, 'Opera')
  10.  
  11. function select_move_up_selected_el(object){
  12.     if(object.selectedIndex != -1){
  13.         var was_norm_t = object.options[object.selectedIndex].text;
  14.         var was_norm_v = object.options[object.selectedIndex].value;
  15.         var was_up_t = object.options[object.selectedIndex-1].text;
  16.         var was_up_v = object.options[object.selectedIndex-1].value;
  17.         object.options[object.selectedIndex-1].text = was_norm_t;
  18.         object.options[object.selectedIndex-1].value = was_norm_v;
  19.         object.options[object.selectedIndex].text = was_up_t;
  20.         object.options[object.selectedIndex].value = was_up_v;
  21.         object.selectedIndex = object.selectedIndex-1;
  22.     }
  23. }
  24. function select_move_down_selected_el(object){
  25.     if(object.selectedIndex != -1){
  26.         var was_norm_t = object.options[object.selectedIndex].text;
  27.         var was_norm_v = object.options[object.selectedIndex].value;
  28.         var was_up_t = object.options[object.selectedIndex+1].text;
  29.         var was_up_v = object.options[object.selectedIndex+1].value;
  30.         object.options[object.selectedIndex+1].text = was_norm_t;
  31.         object.options[object.selectedIndex+1].value = was_norm_v;
  32.         object.options[object.selectedIndex].text = was_up_t;
  33.         object.options[object.selectedIndex].value = was_up_v;
  34.         object.selectedIndex = object.selectedIndex+1;
  35.     }
  36. }
  37. function add_to_select_from_another(object_from, object_to){
  38.     var newoption = document.createElement('option');
  39.     if(object_from.selectedIndex != -1){
  40.         newoption.text = object_from.options[object_from.selectedIndex].text;
  41.         newoption.value = object_from.options[object_from.selectedIndex].value;
  42.         if(is_ie == -1) object_to.add(newoption, null); else object_to.add(newoption, 0);
  43.         object_from.remove(object_from.selectedIndex);
  44.     }
  45. }
  46. function on_submit_prepare(object1, object2){
  47.     if(object1 != null){
  48.         object1.multiple = true;
  49.         i = 0;
  50.         for (i=0; i<object1.options.length; i++){
  51.             object1.options[i].selected = true;
  52.         }
  53.     }
  54.     if(object2 != null){
  55.         object2.multiple = true;
  56.         i = 0;
  57.         for (i=0; i<object2.options.length; i++){
  58.             object2.options[i].selected = true;
  59.         }
  60.     }
  61.     return false;
  62. }