function openwin(vpage,vwidth,vheight)
{
var iwidth=(window.screen.width-vwidth)/2;
var iheight=(window.screen.height-vheight-24)/2-30;
var winname=Math.random();
winname=winname.toString(10)
winname=MD5(winname,32);
//alert(winname);
window.open(vpage,winname,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+vwidth+",height="+vheight+",left="+iwidth+",top="+iheight+"");
}
function DrawImage(ImgD,FitWidth,FitHeight){
   var image=new Image();
   image.src=ImgD.src;
   if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= FitWidth/FitHeight){
     if(image.width>FitWidth){  
     ImgD.width=FitWidth;
     ImgD.height=(image.height*FitWidth)/image.width;
     }else{
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }
     ImgD.alt="";
     }
    else{
     if(image.height>FitHeight){  
     ImgD.height=FitHeight;
     ImgD.width=(image.width*FitHeight)/image.height;     
     }else{
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }
     ImgD.alt="";
     }
    }
}
//图片渐隐变化
var speed = 90;        //速度
var max_opacity = 100;  //最大
var min_opacity = 90;	//最小
var do_step  =  5;      //变化的幅度

	function change_opacity(obj,do_option)
	{
		if(obj.doing)
			clearInterval(obj.doing);
		obj.doing = setInterval(do_option+"_alpha("+obj.sourceIndex+")",speed);	
	}
	

	function down_alpha(obj_index)
	{
		var obj = document.all[obj_index];
		
		if(obj.filters.Alpha.Opacity > min_opacity )
		{
			obj.filters.Alpha.Opacity += -do_step;
		}	
		else
		{	
			clearInterval(obj.doing);
			obj.filters.Alpha.Opacity = min_opacity;
			obj.doing = false;
		}	
	}	
	function up_alpha(obj_index)
	{
		var obj = document.all[obj_index];
		
		if(obj.filters.Alpha.Opacity<max_opacity)
			obj.filters.Alpha.Opacity += do_step;
		else
		{	
			clearInterval(obj.doing);
			obj.filters.Alpha.Opacity = max_opacity;
			obj.doing = false;
		}	
	}
	
function showHeadOver(obj){
	obj.src=obj.src.replace(".gif","Over.gif");
}

function showHeadOut(obj){
	obj.src=obj.src.replace("Over","");
}