ns4=(navigator.appName.indexOf("Netscape")>=0 && !document.getElementById)? 1 : 0;
ie4=(document.all && !document.getElementById)? 1 : 0;
ie5=(document.getElementById && document.all)? 1 : 0;
ns6=(document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? 1: 0;
w3c=(document.getElementById)? 1 : 0;
// if (ns6) {alert ("You can adjust page layout with [F11] and [ Ctrl] [-] and  [ Ctrl] [+] keys") ;};
wid=(ie4||ie5)?window.document.body.clientWidth-20:window.innerWidth-36
if(ns4){document.write ('<layer name="di1"></layer>')}else{document.write ('<div id="di1" style="position:absolute;z-index:100" ></div>')}

if(w3c)div1=document.getElementById('di1');
if(ie4)div1=document.all['di1'];
if(ns4)div1=document.layers['di1'];
base="base.jpg";art="";
nreg=new Array();
curRecord = 1;    nro=0;
maxRecords= reg.length-1;
page = 1; url=""; s="";  p="";
document.onmousemove = dragIt
if(ns4){document.captureEvents( Event.MOUSEMOVE )}

y=x=0
//------------------------------------------------------------------------------------------
function dragIt(evt){
if(ie4||ie5){x=window.event.clientX+document.body.scrollLeft; y=window.event.clientY+document.body.scrollTop} else {x=evt.pageX ; y=evt.pageY }
}
//------------------------------------------------------------------------------------------
imgPrArr=new Array();
function imgPreload(imgP){imgPrArrT=(imgP+",").split(",");for (i in imgPrArrT){if (imgPrArrT[i]!=""){imgPrArr[imgPrArrT[i]]=new Image();imgPrArr[imgPrArrT[i]].src=imgPrArrT[i]}}}
//------------------------------------------------------------------------------------------
function records()           // se abren los registros de records.js
{
for (j=1;j<=maxRecords;j++)  // recorre articulos
{
reg[j]=reg[j].split("#");
}
}
//------------------------------------------------------------------------------------------
function go()                // se gatilla con el menu desplegable y manda a function select
{
box = document.formul.navi;
destination = box.options[box.selectedIndex].value;
if (destination) location.href = "javascript:select(destination);"
}
//------------------------------------------------------------------------------------------
function select(codigo){     // recorre los  reg para ver los que coinciden en palabras clave
                             // arma vector con nros. de registro c/keyword; se activa por menu
	                      // preload de imágenes
k=0;sel=new Array();page = 1;
imgPrArr=new Array();imgPreload("basebig.gif ,gifts.jpg, base.jpg"); big(0);
for (j=1; j<=maxRecords; j++)  // recorre articulos
{
  if (reg[j][5].indexOf(codigo)!= -1)
                      {k=k+1; sel[k]=j;  imgPreload( reg[j][1] )}; // if contiene la keyword lo carga

}
upDate();
}
//------------------------------------------------------------------------------------------
function upDate()            // un loop de a 5 articulos del vector sel a las thumbnails
{                            // de 1 a sel.length de a 5 ; sel[j] es nro. de registro a mostrar
nsel = sel.length-1;
pages = parseInt(nsel/5);    if (5*pages < nsel) { pages = pages + 1};
document.formul.page.value="Page "+page+" of "+pages;
for (j=1;j<=5;j++){          // ciclo limpiar thumbnails
if (document.images) {document.images["imPic"+ j].src="base.jpg"; s="th"+j;
                      if(!ns4){document.getElementById(s).innerHTML="";}
                      };
	          };
	          
j1=5*(page-1)+1; j5=j1+4;

if (j5 > nsel) { j5=nsel ;};
jpic=0;
for (j=j1; j<=j5; j++)       // ciclo carga thumbnails
{
   curRecord=sel[j]; jpic=jpic+1; nreg[jpic]=sel[j];           // nro. registro de cada thumbnail

   if (document.images) { document.images["imPic"+ jpic ].src=reg[curRecord][1]+".jpg";s="th"+jpic;
   if(!ns4){document.getElementById(s).innerHTML=reg[curRecord][1];}}
}
}
//------------------------------------------------------------------------------------------
function showNext() {    big(0);
       page = page +1;
       if (page > pages) { page=pages ;};
       upDate();
 }
function showPrev() {  big(0);
      page = page -1;
      if (page <1) { page=1 ;};
      upDate();
 }
//------------------------------------------------------------------------------------------
function move_div(x,y){
	if (isNaN(x+y))return
	if(ns4){div1.moveTo(x,y)}else{div1.style.left=x+'px';div1.style.top=y+'px';}
}
function write_div(text){
	if(ns4){
		div1.document.open();
		div1.document.write(text);
		div1.document.close();
	           }
	else    {div1.innerHTML=text;}
}
//------------------------------------------------------------------------------------------
function big(ii){
if (ii==9999) {                                    // carga portada del sitio
	document.formul.product_id.value="0";
	write_div('<br><OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" WIDTH="800" HEIGHT="600" id="myMovieName"><PARAM NAME=movie VALUE="portada01.swf"> <PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="portada01.swf" quality=high bgcolor=#FFFFFF WIDTH="800" HEIGHT="600" NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>');
	move_div(0,10);return};
if (ii==0) {                                       // borrar (imagen mouse)(no hay articulo seleccionado)
	document.formul.product_id.value="0";base="basebig.gif";
	write_div("Move mouse pointer or click over thumbnails<br><img border=0  src="+base+" > ");
	move_div(150,40);return};
if (document.images["imPic"+ ii].src.indexOf("base.jpg")!= -1) {return};    // si thumbnail en blanco return
document.formul.buy_but.disabled=false;                                     // habilita botón de compra
k=nreg[ii];   ondiv=reg[k][1];     art=reg[k][1] + "-"+reg[k][4];
nro= parseFloat( reg[k][3])  +"";                 // 1er artic de burundanga es 309 en 2CO
document.formul.product_id.value=nro;   sold="";
if (reg[k][3]==0) {document.formul.product_id.value="0"; sold="  WARNING: THIS PRODUCT SOLD (OUT OF STOCK)  ";
	            alert(sold);};
url=reg[k][1]+".jpg";
if(reg[k][6] != "0"){url = reg[k][6]};
	               s ="<br>" +  sold + reg[k][4] + " (USD)$" + reg[k][2] +" (shipping included) "+ sold + "<br><img border=0  src=" + reg[k][1] + ".jpg  height=200 >"
if(reg[k][6] != "")  {s = s + "<a href="+"javascript:NewWindow("+"'"+url+"'"+");"+"><br>See more details</a>    "
                                  s = s  + "<IMG src='spacer.jpg' width=50 border=0> <a href=" + "javascript:NewWindowMessage();"
	                s = s +" > Before buy add a gift message</a> "};
write_div(s);
move_div(150,30);
}
//------------------------------------------------------------------------------------------
function big_hide(){
ondiv=0; 	t3=window.setTimeout('big_hide2()',100);
}
function big_hide2(){
if (ondiv==0){write_div(""); move_div(-1000,-1000)}
}
//------------------------------------------------------------------------------------------
function check_prod(){
 if(document.formul.product_id.value <1){document.formul.buy_but.disabled=true;alert( "Sold or no product selected.");}
}
//------------------------------------------------------------------------------------------
function NewWindow(url){ // popups
window.open(url,"","height=400,width=600,screenX=100,screenY=100,top=100,left=100,status=no,location=no,toolbar=no,directories=no,menubar=no,resizable,scrollbars=1");
}
//------------------------------------------------------------------------------------------
function NewWindowMessage(){       // popup dedicatoria
win2=window.open("","","height=300,width=400,screenX=0,screenY=0,top=0,left=0,status=no,location=no,toolbar=no,directories=no,menubar=no,resizable,scrollbars=1");
p="<html><head><title>Gift Message</title></head> <body bgcolor='#eeeeee'> "
p=p+ "<p><font face='Verdana' size='2'><a href='javascript:self.close();'>No gift message - Close this window</a></p><br>"
p=p+"<form action='/cgi-bin/cgiemail' method='post'>"
p=p+"<input type='hidden' name='cgiemail_html' value='success_page.htm'> <input type='hidden' name='cgiemail_timezone' value='MST'>"
p=p+"<input type='hidden' name='cgiemail_error' value='error.htm'>"
p=p+"<input type='hidden' name='art' value='"+art+"'> "
p=p+"<input type='hidden' name='cgiemail_timeformat' value='%A,%B %e, %Y %T'> <input type='hidden'  name='cgiemail_message' value='giftmessage.txt'>"
p=p+"<p><font face='Verdana' size='2'><b>Gift Message</b> We send your message in a greeting card with your gift. You are going to buy:<br>  "
p=p+art
p=p+"</font></p>  <p><font face='Verdana' size='2'> Your name: <input type='text' size='45' name='full_name'></font></p>   <p><font face='Verdana' size='2'> Your E-mail:<input type='text' size='45' name='email'></font></p>  <p align='left'><font face='Verdana' size='2'> Your message: <br> <textarea name='comments' rows='5' cols='49'></textarea>  <input  type='submit' value='SUBMIT'> </font></p></form></body></html>"
win2.document.write(p);
}


