$(document).ready(function () {
	$(window).resize(
	function () 
	{
		if (!$('#popalertpopdiv').is(':hidden'))
		{ 
			popalert($('#popalertpopcontent').innerHTML);
		}		
	}
	);
});
var _popCallBackFunction = "";

var _haddleSetTimeOut = "";

/*content 浮出内容，poptime 浮出时间(毫秒) 0 代表永久,popCallBackFunction回调函数*/
function popalert(content,poptime,popCallBackFunction) 
{
	var maskHeight_ = $(document).height();
	var maskHeight = $(window).height();   
	var maskWidth = $(window).width();
	var scroll_top = $(document).scrollTop();
	var dialogTop = 0;
	if($('#popalertpopdiv').height() > (maskHeight/3*2)){
		dialogTop = 50;
	}else if($('#popalertpopdiv').height() > (maskHeight/2)){
		dialogTop = 100;
	}else{
		dialogTop =  200;
	}  
	dialogTop = dialogTop + scroll_top;
	var dialogLeft = (maskWidth/2) - ($('#popalertpopdiv').width()/2); 
	$('#popalertbgdiv').css({height:maskHeight_, width:maskWidth}).show();
	$('#popalertpopdiv').css({top:dialogTop, left:dialogLeft}).show();
	$('#popalertpopcontent').html(content);
	if(popCallBackFunction != null)
	{
		_popCallBackFunction = popCallBackFunction;
	}
	if(poptime > 0)
	{
		_haddleSetTimeOut = setTimeout("closepopalert()",poptime);
	}
}

function closepopalert()
{
	$('#popalertbgdiv, #popalertpopdiv').hide();
//	$("#popalertbgdiv").fadeOut(500); 
//	$("#popalertpopdiv").fadeOut(500);
	if(_popCallBackFunction != "")
	{
		_popCallBackFunction();
	}
	clearInterval(_haddleSetTimeOut);
	return false;
}
