﻿// IsNoE   ：是否为null或"";
// ToInt   ：字符串转化为Int型整数;
// ToFloat ：字符串转化为Float型整数;
// Id      ：返回dom对象
// getMousePosition ：获取鼠标位置 
jQuery.extend({
    IsNoE:function(v){
        return v==null||v=="";
    },
    ToInt:function(v,b){        
        var r=parseInt(v);
        if(isNaN(r) && b){return 0}
        else{ return r}
    },
    ToFloat:function(v){
        return parseFloat(v);
    },
    Id:function(v){
        document.getElementById(v);
    },
    GetMousePosition:function(e){
        var posx = 0;
		var posy = 0;

		if (!e){
		    var e = window.event;
		}

		if (e.pageX || e.pageY) {
			posx = e.pageX;
			posy = e.pageY;
		}
		else if (e.clientX || e.clientY) {
			posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
			posy = e.clientY + document.body.scrollTop  + document.documentElement.scrollTop;
		};
		return { 'x': posx, 'y': posy };
    }
});

// Opacity ：设置透明度
jQuery.fn.extend({
    Opacity : function(value){
        return this.each(function(){
            if(value!=null)
            {
                if ( $.browser.msie ){
                    this.style.filter = "alpha(opacity = "+value+")";
                }
                else{
                    this.style.MozOpacity = $.ToInt(value)/100;
                }
            }
        })
    }
})
