//图片按比例缩放
var flag=false;
function DrawImage(ImgD,iwidth,iheight){
    //参数(图片,允许的宽度,允许的高度)
    var image=new Image();
    image.src=ImgD.src;
    if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= iwidth/iheight){
        if(image.width>iwidth){  
        ImgD.width=iwidth;
        ImgD.height=(image.height*iwidth)/image.width;
        }else{
        ImgD.width=image.width;  
        ImgD.height=image.height;
        }
        //ImgD.alt=image.width+"×"+image.height;
        }
    else{
        if(image.height>iheight){  
        ImgD.height=iheight;
        ImgD.width=(image.width*iheight)/image.height;        
        }else{
        ImgD.width=image.width;  
        ImgD.height=image.height;
        }
        //ImgD.alt=image.width+"×"+image.height;
        }
    }
}
//收展菜单
function onChange(i,path){
var childSort=document.getElementById("child" + i);
var downgif=document.getElementById("down" + i);
	if (childSort.style.display=="none"){
		 childSort.style.display="block";
		 downgif.src=path+'-.gif';
		 
	}else{
		 childSort.style.display="none";
		 downgif.src=path+'+.gif';
	}
}
//搜索检查
function checkSearSubmit(){
	if(document.formSear.TextKeyword.value==""){
		alert("请输入关键字");
		document.formSear.TextKeyword.focus();
		return false;
	}
}

//订购检查
function checkOrderSubmit(){
	if(document.formOrder.username.value==""){
		alert("请填写您的姓名.");
		document.formOrder.username.focus();
		return false;
	}
	if(document.formOrder.address.value==""){
		alert("请填写您的联系地址.");
		document.formOrder.address.focus();
		return false;
	}
	if(document.formOrder.tel.value==""){
		alert("请填写您的联系电话.");
		document.formOrder.tel.focus();
		return false;
	}
	if(document.formOrder.introduce.value==""){
		alert("请填写您的内容.");
		document.formOrder.introduce.focus();
		return false;
	}
}

//检查在留言信息
function checkBioSubmit(){
	if(document.formBio.username.value==""){
		alert("请填写您的姓名.");
		document.formBio.username.focus();
		return false;
	}
	if(document.formBio.address.value==""){
		alert("请填写您的联系地址.");
		document.formBio.address.focus();
		return false;
	}
	if(document.formBio.tel.value==""){
		alert("请填写您的联系电话.");
		document.formBio.tel.focus();
		return false;
	}
	if(document.formBio.introduce.value==""){
		alert("请填写您的内容.");
		document.formBio.introduce.focus();
		return false;
	}

}

