window.onerror=function(){return true;};
if($.browser.msie && $.browser.version=="6.0"){document.execCommand('BackgroundImageCache',false,true);}
$.ajaxSetup({crossDomain: false});
(function($){
    if(typeof $.registerNameSpace !== "undefined"){return false;}
    /**
    * 核心扩展
    * registerNameSpace 注册命名空间
    * Class             类
    */
    $.extend({
        //用于注册命名空间
        registerNameSpace : function(packageName){
            packageName = packageName.replace(/^\.+|\.+$/g, '');
            var prefix = this;
            this.each(packageName.split('.'), function(index, item){
                if(!prefix[item]){
                    prefix[item] = {};
                }
                prefix = prefix[item];
            });
            
            return $.isEmptyObject(prefix);
        },
	    /**
		* @desc  鼠标划动对象样式
		*/
		mouseHover:function(class_id){
			$(class_id).live("mouseenter",function(){
				$(this).addClass("active");
			}).live("mouseleave",function(){
				$(this).removeClass("active");
			});
		},
		/**
		*  cookie
		*  @param name 	String   cookie名
		*  @param value 	String   cookie值
		*  @param value 	jsonObject 	cookie其它参数
		*/
		cookie:function(name, value, options) {
			if (typeof value != 'undefined') {
				options = options || {};
				if (value === null) {
					value = '';
					options.expires = -1;
				}
				var expires = '';
				if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
					var date;
					if (typeof options.expires == 'number') {
						date = new Date();
						date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
					} else {
						date = options.expires;
					}
					expires = '; expires=' + date.toUTCString();
				}
				var path = options.path ? '; path=' + (options.path) : '';
				var domain = options.domain ? '; domain=' + (options.domain) : '';
				var secure = options.secure ? '; secure' : '';
				document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
			}else{
				var cookieValue = null;
				if (document.cookie && document.cookie != '') {
					var cookies = document.cookie.split(';');
					for (var i = 0; i < cookies.length; i++) {
						var cookie = jQuery.trim(cookies[i]);
						if (cookie.substring(0, name.length + 1) == (name + '=')) {
							cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
							break;
						}
					}
				}
				return cookieValue;
			}
		}
    });
})(jQuery);

