function nuevoAjax(){ 
  var xmlhttp=false; 
  try { 
   xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
  } catch (e) { 
   try { 
     xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { 
     xmlhttp = false; 
   } 
  } 

  if (!xmlhttp && typeof XMLHttpRequest!='undefined') { 
   xmlhttp = new XMLHttpRequest(); 
  } 
  return xmlhttp; 
}   

function IsNumber(e) {
tecla = (document.all) ? e.keyCode : e.which;
if (tecla==8) return true;
patron = /[0-9]/; 
te = String.fromCharCode(tecla);
return patron.test(te);
}

function talles(color){
obj=document.getElementById("talles");
//obj.innerHTML='<img src="imagenes/ajax-loader.gif" width="50" height="50" />';
ajax=nuevoAjax(); 				
   ajax.open("POST", "talles.php",false);
	ajax.onreadystatechange=function() { 
    if (ajax.readyState==4) { 
	 if (ajax.status==200){
	   obj.innerHTML = ajax.responseText;
     } 
  }
}
ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
ajax.send("color="+color) 
}

function precios(total,tipo){
obj=document.getElementById("total");
var t = 0;
var c = 0;
var res='';
if(tipo=='transferencia' && total <300){t = total+9;c=9;}	
if(tipo=='transferencia' && total >=300){t = total;}	
if(tipo=='paypal' && total <300){t = total+9;c=9;}
if(tipo=='paypal' && total >=300){t = total;}
if(tipo=='contrreembolso' && total <300){t = total+11.5;c=11.5;}
if(tipo=='contrreembolso' && total >=300){t = total+2.5;c=2.5;}

res = "<div style=\"font-size:14px; width:239px; margin:auto;\"><br /><strong>SubTotal:</strong> "+total+" &euro; <br /><strong>Costo de envio:</strong> "+c+" &euro; <br /><strong>Final:</strong> "+t+" &euro; <input type=\"hidden\" name=\"total\" value=\""+t+"\"/></div>";

//if(tipo=='paypal'){res += '<input type="hidden" name="hiddenField"/>';}

obj.innerHTML = res;
}
