var hold;
var msgBox=0;
var msgBoxSty;
function initBox(b){
  msgBox=getRef(b);
  return msgBoxSty=getSty(b);
}
// var leftSt=160;
var leftSt=10;
var leftIncr=200;
 // var tpSt=325;
var tpSt=225;
var tpIncr=210;

function openMsgBox(current,ofst){
  hold=current.title;
  current.title="";
  n=Math.floor(ofst/3);
  loff=ofst>2?ofst-(n*3):ofst;
  if (msgBox==0) initBox('msg');
  msgBox.innerHTML=current.alt;
  msgBoxSty.left=leftSt+(leftIncr*loff);
  msgBoxSty.top=tpSt+(tpIncr*(ofst>2?n:0));
  msgBoxSty.visibility="visible";
  return 1;
}
function openMsgBox1(current,ofst){
  hold=current.title;
  current.title="";
  n=Math.floor(ofst/3);
  loff=ofst>2?ofst-(n*3):ofst;
  if (msgBox==0) initBox('msg');
  msgBox.innerHTML=pArray[ofst][5];
  msgBoxSty.left=leftSt+(leftIncr*loff);
  msgBoxSty.top=tpSt+(tpIncr*(ofst>2?n:0));
  msgBoxSty.visibility="visible";
  return 1;
}
function closeMsgBox(current){current.title=hold; msgBoxSty.visibility="hidden"; return 1;}

var pAr = new Array(34); // This is a list of the 'div' id's (names) which are to hold the product pictures and data.
pAr[0]='prd0';
pAr[1]='prd1';
pAr[2]='prd2';
pAr[3]='prd3';
pAr[4]='prd4';
pAr[5]='prd5';
pAr[6]='prd6';
pAr[7]='prd7';
pAr[8]='prd8';
pAr[9]='prd9';
pAr[10]='prd10';
pAr[11]='prd11';
pAr[12]='prd12';
pAr[13]='prd13';
pAr[14]='prd14';
pAr[15]='prd15';
pAr[16]='prd16';
pAr[17]='prd17';
pAr[18]='prd18';
pAr[19]='prd19';
pAr[20]='prd20';
pAr[21]='prd21';
pAr[22]='prd22';
pAr[23]='prd23';
pAr[24]='prd24';
pAr[25]='prd25';
pAr[26]='prd26';
pAr[27]='prd27';
pAr[28]='prd28';
pAr[29]='prd29';
pAr[30]='prd30';
pAr[31]='prd31';
pAr[32]='prd32';
pAr[33]='prd33';
var iTxt = new Array(34);

function isInt(c){
  if (c>'9' || c<'0') return 0; else return 1;
} 
function shuffle(n){         // Opera 8 works, mostly. It can't handle quotes within quotes. 
  if (op && !op8) return;    // Even a character entity reference such as "&quot;" for double-quotes.
  r = Math.floor(Math.random() * (n + 1)); // Find a random place to start.
  for (i=0, j=r; i<=n; i++){ // Rotate the array beginning at 'r' then save the innerHTML, 
    dv = getRef(pAr[j]);     // in order, for each div in an array
    iTxt[i] = dv.innerHTML;  // Place the text in an array
    if (j==n) j=0; else j++;   
  }
  for (i=0; i<=n; i++) {     // Now update the text positioning and re-assign to each original div
    ch = (""+i);
    var st = iTxt[i];
    var re = /this/;     		 // Regular expression for locating the first occurance of "this"
    s = "this," + ch;        // Create a replacement string.
    st = st.replace(re,s);   // Punch in the new guy. This actually turns a 2-parameter function call into a 3. 
    dv = getRef(pAr[i]);     // Fortunately, the function ignores the extra parameter.
    dv.innerHTML = st;       // Reassign the text string.
  }  
  return 0;  
}
