home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 November / Chip_2002-11_cd1.bin / tema / xara30 / info / tour_soubory / tourlist.js < prev    next >
Text File  |  2002-10-15  |  4KB  |  134 lines

  1. var clicked=""
  2. var gtype=".gif"
  3. var selstate="_on"
  4. if (typeof(loc)=="undefined" || loc==""){
  5.     var loc=""
  6.     if (document.body){
  7.         var tt = document.body.innerHTML.toLowerCase();
  8.         var last = tt.indexOf("tourlist.js\"");
  9.         if (last>0){
  10.             var first = tt.lastIndexOf("\"", last);
  11.             if (first>0 && first<last) loc = document.body.innerHTML.substr(first+1,last-first-1);
  12.         }
  13.     }
  14. }
  15.  
  16. document.write("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>");
  17. document.write("<td><img src=\""+loc+"tourlist_left.gif\" alt=\"\" width=\"17\" height=\"26\"></td>");
  18. tr(false);
  19. writeButton(loc+"../","tour01.htm","tourlist_b1",15,26,"1. Choose graphic type","",0);
  20. writeButton(loc+"../","tour02.htm","tourlist_b2",15,26,"2. Select template","",0);
  21. writeButton(loc+"../","tour03.htm","tourlist_b3",15,26,"3. Customization","",0);
  22. writeButton(loc+"../","tour04.htm","tourlist_b4",15,26,"4. Photo tool","",0);
  23. writeButton(loc+"../","tour05.htm","tourlist_b5",15,26,"5. Save options","",0);
  24. writeButton(loc+"../","tour06.htm","tourlist_b6",15,26,"6. Integration","",0);
  25. tr(true);
  26. document.write("<td><img src=\""+loc+"tourlist_right.gif\" alt=\"\" width=\"17\" height=\"26\"></td>");
  27. document.write("</tr></table>")
  28. loc="";
  29.  
  30. function tr(b){}
  31.  
  32. function turn_over(name) {
  33.     if (document.images != null && clicked != name) {
  34.         document[name].src = document[name+"_over"].src;
  35.     }
  36. }
  37.  
  38. function turn_off(name) {
  39.     if (document.images != null && clicked != name) {
  40.         document[name].src = document[name+"_off"].src;
  41.     }
  42. }
  43.  
  44. function reg(gname,name)
  45. {
  46. if (document.images)
  47.     {
  48.     document[name+"_off"] = new Image();
  49.     document[name+"_off"].src = loc+gname+gtype;
  50.     document[name+"_over"] = new Image();
  51.     document[name+"_over"].src = loc+gname+"_over"+gtype;
  52.     document[name+"_on"] = new Image();
  53.     document[name+"_on"].src = loc+gname+"_on"+gtype;
  54.     }
  55. }
  56.  
  57. function evs(name){ return " onmouseover=\"turn_over('"+ name + "')\" onmouseout=\"turn_off('"+ name + "')\""}
  58.  
  59. function writeButton(urld, url, name, w, h, alt, target, hsp)
  60. {
  61.     gname = name;
  62.     while(typeof(document[name])!="undefined") name += "x";
  63.     reg(gname, name);
  64.     tr(true);
  65.     document.write("<td>");
  66.     if (alt != "") alt = " alt=\"" + alt + "\"";
  67.     if (target != "") target = " target=\"" + target + "\"";
  68.     if (w > 0) w = " width=\""+w+"\""; else w = "";
  69.     if (h > 0) h = " height=\""+h+"\""; else h = "";    
  70.     var l = clicked!="" || !isCurrentFile(url);
  71.     if (url != "") url = " href=\"" + urld + url + "\"";
  72.     
  73.     if (l) document.write("<a " + url + evs(name) + target + ">");
  74.     else gname += selstate;
  75.     
  76.     gname += gtype;
  77.     
  78.     if (hsp == -1) hsp =" align=\"right\"";
  79.     else if (hsp > 0) hsp = " hspace=\""+hsp+"\"";
  80.     else hsp = "";
  81.     
  82.     document.write("<img src=\""+loc+gname+"\" name=\"" + name + "\"" + w + h + alt + hsp + " border=\"0\" />");
  83.     
  84.     if (l) document.write("</a>");
  85.         
  86.     document.write("</td>");
  87.     tr(false);
  88. }
  89.  
  90. function syncFile(f,nf)
  91. {
  92.     var matches = 'home.html*index.html*welcome.html*default.asp';
  93.     var p = f.lastIndexOf('/');
  94.     var sf = f;
  95.     
  96.     if (p >= 0) sf = f.substr(p+1, f.length-1);
  97.     if (matches.indexOf(sf) == -1) return "";
  98.     
  99.     return sf;
  100. }
  101.  
  102. function isCurrentFile(str)
  103. {
  104.     str = escape(str);
  105.     str = str.toLowerCase();
  106.     while (str.length > 3 && str.substring(0,3) == "../")
  107.         str = str.substr(3, str.length-1);
  108.     var fstr = str.indexOf(".htm");
  109.     if (fstr == -1) fstr = str.indexOf(".asp");
  110.     if (fstr < 1 && str.charAt(str.length-1) != '/') str += "/";
  111.     var current = document.location.href.toLowerCase();
  112.     var p = current.lastIndexOf('?');
  113.     if (p > 0) current = current.substr(0, p);
  114.     var fcurrent = current.indexOf(".htm");
  115.     if (fcurrent == -1) fcurrent = current.indexOf(".asp");
  116.     if (fcurrent < 1 && current.charAt(current.length-1) != '/') current += "/";    
  117.     if (fstr != -1 && fcurrent == -1) current += syncFile(str, current);
  118.     if (fstr == -1 && fcurrent != -1) str += syncFile(current, str);
  119.         
  120.     var currsize = current.length;
  121.     var strsize = str.length;
  122.  
  123.     while (strsize >=0 && currsize >=0)
  124.     {
  125.         if (current.charAt(currsize) != str.charAt(strsize))
  126.             return false;
  127.             
  128.         currsize = currsize -1;
  129.         strsize = strsize -1;
  130.     }
  131.     
  132.     return true;
  133. }
  134.