// JavaScript Document
<!-- // 说明：用 JavaScript 实现网页图片等比例缩放 // 
整理：http://www.CodeBit.cn  
function changesize(ImgD,FitWidth,FitHeight){     
	var image=new Image();
    image.src=ImgD.src;
	if(image.width>0 && image.height>0){
		if(image.width/image.height>= FitWidth/FitHeight){
			if(image.width>FitWidth){
				ImgD.width=FitWidth;
				ImgD.height=(image.height*FitWidth)/image.width;
            }else{
			    ImgD.width=image.width;
				ImgD.height=image.height;
				}
			} else{
			     if(image.height>FitHeight){
				 	ImgD.height=FitHeight;
				 	ImgD.width=(image.width*FitHeight)/image.height;
				 }else{
				 	ImgD.width=image.width; 
					ImgD.height=image.height;
				}
			}
		}
	} 
	
	function changpic(obj,picpath){
		obj.src = picpath;	
	
	}

function switchTab(tabid){
	for(var i=1; i<3; i++){
		Element.removeClassName($('imageTab' + i), "Selected");
		Element.addClassName($("container" + i), "hide");
	}	
	Element.addClassName($('imageTab' + tabid), "Selected");
	Element.removeClassName($("container" + tabid), "hide");
}

//测试函数
function testSubmit(theDataSrc) {
	var str = "";

	var selectNodes = document.getElementsByTagName("select");
	for (i = 0; i < selectNodes.length; i++) {
		if ($V(selectNodes[i] , "USEDATA") == theDataSrc) {
			str += "[" + $V(selectNodes[i] , "name") + "] : Value=" + $F(selectNodes[i]) + " ; Desc=" + selectNodes[i][selectNodes[i].selectedIndex].childNodes[0].nodeValue + "\n";
		}
	}
	alert(str);
}
