function resizeLogo(storeLayout,imageUrl) { var layoutSpeficWidth="", layoutSpeficHeight=""; var logoAttr = subCategoryAtt[storeLayout][2].split('*'); layoutSpeficWidth = logoAttr[0]; layoutSpeficHeight = logoAttr[1]; if(layoutSpeficWidth == 'any') layoutSpeficWidth = ''; img = new Image(); img.src=imageUrl; if(img.width > img.height || img.width == img.height){ aspectRatio = document.images["logoUrl"].width/document.images["logoUrl"].height; if(img.width > layoutSpeficWidth && layoutSpeficWidth !='') { img.width = layoutSpeficWidth; document.images["logoUrl"].width = img.width; } if(document.images["logoUrl"].height > layoutSpeficHeight) { img.height = layoutSpeficHeight; document.images["logoUrl"].height = img.height; document.images["logoUrl"].width = aspectRatio * img.height; } } else{ if(img.height > img.width){ aspectRatio = document.images["logoUrl"].height/document.images["logoUrl"].width; if(img.height > layoutSpeficHeight) { img.height = layoutSpeficHeight; document.images["logoUrl"].height = img.height; } if(document.images["logoUrl"].width > layoutSpeficWidth && layoutSpeficWidth !='') { img.width = layoutSpeficWidth; document.images["logoUrl"].width = img.width; document.images["logoUrl"].height = aspectRatio * img.width; } } } }