﻿
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){//?í?è′óóúòa?ó
	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)
	{//???è′óóúòa?ó
	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 $$(id){
	return document.getElementById(id);	
}



function Search()
{
    var url='product.aspx';
    var keywords = document.getElementById('key').value;
    var type = document.getElementById('sel_class').value;
    if(keywords==' → Keyword ←' || keywords=='Please enter the keyword(s)')
    {
        alert('Please enter the keyword(s)!');
        return;
    }    
    else 
    {
      url+='?key=' + escape(keywords);
      if(type!='0') url+='&id='+type;    
    }
    
   
    location.href = url;
}

function Regedit()
{
    var url='user.aspx';  
   
    location.href = url;
}

function chgmenu(i)
 {
    
    var sub=$$("sub_"+i);   
    var m=$$("n_"+i);
    m.className="now";
   if(sub)  sub.className="subnow";			     
 }
