function swapimg(img)
   {
   checkimg = eval("document."+ img +"");
   if (checkimg.src.toString().indexOf("_alt.jpg") > 0)
      {
      checkimg.src = "img/store/" + img + ".jpg";
      }
   else
      {
      checkimg.src = "img/store/" + img + "_alt.jpg";
      }
   }
function writeform(infodata)
   {
   var info=infodata.split("|");
document.write('<td valign="top" align="center">');
document.write('<table cellpadding="0" border="0" cellspacing="10" width="100%" class="prdtbl" height="100%">');
document.write('<tr>');
document.write('<td height="245" valign="top" align="center" class="lrgtext">' + info[1] + '<p>');

   if (info[6] != 0)
      { 
      altimg = "img/store/" + info[6] + ".jpg";
      document.write('<a title="Click for alternate view" name="link_'+ info[2] + '" href="javascript:onclick=swapimg(\''+info[2]+'\')" >');
      }
   document.write('<img width="231" name="'+ info[2] + '" border="0" src="img/store/' + info[2] + '.jpg">');
   if (info[6] != 0)
      {
      document.write('</a>');
      }
   if (info[5] != 0)
      {
      document.write('<span class="caption"><br>' + info[5] + '</span>');
      }
   else
      {
      document.write('<span class="caption"><br><br></span>');
      }
    document.write('</td>');


document.write('</tr>');
document.write('<tr>');

document.write('<td valign="top" align="center">');
document.write('<form name="_xclick' + info[0] + '" target="paypal" action="https://www.paypal.com" method="post">');
document.write('<table cellpadding="4" cellspacing="0" border="0" width="100%" height="100%">');
document.write('<tr>');
document.write('<td valign="top" class="regtext">Price:</td><td valign="top" class="lrgtext">$' + info[3] + '</td>');
document.write('</tr>');

   if (info[7] != 1)
      { 
document.write('<tr>');
document.write('<td class="regtext" valign="top">Quantity</td>');
document.write('<td class="lrgtext" valign="top">');
document.write('<select name="quantity">');
document.write('<option value="1">1</option>');
document.write('<option value="2">2</option>');
document.write('<option value="3">3</option>');
document.write('<option value="4">4</option>');
document.write('<option value="5">5</option>');
document.write('<option value="6">6</option>');
document.write('<option value="7">7</option>');
document.write('<option value="8">8</option>');
document.write('<option value="9">9</option>');
document.write('<option value="10">10</option>');
document.write('</select>');
document.write('</td>');
document.write('</tr>');

   if (info[4] != 0)
      { 
document.write('<tr>');
document.write('<td valign="top" class="regtext">Option:</td>');
document.write('<td valign="top" class="lrgtext">');
document.write('<input type="hidden" name="on1" value="Option">');
document.write('<select name="os1">');
sizes = info[4].split("/");
for ( var i in sizes )
   {
   document.write('   <option value="' + sizes[i] + '">' + sizes[i] + '</option>');
   }
document.write('</select><br>');
document.write('</td>');
document.write('</tr>');
      }
   else
      {
      document.write('<tr><td><br></td></tr>');
      }
      
document.write('<tr>');
document.write('<td valign="top" class="regtext">');
   if (info[8] != 0)
      { 
      document.write('Shipping: $'+ info[8] +'<input type="hidden" name="shipping" value="'+ info[8] +'">');
      }
   else
      {
      document.write('<br>');
      document.write('<input type="hidden" name="shipping" value="0.00">');
      document.write('<input type="hidden" name="handling_cart" value="7.95" />');
      }
document.write('</td>');
document.write('</tr>');

document.write('<tr>');
document.write('<td colspan="2" align="center" valign="top" height="30">');
document.write('<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%"  background="img/store/buttonback.jpg">');
document.write('<tr>');
document.write('<td align="center" valign="top">');
document.write('<input type="image" src="img/store/cart_on.jpg" border="0" name="submit" alt="Make payments with PayPal - fast, free and secure!">');
document.write('<input type="hidden" name="item_name" value="' + info[1] + '">');
document.write('<input type="hidden" name="add" value="1">');
document.write('<input type="hidden" name="amount" value="' + info[3] + '">');
   if (info[9] > 0)
      { 
      document.write('<input type="hidden" name="hosted_button_id" value="'+ info[9] +'">');
      document.write('<input type="hidden" name="cmd" value="_s-xclick">');
      }
   else
      {
      document.write('<input type="hidden" name="cmd" value="_cart">');
      document.write('<input type="hidden" name="business" value="info@goldrushrally.com">');
      }

document.write('<input type="hidden" name="no_shipping" value="0">');
document.write('<input type="hidden" name="no_note" value="1">');
document.write('<input type="hidden" name="currency_code" value="USD">');
document.write('<input type="hidden" name="lc" value="US">');
document.write('<input type="hidden" name="bn" value="PP-ShopCartBF">');


document.write('</td>');
document.write('</tr>');

document.write('</table>');
document.write('</td>');
document.write('</tr>');
   }

document.write('</table>');
document.write('</form>');
document.write('</td>');
document.write('</tr>');
document.write('</table>');
document.write('</td>');
   }


function prodwrite()
   {
   var prod = new Array();
   // Description|image|price
   //   prod.push("Name|image|Price|Size|Member|alt image|soldout|shipping|button_id");

   prod.push("");
   prod.push("Pair of gR Limited Tees|gr_limited|89.99|Small/Medium/Large/X-Large/2X-Large|Set of 2 High Quality Shirts|gr_limited_alt|0|10|MD5RNZXF75A72");
   prod.push("Womens Baby Doll GR Tee|babydollgr|18.00|Small|0|0|0|0");
   prod.push("goldRush DVD|grdvd|19.99|0|0|0|0|0|11348205");

   var idx = 1

   for (var x = 1; x < 100; x++)
      {
      if(prod[x] == undefined)
         {continue;}
         writeform(x + "|" + prod[x]);
      if ((x % 4) == 0)
         {
         document.write('</tr><tr>');
         }
      }

   }

