﻿// Archivo JScript

    function change(strImg,pIMG,altoImg,anchoImg)
    {            
        target = document.getElementById(strImg);
        if(target)
        {
            var alto=337;
            var ancho=449;
            var nuevoWidth;
            var nuevoHeight;

            if (anchoImg / altoImg > ancho / alto)
            {
                nuevoWidth = ancho;
                nuevoHeight = Math.round((altoImg * ancho) / anchoImg);
            }
            else
            {
                nuevoHeight = alto;
                nuevoWidth = Math.round((anchoImg * alto) / altoImg);
            }
            target.onload=function(){   
                                        this.style.width = "".concat(nuevoWidth,"px");
                                        this.style.height = "".concat(nuevoHeight,"px");
                                        this.style.marginTop="".concat((alto-this.height)/2,"px");
                };
            target.src = pIMG;
        }
    }

    function changeClasificado(strImg, pIMG, altoImg, anchoImg) {
        target = document.getElementById(strImg);
        if (target) {
            var alto = 243;
            var ancho = 322;
            var nuevoWidth;
            var nuevoHeight;

            if (anchoImg / altoImg > ancho / alto) {
                nuevoWidth = ancho;
                nuevoHeight = Math.round((altoImg * ancho) / anchoImg);
            }
            else {
                nuevoHeight = alto;
                nuevoWidth = Math.round((anchoImg * alto) / altoImg);
            }
            target.onload = function() {
                this.style.width = "".concat(nuevoWidth, "px");
                this.style.height = "".concat(nuevoHeight, "px");
                this.style.marginTop = "".concat((alto - this.height) / 2, "px");
            };
            target.src = pIMG;
        }
    }
