window.onload = checkAvailableWidth;
//window.onresize = checkAvailableWidth;
function checkAvailableWidth(){
	// get rid of older browsers
	if (!document.getElementById){
		return;
	}
	if (document.getElementById("single_product_display")){
		var singDiv=document.getElementById("single_product_display");
		mainPicWidth = singDiv.getElementsByTagName("img").item(0).width;
		mainPicHeight = singDiv.getElementsByTagName("img").item(0).height;
		if (mainPicWidth<140){
			mainPicWidth=140;
		}
		// was here for wide images, now being dealt with on the server side
		/*
		if (mainPicWidth>400){
			originalPicWidth=mainPicWidth;
			originalPicHeight = mainPicHeight;
			alert("originalPicHeight = "+originalPicHeight+" originalPicWidth = "+originalPicWidth);
			singDiv.getElementsByTagName("img").item(0).width=400;
			mainPicWidth=400;
			mainPicHeight = (originalPicWidth/400)*originalPicHeight;
		}
		 */
		singDiv.getElementsByTagName("div").item(0).style.width = (mainPicWidth+5) + 'px';
		singDiv.getElementsByTagName("div").item(1).style.width = (590 - mainPicWidth) + 'px'
	}
}