var tipsbox = '
';
var loadingbox = '${info} ';
var confirmbox = '';
var timerskipbox = '${info} ';
var tipsboxarray = new array("gtl_ico_fail", "gtl_ico_succ", "gtl_ico_hits", "gtl_ico_clear");
var msgbox = new object();
var tipsst;
msgbox.tips = function (info, type, time, callback, ctime) {
var msgbox_layer_wrap = $(window.top.document.body).find(".msgbox_layer_wrap");
if (msgbox_layer_wrap.length <= 0) {
msgbox_layer_wrap = $(tipsbox).appendto(window.top.document.body);
} else {
msgbox_layer_wrap.show();
}
msgbox_layer_wrap = msgbox_layer_wrap.find(".msgbox_layer").find("span:eq(0)").removeattr("class").attr("class", tipsboxarray[type]).end().find("span:eq(1)").html(info).end().end();
cleartimeout(tipsst);
tipsst = settimeout(function () {
msgbox_layer_wrap.hide();
if (typeof (callback) != "undefined") {
settimeout(callback, ctime);
}
}, time);
}
//创建一个遮罩层
msgbox.createshadediv = function () {
var swidth, sheight;
swidth = $(window.top.document).width();
sheight = $(window.top.document).height();
$("").css({filter: "alpha(opacity=20)", opacity: "0.2", width: swidth + "px", height: sheight + "px"}).appendto(window.top.document.body);
$(window.top.document.body).attr("oncontextmenu", "return false");
}
//关闭遮罩层
msgbox.closeshadediv = function () {
$(window.top.document.body).find("#shadediv").remove();
$(window.top.document.body).removeattr("oncontextmenu");
}
//显示正在加载(info:加载信息;isshowshadediv:是否显示遮罩层)
msgbox.showloading = function (info, isshowshadediv) {
if ($(window.top.document.body).find(".loading_layer_wrap").length <= 0) {
$(window.top.document.body).find(".msgbox_layer_wrap").hide();
$(loadingbox.replace("${info}", (typeof (info) == "undefined") ? "数据加载中..." : info)).appendto(window.top.document.body);
if ((typeof (isshowshadediv) != "undefined") && isshowshadediv) {
msgbox.createshadediv();
}
}
}
//关闭正在加载
msgbox.closeloading = function () {
$(window.top.document.body).find(".loading_layer_wrap").remove();
msgbox.closeshadediv();
}
//关闭正在加载(info:提示文本;successcallback:确定时回调函数;cencelcallback:取消时回调函数)
msgbox.confirm = function (info, successcallback,cencelcallback) {
var confirm_layer_wrap = $(window.top.document.body).find(".confirm_layer_wrap");
if (confirm_layer_wrap.length <= 0) {
confirm_layer_wrap = $(confirmbox).appendto(window.top.document.body);
} else {
confirm_layer_wrap.show();
}
confirm_layer_wrap = confirm_layer_wrap.find(".confirm_text").text(info).end();
var successbtn = confirm_layer_wrap.find("a.success");
successbtn.unbind("click");
successbtn.click(function () {
confirm_layer_wrap.hide();
msgbox.closeshadediv();
if (typeof (successcallback) != "undefined") {
successcallback();
}
});
var cancelbtn = confirm_layer_wrap.find("a.cancel");
cancelbtn.unbind("click");
cancelbtn.click(function () {
confirm_layer_wrap.hide();
msgbox.closeshadediv();
if (typeof (cencelcallback) != "undefined") {
cencelcallback();
}
});
msgbox.createshadediv();
}
//显示倒计时(seconds:秒数;info:倒计时文本;url:跳转地址;isshowshadediv:是否显示遮罩层)
var timerseconds = 10;
msgbox.timerskip = function (seconds, info, url, isshowshadediv) {
timerseconds = seconds;
var confirm_layer_wrap = $(window.top.document.body).find(".msgbox_layer_wrap");
if (confirm_layer_wrap.length <= 0) {
confirm_layer_wrap = $(timerskipbox.replace("${info}", (typeof (info) == "undefined") ? " 页面 " + timerseconds + " 秒后跳转.." : info)).appendto(window.top.document.body);
} else {
confirm_layer_wrap.show();
}
setinterval(function () {
if (timerseconds <= 0) {
confirm_layer_wrap.remove();
settimeout(function(){
document.location.href = url;
},300);
}
confirm_layer_wrap = confirm_layer_wrap.find("font").text(timerseconds).end();
timerseconds -- ;
}, 1000);
if ((typeof (isshowshadediv) != "undefined") && isshowshadediv) {
msgbox.createshadediv();
}
}