var nowdiv_id function alertwindow(div_id) { nowdiv_id=div_id createalertdiv(); $(".alert").css("display","none") $(".alert2").css("display","none") $("#mydivbg").css("height", $(document).height()); var div_k=$("#"+div_id).css("width").replace("px",""); var div_g=$("#"+div_id).css("height").replace("px","") $("#mydivbg").stop(true,true).fadeto(200,0.8) $("#"+div_id).css("position", "absolute"); $("#"+div_id).css("left", ($(window).width()-div_k)/2); $("#"+div_id).css("z-index", "100000000"); $("#"+div_id).css("width", div_k+"px"); $("#"+div_id).css("height", div_g+"px"); $("#"+div_id).fadeto(200,1) //$("#"+div_id).css("top","120px"); //$(".alert").css("top",130+$(document).scrolltop()); $(window).trigger("resize"); $(window).trigger("scroll"); } $(window).scroll(function(){ $("#mydivbg").css("height", $(document).height()); $(".alert2").css("top",0+$(document).scrolltop()); }) function closewindow() { $("#mydivbg").fadeto(100,0).delay(10).hide(100); $(".alert").css("display","none") $(".alert2").css("display","none") } $(window).resize(function() { var div_id1=$(".alert:visible").attr("id") var div_id2=$(".alert2:visible").attr("id") if(div_id1!=undefined | div_id2!=undefined) { if (navigator.useragent.indexof('msie') != -1 ) { $("#mydivbg").css("width", $(window).width()); } else { $("#mydivbg").css("width", $(window).width()); } $("#mydivbg").css("height", $(document).height()); var div_k=$("#"+nowdiv_id).css("width").replace("px",""); $(".alert").css("left", ($(window).width()-div_k)/2); $(".alert2").css("left", ($(window).width()-div_k)/2); } }) function createalertdiv() { if($("#mydivbg").length==0) { $("body").prepend("
"); $("#mydivbg").css("display", "none"); $("#mydivbg").css("position", "absolute"); $("#mydivbg").css("top", "0px"); $("#mydivbg").css("left", "0px"); $("#mydivbg").css("background", "#000000"); $("#mydivbg").css("height", $(document).height()); if (navigator.useragent.indexof('msie') != -1 ) {$("#mydivbg").css("width", $(window).width()-17);}else{$("#mydivbg").css("width", $(window).width());} $("#mydivbg").css("z-index", "9999999"); } }