//隐藏微信工具条按钮
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
	WeixinJSBridge.call('hideOptionMenu'); 
	WeixinJSBridge.call('hideToolbar');
}); 
	
window.jQuery(document).ready(function () { 
		window.jQuery("#windowclosebutton").click(function () { 
			window.jQuery("#windowcenter").slideUp(500);
		}); 
		window.jQuery("#alertclose").click(function () { 
			window.jQuery("#windowcenter").slideUp(500);
		}); 
}); 

//color: 标题颜色，time: 对话框显示时间，0表示永久显示
function box(title, color, time, header){ 
		if( time == undefined ) time = 5000; 
		var windowHeight=$(window).height(); 
		var windowWidth=$(window).width();
		var scrollTop = $(document).scrollTop();
		var popHeight=$(".window").height();
		var popWidth=$(".window").width(); 
		var popY=(windowHeight-popHeight)/2; 
		var popX=(windowWidth-popWidth)/2; 
		if( color ){
			window.jQuery("#txt").css("color", color);
		}
		if(header){
			$("#windowcenter #title").text(header);
		}else{
			$("#windowcenter #title").text("友情提示");
		}
		window.jQuery("#txt").html(title);
		window.jQuery("#windowcenter").css({ "top":popY+scrollTop, "left":popX });
		window.jQuery("#windowcenter").slideToggle("normal"); 
		if(time > 0 ){
			setTimeout('window.jQuery("#windowcenter").slideUp(500)', time);
		}
}
function SucceedBox(title, color, time){
	box(title, color, time);
}
function ErrorBox(title){
	box(title, "red", 0);
}
function CloseLoadBox(){
	window.jQuery("#windowtip").hide();
}

function LoadBox(title){
	if( title ){
		window.jQuery(".tiptitle").html(title);
	}
	var windowHeight=$(window).height(); 
	var windowWidth=$(window).width(); 
	var scrollTop = $(document).scrollTop();
	var popHeight=$("#windowtip").height(); 
	var popWidth=$("#windowtip").width(); 
	var popY=(windowHeight-popHeight)/2; 
	var popX=(windowWidth-popWidth)/2; 
	window.jQuery("#windowtip").css({ "top":popY+scrollTop, "left":popX });
	window.jQuery("#windowtip").show(); 
}