

var FullScreenManager = (function(){
	function on(){
		console.log("----全屏----");
		var el = document.documentElement;
		var rfs = el.requestFullScreen || el.webkitRequestFullScreen ||
		    el.mozRequestFullScreen || el.msRequestFullScreen;
		if (rfs) { //typeof rfs != "undefined" && rfs
		    rfs.call(el);
		} else if (typeof window.ActiveXObject != "undefined") {
		    //for IE，这里其实就是模拟了按下键盘的F11，使浏览器全屏
		    var wscript = new ActiveXObject("WScript.Shell");
		    if (wscript != null) {
		        wscript.SendKeys("{F11}");
		    }
		}
	}
	function off(){
	    var el = document;
	    var cfs = el.cancelFullScreen || el.webkitCancelFullScreen ||
	        el.mozCancelFullScreen || el.exitFullScreen;
	    if (cfs) { //typeof cfs != "undefined" && cfs
	        cfs.call(el);
	    } else if (typeof window.ActiveXObject != "undefined") {
	        //for IE，这里和fullScreen相同，模拟按下F11键退出全屏
	        var wscript = new ActiveXObject("WScript.Shell");
	        if (wscript != null) {
	            wscript.SendKeys("{F11}");
	        }
	    }
	}
	
	
	function click(){
		$(window).unbind();
		//全屏事件需要手动触发，由于浏览器的安全
		$("body").one('click',function(){
			on();
		});
		$("body").trigger("click");
	}
	
	return {on: on, off: off,click:click};
})();