/*
 * IE Alert! jQuery plugin
 * version 1
 * author: David Nemes http://nmsdvid.com
 * http://nmsdvid.com/iealert/
 */

(function($){
$("#goon").live("click", function(){
		$("#ie-alert-overlay").hide();	
		$("#ie-alert-panel").hide();						  
});
function initialize($obj, support, title, text){

    if (parseInt($.browser.version, 10) == 9) {
        title= "您正在使用的浏览器不支持网站的部分功能";// title text
        text= "为了您的账号安全和更好的产品体验，强烈建议使用更快更安全的浏览器。<br /><br /><h1 id='goon' style='font-size:20px;cursor:pointer;'>>>>继续访问</h1>";
    }
		var panel = "<span>"+ title +"</span>"
				  + "<p> "+ text +"</p>"
			      + "<div class='browser'>"
			      + "<ul>"
			      + "<li><a class='chrome' href='https://www.baidu.com/s?ie=utf-8&f=3&rsv_bp=1&rsv_idx=1&tn=baidu&wd=%E8%B0%B7%E6%AD%8C%E6%B5%8F%E8%A7%88%E5%99%A8%E5%AE%98%E6%96%B9%E4%B8%8B%E8%BD%BD&rsv_pq=ae733bf30000ed67&rsv_t=4ebe1EPjGBTNFE0M5zmo%2FISUB6Z9q%2FAnBPAc79dbgiJaHH7MYrNPUL4TsJs&rsv_enter=1&oq=%E8%B0%B7%E6%AD%8Cliu&inputT=10120&rsv_sug3=15&rsv_sug1=11&rsv_sug2=1&rsp=1&rsv_sug4=10120/' target='_blank'></a></li>"
			      + "<li><a class='firefox' href='http://www.mozilla.org/en-US/firefox/new/' target='_blank'></a></li>"
			      + "<li><a class='ie9' href='http://windows.microsoft.com/en-US/internet-explorer/downloads/ie/' target='_blank'></a></li>"
			      //+ "<li><a class='safari' href='http://www.apple.com/safari/download/' target='_blank'></a></li>"
			      + "<li><a class='opera' href='http://www.opera.com/download/' target='_blank'></a></li>"
			      + "<ul>"
			      + "</div>"; 

		var overlay = $("<div id='ie-alert-overlay'></div>");
		var iepanel = $("<div id='ie-alert-panel'>"+ panel +"</div>");

		var docHeight = $(document).height();

		overlay.css("height", docHeight-5 + "px");



		if (support === "ie9") { 			// shows the alert msg in IE9,IE8, IE7, IE6

		    if ($.browser.msie && parseInt($.browser.version, 10) < 10) {

		        $obj.prepend(iepanel);
		        $obj.prepend(overlay);

		    }

		    if ($.browser.msie && parseInt($.browser.version, 10) === 6) {


		        $("#ie-alert-panel").css("background-position", "-626px -116px");
		        $obj.css("margin", "0");

		    }


		}
		
		if (support === "ie8") { 			// shows the alert msg in IE8, IE7, IE6
		
			if ($.browser.msie  && parseInt($.browser.version, 10) < 9) {
				
				$obj.prepend(iepanel);
				$obj.prepend(overlay);
				
			}

			if ($.browser.msie  && parseInt($.browser.version, 10) === 6) {

				
				$("#ie-alert-panel").css("background-position","-626px -116px");
				$obj.css("margin","0");
  
			}
			
			
		} else if (support === "ie7") { 	// shows the alert msg in IE7, IE6
			
			if ($.browser.msie  && parseInt($.browser.version, 10) < 8) {
				
				$obj.prepend(iepanel);
				$obj.prepend(overlay);
			}
			
			if ($.browser.msie  && parseInt($.browser.version, 10) === 6) {
				
				$("#ie-alert-panel").css("background-position","-626px -116px");
				$obj.css("margin","0");
  
			}
			
		} else if (support === "ie6") { 	// shows the alert msg only in IE6
			
			if ($.browser.msie  && parseInt($.browser.version, 10) < 7) {
				
				$obj.prepend(iepanel);
				$obj.prepend(overlay);
				
  				$("#ie-alert-panel").css("background-position","-626px -116px");
				$obj.css("margin","0");
				
			}
		}

}; //end initialize function


	$.fn.iealert = function(options){
		var defaults = { 
			support: "ie9",  // ie8 (ie6,ie7,ie8), ie7 (ie6,ie7), ie6 (ie6)
			title: "您正在使用IE低版本浏览器", // title text
			text: "为了您的账号安全和更好的产品体验，强烈建议使用更快更安全的浏览器。<br /><br />"
		};
		
		
		var option = $.extend(defaults, options);

			return this.each(function(){
				if ( $.browser.msie ) {
					var $this = $(this);  
					initialize($this, option.support, option.title, option.text);
				} //if ie	
			});		       
	
	};
})(jQuery);
