// JavaScript Document
   
function DrawImage(ImgD,iwidth,iheight){
    //参数(图片,允许的宽??,允许的高??)
    var flag=false;
    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 show_List(name,value){
	var nameContent = name+"Content";
	var obj = document.getElementsByName(name);
	var div = document.getElementsByName(nameContent);
	for(var i=0;i<obj.length;i++){
		if (i==value){
			obj[i].className="sort_on";
			div[i].style.display="block";
		}else {
			obj[i].className="sort_off";
			div[i].style.display="none";
		}
	}
}

function showList2(tem,name,value){
	var obj = document.getElementsByName(name);
	var b_g = document.getElementsByName("b_g");
	
	if(tem == "1")
	{
		b_g[0].style.height = "auto";
		b_g[1].style.height = "0";
		b_g[1].style.overflow = "hidden";
	}
	else if(tem == "2")
	{
		b_g[1].style.height = "auto";
		b_g[0].style.height = "0";
		b_g[0].style.overflow = "hidden";
	}
	
	var temvalue1='t1';
	var temvalue2='t2';
	var view = function(){
		  for(var i=0;i<obj.length;i++){	
			if (i==value){
				if(i==0)
					obj[i].className=temvalue1+" active";
				else if(i==1) obj[i].className=temvalue2+" active";
			}else {
				if(i==0)
					obj[i].className=temvalue1;
					else if(i==1) obj[i].className=temvalue2;
			}
		}
	}
	var timeout = setTimeout(view,30);
	
	obj[value].onmouseout = function ()
	{
		clearTimeout(timeout);
	}
}


function SetWinHeight(obj)
{
		var win=obj;
		if (document.getElementById)
		{
					if (win && !window.opera)
							{
								 if (win.contentDocument && win.contentDocument.body.offsetHeight) 
									win.height = win.contentDocument.body.offsetHeight; 
								 else if(win.Document && win.Document.body.scrollHeight)
									win.height = win.Document.body.scrollHeight;
							}
					}
		}