home *** CD-ROM | disk | FTP | other *** search
/ Thomson (Residential) / TGSTPv7203.iso / pc / Documentation / HTML / SysFiles / selection / js / util.js < prev    next >
Encoding:
JavaScript  |  2008-01-23  |  3.9 KB  |  121 lines

  1. // Function to write list of available documents
  2. function writeproductlist(i) {
  3.     HTML='<table cellspacing="0" width="100%" class="document">';
  4.     productlist=products[i][1];
  5.     if (productlist.length==1) {
  6.         currentProduct=0;
  7.     };
  8.     if (currentProduct!=-1) {
  9.         //A product has been selected
  10.         doclist=products[i][1][currentProduct][2];
  11.         if (typeof(doclist[0][0])=="undefined") {
  12.             HTML+='<tr><th colspan="4">'+linktext[langIndex][0] + linktext[langIndex][1]+'</th></tr>';                
  13.         }
  14.         var productPicture_str='images/TG' + productlist[currentProduct][0] + '.gif';
  15.         var productPicture_array=productPicture_str.split(' ');
  16.         productPicture_str=productPicture_array.join('-');
  17.         document.getElementById('productphoto').src=productPicture_str;    
  18.         for (j = 0; j < doclist.length; j++) {
  19.             if (typeof(doclist[j][1])!="undefined") {
  20.                 HTML+='<tr>';        
  21.                 HTML+='<td width="20" class="bullet">';
  22.                 HTML+='<';
  23.                 HTML+='</td>';
  24.                 HTML+='<td style="padding-right:20px">' + doclist[j][0]+'</td>';
  25.                 HTML+='<td width="80">';            
  26.                 if (typeof(doclist[j][1])!="undefined") {
  27.                     HTML+='<a target="_top" href="' +doclist[j][1] + '">[HTML]</a>';                    
  28.                     HTML+=placeLocationIndicator(doclist[j][1],i)
  29.                 } else {
  30.                     HTML+=' ';
  31.                 }
  32.                 HTML+='</td>';
  33.                 HTML+='<td width="80">';
  34.                 if (typeof(doclist[j][2])!="undefined") {
  35.                     HTML+='<a target="_top" href="' +doclist[j][2] + '">[PDF]</a>';
  36.                     HTML+=placeLocationIndicator(doclist[j][2],i)
  37.                 } else {
  38.                     HTML+=' ';
  39.                 }
  40.                 HTML+='</td>';
  41.                 HTML+='</tr>';
  42.             } else {
  43.                 HTML+='<tr class="document"><th colspan="4">'+doclist[j][0]+'</th></tr>';    
  44.             }
  45.         }    
  46.     }    else {
  47.         //No product has been selected
  48.         HTML+='<tr><th colspan="4">'+products[i][0]+'</th></tr>';    
  49.         for (j = 0; j < productlist.length; j++) {            
  50.             HTML+='<tr onMouseOut="restoreProduct();" onMouseOver="changeProduct(' + j + ');">';
  51.             HTML+='<td width="20" class="bullet">';
  52.             HTML+='<';
  53.             HTML+='</td>';
  54.             HTML+='<td>';    
  55.             HTML+='<a target="_top" href="' + location.href.substring(0,location.href.length-location.search.length) + '?lang='+currentLang+"&"+'prod='+j+'">' + linktext[i][0] + productlist[j][0] + linktext[i][1];
  56.             HTML+='</td>';
  57.             HTML+='</tr>';
  58.         }
  59.     }
  60.     HTML+='</table>';
  61.     document.write(HTML);
  62. }
  63.  
  64. function placeLocationIndicator(doclocation,indicator)
  65. {
  66.     if (doclocation.indexOf("http://")==-1) {    
  67.             return " <img width=\"17\" height=\"17\" alt=\""+tr[indicator][7][1]+"\" src=\"images/CD.gif\"  />";
  68.      } else {
  69.                return " <img width=\"17\" height=\"17\" alt=\""+tr[indicator][7][0]+"\" src=\"images/world.gif\"  />";
  70.     }
  71. }
  72.  
  73. function restoreProduct()
  74. {
  75.     document.getElementById('productphoto').src=productphoto;
  76. }
  77. function changeProduct(i)
  78. {
  79.     var productPicture_str='images/TG' + productlist[i][0] + '.gif';
  80.     var productPicture_array=productPicture_str.split(' ');
  81.     productPicture_str=productPicture_array.join('-');
  82.     document.getElementById('productphoto').src=productPicture_str;
  83. }
  84. function initvar() {
  85.         productphoto='images/default.gif';
  86.         document.write('<title>'+doctitle+'</title>');
  87.         query = location.search.substring(1).split("&");        
  88.         query=query[0].split("=");
  89.         if (query[0]=='lang') {
  90.             currentLang=query[1];
  91.         } 
  92.         query = location.search.substring(1).split("&");        
  93.         if (query.length>1) {
  94.             query=query[1].split("=");
  95.             if (query[0]=='prod') {
  96.                 currentProduct=query[1];
  97.             } 
  98.         }
  99.         i = 0;
  100.         while (i <= langCode.length) {
  101.             if (currentLang==langCode[i]) {
  102.                 langIndex=i;
  103.                 break;
  104.             }
  105.             i++;
  106.         }            
  107. }
  108.                                                         
  109.  
  110. function langlink(locat,inp) {
  111.     query = location.search.substring(1);
  112.     i = query.indexOf('=') + 1;
  113.     if(query.substring(i, query.length)!='') {
  114.         currentLang=query.substring(i, query.length);
  115.     }
  116.     if (currentLang!=inp) {
  117.         return '<a href="'+loc+"?lang="+inp+'">'+inp+'</a> ';
  118.     } else {
  119.         return inp;
  120.     }
  121. }