window.onload = resize;

function resize() {
	list = document.getElementsByName("topimage");
	for (i = 0; i < list.length; i++) {
		el = list.item(i);
		if (el.getAttribute("id") != null && el.getAttribute("id").substring(0, 5) == "cover") {
			if (window.screen.width < 1024) {
				img = new Image();
				img.src = el.getAttribute("src");
				
				w = img.width;
				h = img.height;
				
				ratio = h / w;
				
				newW = 350;
				newH = newW * ratio;
				
				el.setAttribute("width", newW);
				el.setAttribute("height", newH);			
			}
		}
		if (el) el.className = "vis";
	}
}


