home *** CD-ROM | disk | FTP | other *** search
/ Internet 53 / INTERNET53.iso / pc / software / windows / building / mystore / database / detail.js < prev    next >
Encoding:
JavaScript  |  1999-01-04  |  5.3 KB  |  126 lines

  1. //This code is to load the url you specify when a search engine has
  2. //a link to this page. Showing just this page wouldn't make sense
  3. //without the other pages from your store.
  4. ///////////////////////////////NAVIGATION AIDS/////////////////////////////////
  5. var url = "http://Zanadu.com/";
  6. ///////////////////////////////////////////////////////////////////////////////
  7.  
  8.  
  9. /////////////////////////////////////////////////////////////////////////
  10. //all of these decoration variables default to the top frame variables
  11. //they are listed here so you can change the look of just this page
  12.  
  13. var lfcolor = top.lfcolor; //'#000080';//large font color
  14. var sfcolor = top.sfcolor; //'#ea0000';//small font color
  15. var buttons = top.buttons; //path to your buttons
  16. var pagelook = top.detailpagelook; //'background="../../' +top.layout+ '/body.gif"'; //page tile image
  17. //var pagelook = top.detailpagelook; //'bgcolor="#cccc44"' //page color only
  18. var header = top.header; //'background="../' +top.layout+ '/hrow.gif"'; //table tile image
  19. //var header = 'bgcolor="#dadaff"' //this table bgcolor only
  20. var leftcol = top.leftcol; //'background="../' +top.layout+ '/smcol.gif"'
  21. //var leftcol = 'bgcolor="#dadadf"' //color only
  22. var heading = top.heading; //'bgcolor=#FAFACA';
  23. var headingfc = top.headingfc; //headingfc = 'color=#000080'; //top row font color
  24. var rowa = top.rowa; //'bgcolor="#dadadf"'; 
  25. var rowafc = top.rowafc; //'color = #800000'; //even row font color
  26. var rowb = top.rowb; //'bgcolor="#dadada"';
  27. var rowbfc = top.rowbfc; //'color = #800000'; //odd row font color
  28. var navrow = top.navrow; //'bgcolor=#880000'
  29. /////////////////////////////////////////////////////////////////////////
  30. //=====you should not tamper with anything below this line=====
  31.  
  32. var title = document.title;
  33. //get document name
  34. var theurl = unescape(window.location.href)
  35. var lastslash = theurl.lastIndexOf('/');
  36. var lastdot = theurl.lastIndexOf('.');
  37. var docname = theurl.substring(lastslash+1, lastdot)
  38.  
  39. //receive pop up inputs
  40. var r = 0;  
  41. var qn = 0;
  42. function rcvDetail(msg){
  43.     for(k=0; k<top.archives.sel.length; k++)
  44.     {
  45.     if((top.archives.sel[k] == null) || (top.archives.sel[k].qnty ==0))
  46.     {
  47.     //alert('record='+r+ '  quantity=' +qn+ '  line=' +k)
  48.     top.archives.sel[k] = new top.archives.selection(top.db.line[r]); top.archives.sel[k].qnty = qn; top.archives.sel[k].detail = msg; break;
  49.     }}
  50.     return;
  51.     }
  52.     
  53.  
  54. //get selected item, line[i] and selected quantity(q) and post to top
  55. function enterIt(q,i){
  56.     if(q > 0)
  57.     {
  58. //test here for detail message
  59.     var msgID = top.db.line[i].special.charAt(2);//use substring(2,-1) for long file names
  60.     if(msgID != "n")
  61.     {
  62. //pop up input window, return info goes to rcvDetail(msg)
  63.     pop = window.open("","formWin","width=" +top.db.msgwidth+ ",height=" +top.db.msgheight+ "scrolling=auto");
  64.     pop.location.href = msgID+ '.htm';
  65.     if(pop.opener == null) pop.opener = window; qn=q; r=i;
  66.     }
  67.     else {
  68.     
  69. // find first empty sel record and populate
  70.     for(k=0; k<top.archives.sel.length; k++)
  71.     {
  72.     if((top.archives.sel[k] == null) || (top.archives.sel[k].qnty ==0))
  73.     {
  74.     //alert('record='+i+ '  quantity=' +q+ '  line=' +k)
  75.     top.archives.sel[k] = new top.archives.selection(top.db.line[i]); top.archives.sel[k].qnty = q; break;
  76.     }}
  77.     return;
  78.     }}
  79.     }
  80.  
  81.  
  82. //write the type tables
  83. function showTable(){r=0;
  84.     document.write('<form name="select">'
  85. +    '<table cellpadding=0 cellspacing=0 border=0 bgcolor="#51998E" width=460">'
  86. +'    <tr ' +heading+ '><td width=60><font size=-1 ' +headingfc+ '><b> ID</td>'
  87. +'        <td width=280><font size=-1 ' +headingfc+ '><b>DESCRIPTION</td>'
  88. +'        <td width=60><font size=-1 ' +headingfc+ '><b>PRICE</td>'
  89. +'        <td width=60 align=center><font size=-1 ' +headingfc+ '><b>QUANTITY<br></td></tr>')
  90. var r = 0;
  91. for(i=1; i<top.db.line.length; i++)
  92.     if(top.db.line[i].type.toLowerCase() == title.toLowerCase() || top.db.line[i].type.toLowerCase() == docname.toLowerCase())
  93.     {  //use of title is for backward compatibility
  94.     if(r%2==0) {rowcolor = rowa; fontcolor = rowafc;}
  95.     else {rowcolor = rowb; fontcolor = rowbfc;}
  96.     document.write('<tr ' +rowcolor+ '>'
  97.     +'<td><font size=-1 ' +fontcolor+ '><b> ' +top.db.line[i].pid+ ' </td>'
  98.     +'<td><font size=-1 ' +fontcolor+ '><b>' +top.archives.stripHTM(top.db.line[i].desc)+ '</td>'
  99.     +'<td align=right><font size=-1 ' +fontcolor+ '><b>' +top.currency +top.archives.fix(top.db.line[i].price)+ '  </td>'
  100.     +'<td align=center><font size=-1 ' +fontcolor+ '>'
  101.     +'<select size=1 name=qnty onChange=enterIt(this.options[this.options.selectedIndex].value,' +i+ ')>'
  102.     +'<option value=0 selected>0'
  103.     +'<option value=1>1'
  104.     +'<option value=2>2'
  105.     +'<option value=3>3'
  106.     +'<option value=4>4'
  107.     +'<option value=5>5'
  108.     +'<option value=6>6'
  109.     +'<option value=7>7'
  110.     +'<option value=8>8'
  111.     +'<option value=9>9'
  112.     +'<option value=10>10'
  113.     +'<option value=12>12'
  114.     +'</select><br></td></tr>')
  115.     r++;
  116.     }
  117.     document.write('</table>')
  118. //table for nav button
  119.     document.write('<table cellpadding=0 cellspacing=0 border=0 width=460" ' +navrow+ ' ><tr><td align=center>'
  120.     +'<a href="JavaScript:history.go(-1)"><img src="../' +buttons+ 'backcat.gif" width=137 height=27 border=0 alt="Return to Previous Category"></a><br></td></tr></table></form>')
  121. //reset quantity values to zero on reload
  122.     for(j=0; j<document.select.length; j++)
  123.     document.select.elements[j].options[0].selected = true;
  124.     document.close();
  125.     }
  126.