home *** CD-ROM | disk | FTP | other *** search
/ Clickx 75 / Clickx 75.iso / software / expressionweb / expressionwebv3 / ExpressionWeb_en.exe / Setup / WeLocen.cab / Microsoft.Expression.Web.Help.en / scripts / script_feedback.js < prev    next >
Encoding:
JavaScript  |  2009-06-19  |  2.7 KB  |  117 lines

  1. //Default FeedBack Values
  2. var ratings = 3;
  3. var title = document.title;
  4. var URL = location.href.replace(location.hash,"");
  5. var version = 2007;
  6.  
  7. /*************************************************************************
  8.  * Methods ********************************************************
  9.  *************************************************************************/
  10.  
  11. function DeliveryType()
  12. {
  13.      if (URL.indexOf("ms-help://")!=-1) {return("h");}
  14.     else if (URL.indexOf(".chm::/")!=-1) {return("c");}
  15.     else if (URL.indexOf("http://")!=-1) {return("w");}
  16.     else if (URL.indexOf("file:")!=-1) {return("f");}
  17.     else return("0");
  18. }
  19.  
  20. function DeliverableValue(deliverable)
  21. {
  22.      if (URL.indexOf("ms-help://")!=-1) 
  23.     {
  24.         delvalue  = location.href.slice(0,location.href.lastIndexOf("/html/"));
  25.         delvalue  = delvalue.slice(delvalue.lastIndexOf("/")+1);
  26.         return delvalue;
  27.     }
  28.     else return(deliverable);
  29. }
  30.  
  31. function URLValue()
  32. {
  33.     if (URL.indexOf(".chm::")!=-1) 
  34.     {
  35.         a = URL;
  36.         while (a.indexOf("\\") < a.indexOf(".chm::") || a.indexOf("//") > a.indexOf(".chm::")) 
  37.         {
  38.             if (a.indexOf("\\")==-1)
  39.             {
  40.                 break;
  41.             }
  42.             a = a.substring(a.indexOf("\\")+1,a.length);
  43.         }
  44.         return("ms-its:"+a)
  45.     }
  46.     else if (URL.indexOf("file:///")!=-1) 
  47.     {
  48.         a = URL;
  49.  
  50.         b = a.substring(a.lastIndexOf("html")+5,a.length);
  51.         return("file:///"+b);
  52.     }
  53.     else return(URL);
  54. }
  55.  
  56. function GetLanguage()
  57. {
  58.     var langauge;
  59.       if(navigator.userAgent.indexOf("Firefox")!=-1)
  60.       {
  61.           var index = navigator.userAgent.indexOf('(');
  62.            var string = navigator.userAgent.substring(navigator.userAgent.indexOf('('), navigator.userAgent.length);
  63.            var splitString = string.split(';');
  64.            language = splitString[3].substring(1, splitString[3].length);
  65.       }
  66.       else language = navigator.systemLanguage;
  67.     return(language);
  68. }
  69.  
  70.  
  71. //---Gets topic rating.---
  72. function GetRating()
  73. {
  74.  
  75.     sRating = "0";
  76.     for(var x = 0;x < 5;x++)
  77.       {
  78.         if(document.formRating) {
  79.         if(document.formRating.fbRating[x].checked) {sRating = x + 1;}}
  80.         else return sRating;
  81.       }
  82.     return sRating;
  83. }
  84.  
  85. function SubmitFeedback(alias, product, deliverable, productVersion, documentationVersion, defaultBody)
  86. {
  87.     var subject = title
  88.           + " ("
  89.         + "/1:"
  90.           + product
  91.           + "/2:"
  92.           + productVersion
  93.           + "/3:"
  94.           + documentationVersion
  95.           + "/4:"
  96.           + DeliverableValue(deliverable)
  97.           + "/5:"
  98.           + URLValue()
  99.           + "/6:"
  100.           + GetRating() 
  101.           + "/7:"
  102.           + DeliveryType()
  103.           + "/8:"
  104.           + GetLanguage()
  105.         + "/9:"
  106.           + version
  107.         + ")"; 
  108.   
  109.     location.href = "mailto:" + alias + "?subject=" + subject
  110.     + "&body=" + defaultBody;
  111. }
  112.  
  113. function AltFeedback(src, title) {
  114.     src.title=title;
  115.     return;
  116.     }
  117.