function setTab(name,cursel,n,t){
	for(var i=1;i<=n;i++){	
		var menu=document.getElementById(name+i);
		if(!menu){
			if (t==0)cursel++;
			continue;
		}
		var con=document.getElementById("con_"+name+"_"+i);
		menu.className=(i==cursel?"hover":"");
		con.style.display=(i==cursel?"block":"none");
	}
}

function DrawImage(ImgD, iWidth, iHeight)
{
	var image = new Image();
	image.src = ImgD.src;
	if(image.width > 0 && image.height > 0)
	{
		if(image.width > iWidth || image.height > iHeight)
		{
			if(image.width / image.height >= iWidth / iHeight)
			{
				ImgD.width = iWidth;
				ImgD.height = (image.height * iWidth) / image.width;
			}
			else
			{
				ImgD.height = iHeight;
				ImgD.width = (image.width * iHeight) / image.height; 
			}
		}
		else
		{
			ImgD.width = image.width; 
			ImgD.height = image.height;
		}
	}
}
