home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 June / ccd0605.iso / Software / Freeware / Programare / paranoia / ParanoiaSetup.exe / Gui / Common.js < prev    next >
Text File  |  2005-04-21  |  2KB  |  95 lines

  1. /*
  2.  * Function: ExecuteCommand
  3.  * Description: This function passes the JavaScript argument to the program interpreter. 
  4.  */
  5. function ExecuteCommand(Command)
  6. {
  7.     var DIYCommand = "diy:|SEPERATOR|" + Command;
  8.     window.navigate(DIYCommand);
  9. }
  10.  
  11. /*
  12.  * Function: onContextMenu
  13.  * Description: This function disables the context menu (Right click menu) 
  14.  * unless the user right clicked on an INPUT tag. 
  15.  */
  16. function onContextMenu(){
  17.      if ( window.event.srcElement.tagName !="INPUT" ) {        
  18.     window.event.returnValue = false;    
  19.     window.event.cancelBubble = true;
  20.         return false;
  21.     }
  22. }
  23. /*
  24.  * Function: onSelect
  25.  * Description: This function disables the selection of text on the page
  26.  * unless the selection is done on an INPUT tag. 
  27.  */
  28. function onSelect(){
  29.     if ( window.event.srcElement.tagName !="INPUT" ) {        
  30.     window.event.returnValue = false;    
  31.     window.event.cancelBubble = true;
  32.     }
  33. }
  34.  
  35.  
  36. /*
  37.  * Function: CommonOnload
  38.  * Description: This function should be called on page load,
  39.  * it activates the "onSelect" and "onContextMenu" functions.
  40.  */
  41. function CommonOnload(){
  42.     
  43.     document.oncontextmenu = onContextMenu;
  44.  
  45. }
  46.  
  47.  
  48. /*
  49.  * Function: ErrorHandler
  50.  * Description: This function is called when a JavaScript error occur. 
  51.  * If the Alert line is unmarked then the error description will show on an alert window.
  52.  */
  53. function ErrorHandler(msg,url,lno)
  54. {   
  55.     alert(msg);
  56.     return (true);
  57. }
  58. /*
  59.  * Function: SetData
  60.  * Description: This function is called by the program to set the inner HTML of
  61.  * HTML objects such as DIV or SPAN
  62.  */
  63. function SetData(ar)
  64. {
  65.     var a = new VBArray(ar);
  66.     var b = a.toArray();
  67.     delete a;
  68.  
  69.     for (i=0; i<b.length; i++) 
  70.     {
  71.     
  72.         res = b[i].split("|SEPERATOR|");    
  73.         try 
  74.         {
  75.             var lsExpression;
  76.             lsExpression = "document.all." + res[0] + ".innerHTML = res[1]";
  77.  
  78.             eval(lsExpression);
  79.             
  80.            }
  81.         catch(e)
  82.         {
  83.             
  84.         }
  85.         
  86.     }
  87.  
  88. }
  89.  
  90. /*
  91.  * The following line causes the browser to call the "ErrorHandler" function every time
  92.  * error occur. 
  93.  */
  94. window.onerror = ErrorHandler;
  95.