home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 November / PCWNOV07.iso / shared / regwiz.cab / RegWizUI.dll / HTML / JSUTILS.JS < prev    next >
Encoding:
Text File  |  2005-07-13  |  3.1 KB  |  122 lines

  1. function ClearOptions(OptionList) {
  2.    // Always clear an option list from the last entry to the first
  3.    for (x = OptionList.length; x >= 0; x = x - 1) {
  4.       OptionList[x] = null;
  5.    }
  6. }
  7.  
  8. function AddToOptionList(OptionList, OptionValue, OptionText) {
  9.    // Add option to the bottom of the list
  10.    OptionList[OptionList.length] = new Option(OptionText, OptionValue);
  11. }
  12.  
  13. function getArraylength( arrName )
  14. {
  15.     return arrName.length;    
  16. }
  17.  
  18. function GetCountryAndLangName(arrName, index)
  19. {
  20.     return eval(arrName)[index];    
  21. }
  22.  
  23. function GetCountryNameAndLangCode(index)
  24. {
  25.     var strCountryName = gCountryArraySorted[index];    
  26.     var strLangCode = GetLangCodeFromCountryName ( strCountryName );
  27.  
  28.     return ( strCountryName + "$" + strLangCode );
  29. }
  30.  
  31. function CreateUnsortedCountryArray ()
  32. {
  33.     var nCount = gCountryArray.length;
  34.     gCountryArrayUnSorted = new Array(nCount);
  35.  
  36.     for ( i = 0; i < nCount; i++)
  37.         gCountryArrayUnSorted[i] = gCountryArray[i];
  38. }
  39.  
  40. function SortArray ( SourceArray, DestinationArray )
  41. {
  42.     CreateUnsortedCountryArray();
  43.     gCountryArraySorted = gCountryArray.sort();    
  44. }
  45.  
  46. function GetLangCodeFromCountryName ( strCountryName )
  47. {
  48.     var strLangCode = gDefaultLangCode;
  49.     var nLength = gCountryArray.length;
  50.  
  51.     for ( nCtr = 0; nCtr < nLength; nCtr++ )
  52.     {
  53.         if ( strCountryName == gCountryArrayUnSorted[nCtr] )
  54.         {
  55.             strLangCode = gLangCode[nCtr];
  56.             break;
  57.         }
  58.     }
  59.  
  60.     return strLangCode;
  61. }
  62.  
  63. function GetLangCodeForPrivacyPolicy( langCode )
  64. {
  65.     var strLangCode = langCode;
  66.  
  67.     if ( -1 == gPrivacyPolicyLangCode.indexOf("|"+langCode+"|") )
  68.         strLangCode = gDefaultLangCode;
  69.  
  70.     return strLangCode;
  71. }
  72.  
  73.  
  74. function openNoScrollWindow(url,title,width,height)
  75. {
  76.         var strFeatures = "toolbar=no,scrollbars=yes,menubar=no,location=no,directories=no,status=yes,resizable=yes";
  77.  
  78.         var x = screen.width;
  79.         var y = screen.height;
  80.  
  81.         var top = parseInt((y-height)/2);
  82.         var left = parseInt((x-width)/2);
  83.  
  84.         // open new window and use the variables to position it
  85.  
  86.         window.parent.closed
  87.  
  88.         var objWindow = window.open(url,title,'width='+width+',height='+height+',left='+left+',top='+top+',scrollbars=yes,resize=yes,resizable=yes,menubar=no,toolbar=no,directories=no');
  89.         return objWindow;
  90. }
  91.  
  92.  
  93. function printDoc( titleFont )
  94. {
  95.     var i = 0;
  96.     var docElement;
  97.  
  98.     if (document.getElementById != null)
  99.     {
  100.         var html = '<HTML>\n<HEAD>\n';
  101.         html += '\n</HEAD>\n<BODY>\n<textarea id="idEulaPrintText" name="idEulaPrintText" wrap="hard" STYLE="overflow:visible; height: 135px; width:100%" rows="10" cols="20"></textarea>';
  102.         html += '\n</BODY>\n</HTML>';
  103.  
  104.         var windowPrint = window.open("","_EulaPrint");
  105.  
  106.         windowPrint.document.open();
  107.         windowPrint.document.write(html);
  108.  
  109.         docElement = document.getElementById("idEulaText");
  110.         if (docElement != null)
  111.         {
  112.             windowPrint.document.getElementById("idEulaPrintText").value = docElement.value;
  113.             windowPrint.document.getElementById("idEulaPrintText").readOnly = true;
  114.         }
  115.         docElement = null;
  116.         
  117.         windowPrint.document.close();
  118.         windowPrint.print();
  119.     }
  120. }
  121.  
  122.