
function loaded(myimg,mywidth,myheight){
var tmp_img = new Image();
tmp_img.src=myimg.src;
image_x=tmp_img.width;
image_y=tmp_img.height;
	if(image_x > mywidth){//
	tmp_img.height=image_y * mywidth / image_x;
	tmp_img.width=mywidth;
		if(tmp_img.height>myheight){
			tmp_img.width=tmp_img.width * myheight / tmp_img.height;
			tmp_img.height=myheight;
			}
	}else if(image_y > myheight)
	{//
	tmp_img.width=image_x * myheight / image_y;
	tmp_img.height=myheight;
		if(tmp_img.width>mywidth){
			tmp_img.height=tmp_img.height * mywidth / tmp_img.width;
			tmp_img.width=mywidth;
			}
	}
	myimg.width=tmp_img.width;
	myimg.height=tmp_img.height;

}

function changemenu(n,s)
{  
   var nav=document.getElementById("nav_"+n); 
   var obj=document.getElementById("sub_"+s);  

   if(nav)
   {    
    nav.className="now"; 
   }
   if(obj)
   {    
    obj.className="now"; 

   }
  
}
//获取单选选项
function getChecked(selectname)
{
   var obj = eval("document.all." + selectname);
	if(typeof(obj) == "object"){
		for(i = 0 ;i < obj.length;i ++){
			if(obj[i].checked){
				return obj[i].value;
			}
		}
	}
}

function Search()
{
    var url='product.html';
    var keywords = document.getElementById('key').value;
    var type = document.getElementById('sel_class').value;
  
  
   url+='?key=' + escape(keywords);
   if(type!='0') url+='&id='+type;  
    
   
    location.href = url;
}

////////////////////////////////////////////////////////
// 将日期类型转换成字符串型格式yyyy-MM-dd 
////////////////////////////////////////////////////////
function ChangeDateToString(DateIn)
{
    var Year=0;
    var Month=0;
    var Day=0;

    var CurrentDate="";
    //初始化时间
 
    Year      = DateIn.getFullYear();
    Month     = DateIn.getMonth()+1;
    Day       = DateIn.getDate();
   

    CurrentDate = Year + "-";
    if (Month >= 10 )
    {
        CurrentDate = CurrentDate + Month + "-";
    }
    else
    {
        CurrentDate = CurrentDate + "0" + Month + "-";
    }
    if (Day >= 10 )
    {
        CurrentDate = CurrentDate + Day ;
    }
    else
    {
        CurrentDate = CurrentDate + "0" + Day ;
    }
   

    return CurrentDate;
}










