﻿jQuery(document).ready(function(){
    jQuery.each(jQuery('.thumbImage'), function() {
        var src = jQuery(this).find("input").attr("value");
        jQuery(this).find("img").attr({src: src});
    });
    jQuery.each(jQuery('.ImagenesMasInfo'), function() {
        var src = jQuery(this).find("input").attr("value");
        jQuery(this).find("img").attr({src: src});
    });
});
        
function ValidateAddBasket ()
{
    var cboColor = document.getElementById('ctl00_ContentPlaceHolder1_cboColor');
    var cboTalla = document.getElementById('ctl00_ContentPlaceHolder1_cboTallas');
    var cantidad = 0;
    var mensaje = "";
    
    var colorvalidate = (cboColor && cboColor.value > 0) || (!cboColor);
    var tallavalidate = (cboTalla && cboTalla.value > 0) || (!cboTalla);
    
    if (cboColor && cboColor.value <= 0)
        mensaje = "Por favor, elije un color.";
     
    if (cboTalla && cboTalla.value <= 0)
        mensaje += "\nPor favor, elije una talla.";
        
    var qtyText = document.getElementById('ctl00_ContentPlaceHolder1_qtyText');
    var cantidad = parseInt(qtyText.value);
    if (isNaN(cantidad) || cantidad <= 0)
        mensaje = "La cantidad debe ser mayor de 0.";
        
    if (mensaje != "")
        alert (mensaje);
        
    return (colorvalidate && tallavalidate && !isNaN(cantidad) && cantidad > 0);
}

