// JavaScript Document

// ventana flotante de ayuda_carrito, escribir titulo y cerrar al pulsar sobre la imagen

function ayudacompra(ayuda) {
		ayudaWindow = window.open(ayuda,"ampliadaWin","toolbar=no,width=510,height=410,left=250,top=10,align=left")
		ayudaWindow.document.write("<title>AYUDA DE COMPRA -- Frutas Isaías<\/title>" , "<div style='position:relative;left:10%;top:5%;'>" , "<a href='javascript:close()'>CERRAR<\/a>" , "</div>")
		ayudaWindow.focus()
		
		}
// Abre las fotos en una ventana nueva
function openWin(foto, modelo, medida_w, medida_h, nameWin) {
	newWindow = window.open(foto, nameWin, ('width=' + medida_w + ', height=' + medida_h))
	newWindow.document.write("<title>" + modelo + " <\/title>" , "<div style='position:absolute;left:0px;top:0px;'>" , "<a href='javascript:close()'>" , "<img src='" + foto + "' alt='Pulse para cerrar la ventana' \/><\/a><\/div>")
	newWindow.focus()
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=self.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// baner rotativo
	adImages1 = new Array("multimedia/fotos/bodegon_especias.jpg","multimedia/fotos/bodegon_frutas_07.jpg","multimedia/fotos/calendario_portada.jpg","multimedia/fotos/fruta_cestas_01_g.jpg","multimedia/fotos/fruta_cestas_02_g.jpg")

	thisAd1 = -1

	imgCt1 = adImages1.length

	function rotate() {
		if (document.images) {
			thisAd1++
			if (thisAd1 == imgCt1) {
				thisAd1 = 0
			}
			document.frutas.src=adImages1
[thisAd1]
			setTimeout("rotate()", 3 * 1000)
		}
	}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' incorrecto.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' deben ser numeros.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' es necesario.\n'; }
  } if (errors) alert('Antes de enviar debe corregir:\t\n\n'+errors);
  document.MM_returnValue = (errors == '');
}
// Envio de pedidos
function mienvio(donde){
document.form.action = donde;
document.form.submit();
}

