home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 July / PCpro_2004_07.ISO / docs / western / software_files / support.js < prev    next >
Encoding:
Text File  |  2003-12-28  |  3.1 KB  |  96 lines

  1. function showPathSupport(path, classname, home, server) {
  2.   var strBody, prefix;
  3.   var segment, temp;
  4.   var l, d; // l=link, d=desc 
  5.   var pos1, pos2;
  6.   
  7.   // default breadcrumb
  8.   strBody = " > " + "<a href=\"" + home + "/\" class=\"" + classname + "\">" + getDescription("support") + "</a>";     // initialize with first segment
  9.   
  10.   // set prefix and get first segment of path (when server = websupport), or second segment of path (when server = wdc.com)
  11.   segment = "";
  12.   path = path.toLowerCase();
  13.   if (path.length > 1) {
  14.     if (server == "websupport") {
  15.       prefix = "http://websupport.wdc.com/";
  16.       pos1 = 1;
  17.       pos2 = path.indexOf("/", pos1+1);
  18.       if (pos2 != -1)
  19.         segment = path.substr(pos1, pos2-pos1);
  20.     } else if (server == "support") {
  21.       prefix = home + "/";
  22.       pos1 = 1;
  23.       pos2 = path.indexOf("/", pos1+1);
  24.       if (pos2 != -1)
  25.         segment = path.substr(pos1, pos2-pos1);
  26.     } else {
  27.       prefix = home + "/";
  28.     }
  29.   }
  30.  
  31.   // set l and d based on segment and server
  32.   l = ""; d = "";
  33.   if (segment != "") {
  34.     if (server == "websupport") {
  35.       switch(segment)
  36.       {
  37.         case "diag":
  38.           l=home + "/dlg/onlinedlg.asp"; d="Online Diagnostics"; break;
  39.         case "forum":
  40.           l="forum/default.asp"; d="Online Forum"; break;
  41.         case "webemail":
  42.           l="webemail/default.asp"; d="Email WD"; break;
  43.         case "websupport":
  44.           l=home + "/warranty/index.asp"; d="Online Services"; break;
  45.         default:
  46.           l=""; d=""; break;
  47.       }
  48.     } else if (server == "rightnow") {
  49.       l = home + "/kb.asp";
  50.       d = "Knowledge Base";
  51.     } else if (server == "support") {  // server==www.wdc.com
  52.       switch(segment)
  53.       {
  54.         case "ace":
  55.           l="download/index.asp"; d="Downloads Library"; break;
  56.         case "archive":
  57.           l="archive/index.asp"; d="Archives"; break;
  58.         case "contact":
  59.           l="contact/index.asp"; d="Contact Us"; break;
  60.         case "dlg":
  61.           l="dlg/index.asp"; d="Data Lifeguard Tools"; break;
  62.         case "download":
  63.           l="download/index.asp"; d="Downloads Library"; break;
  64.         case "faqs":
  65.           l="faqs/index.asp"; d="Frequently Asked Questions"; break;
  66.         case "order":
  67.           l="order/index.asp"; d="Order"; break;
  68.         case "partners":
  69.           l="partners/index.asp"; d="Service Partners"; break;
  70.         case "techinfo":
  71.           l="techinfo/index.asp"; d="Technical Information"; break;
  72.         case "tips":
  73.           l="tips/index.asp"; d="Tip of the Month"; break;
  74.         case "warranty":
  75.           l="warranty/index.asp"; d="Warranty Information"; break;
  76.         default:
  77.           l=""; d="";
  78.       }
  79.     } else {  // all others go to Service and Support home
  80.       l = "";
  81.       d = "";
  82.     }   // if server ...
  83.   }  // if (segment != "")
  84.  
  85.  
  86.   // construct strBody based on l and d
  87.   if (l != "") {
  88.     if (l.indexOf("http://") != 0)
  89.       l = prefix + l;
  90.     strBody = strBody + " > " + "<a href=\"" + l + "\" class=\"" + classname + "\">" + d + "</a>";
  91.   }
  92.   
  93.   return strBody;
  94. }
  95.  
  96.