﻿//使IE6 链接支持PNG背景半透明效果JS
//ObjID			- 窗口ID
//defaultPic 	- 未选中未hover时显示图片
//hoverPic		- 选中或hover时显示图片
function ie6pngSwitch(ObjID, defaultPic, hoverPic) {
	var f = 'DXImageTransform.Microsoft.AlphaImageLoader';//滤镜名字
	var sM = 'crop';//图片剪切方式
	var Obj = null;
	if(document.getElementById(ObjID) != null)Obj = document.getElementById(ObjID).getElementsByTagName("a");
	
	//先判断浏览器类型. 此脚本仅在IE5.5,IE6中启用.
	if(/MSIE (5\.5|6)/.test(navigator.userAgent) && typeof filters != 'unknown' && Obj != null){
		for(var i=0; i<Obj.length; ++i){
			if(Obj[i].className == "on"){//如果当前TAG带a.on样式的话, 类名可按需要修改
				Obj[i].style.filter = 'progid:'+f+'(src="'+hoverPic+'",sizingMethod="' + sM + '")';
			}
			else{
				Obj[i].style.filter = 'progid:'+f+'(src="'+defaultPic+'",sizingMethod="' + sM + '")';
			}
			Obj[i].onmouseover = function(){
				this.style.filter = 'progid:'+f+'(src="'+hoverPic+'",sizingMethod="' + sM + '")';
			}
			Obj[i].onmouseout = function(){
				this.style.filter = 'progid:'+f+'(src="'+defaultPic+'",sizingMethod="' + sM + '")';
			}
		}
	}
}

