﻿
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 Search()
{
    var url='product.aspx';
    var keywords = document.getElementById('key').value;    
    //var type = document.getElementById('searchtype').value;   
    
  
    if(keywords=='' || keywords=='请输入关键字')
    {
        alert('请输入关键字!');
        return;
    }    
    if(keywords!='') 
    {
    url+='?key=' + escape(keywords);
    //if(type!='') url+='&type='+type;
    }
    
   
    location.href = url;
}

function Inquir()
{
    var url='dinggou.aspx?inquiry=';
    var r='';
    r= getValue();
    if(r=='')
    {
       alert('请选择产品.');
       return;    
    }
    else
    {
      url+=r;    
    }
    location.href = url;
}


function   getValue()   
 { 
 　var r='';
 　 
    var   inputs   =   document.getElementsByTagName("input");   
   for( var i=0;i<inputs.length;i++)   //    
　 {   
　　　　if   (inputs[i].type   ==   "checkbox"   )   　　　　{   
　　　　　　if(inputs[i].checked)   
　　　　　　r+=inputs[i].value+","

　　　　}             
 　}   
 　r=r.substr(0,r.length-1);
   return r;       　　　　　　　   
    　　　　　　   
 }   

function Regedit()
{
    var url='user.aspx';  
   
    location.href = url;
}

function Login()
{
    var url='login.aspx';
    var name = document.getElementById('lgname').value;
    var pws = document.getElementById('lgpws').value;
  
    if(name=='')
    {
        alert('请输入用户名!');
        document.all.lgname.focus();
	    return false;
    }    
     if(pws=='')
    {
        alert('请输入密码!');
       document.all.lgpws.focus();
	return false;
    }   
    

}









