(function(jQuery) {
jQuery.fn.daPopBox = function(para) {
	para = jQuery.extend({
        type:"alert",
		obj:false
    }, para || {});
    var o = jQuery(this);
	var htmlWidth = jQuery(document).width();
	var htmlHeight = jQuery(document).height();
	var windowWidth = jQuery(window).width();
	var windowHeight = jQuery(window).height();
	if(!para.obj){
		var obj = jQuery(o.attr("daPopBox"));
	}else{
		var obj = jQuery(para.obj);
	}
	jQuery("body").append("<div class='daPopBoxMask'></div>");
	var mask=jQuery(".daPopBoxMask");
	mask.css({
		"width":htmlWidth,
		"height":htmlHeight,
		"position":"absolute",
		"top":"0px",
		"left":"0px",
		"z-index":"3",
		"display":"none",
		"background":"#000000",
		"opacity":"0.4"
	});
	jQuery("body").append("<div class='daPopBoxObj'></div>");
	var objBox = jQuery(".daPopBoxObj");
	objBox.css({
		"width":windowWidth,
		"height":windowHeight,
		"position":"absolute",
		"display":"none",
		"top":"0px",
		"left":"0px",
		"z-index":"4"
	});
	objBox.append(obj);
	obj.css({
		"position":"relative",
		"left":"50%",
		"margin-left":-(Math.ceil(obj.width()/2)),
		"top":"100px",
		"display":"none"
	});
	
	var close = function(){
		mask.css("display","none");
		objBox.css("display","none");
		obj.css("display","none");
	}
	var open = function(){
		mask.css("display","block");
		objBox.css("display","block");
		obj.css("display","block");
		obj.css("top",jQuery(window).scrollTop()+100);
	}
	o.bind("click",function(){
		jQuery("#alertBoxInfo_name").text(jQuery(this).attr("title"));
		jQuery("#alertBoxInfo_add").text(jQuery(this).attr("add"));
		jQuery("#alertBoxInfo_tel").text(jQuery(this).attr("tel"));
		jQuery("#alertBoxInfo_txt").text(jQuery(this).attr("txt"));
		jQuery("#alertBoxInfo_img").attr("src",jQuery(this).attr("lsrc"));
		open();
	});
	objBox.bind("click",function(){
		close();
	});
	obj.click(function(event){
		event.stopPropagation();
		//return false;
	});
	jQuery(".alertBoxClose").click(function(){
		close();
	});
	

	
};
})(jQuery);
