/* -----------------------
			popup
----------------------- */

$(function () {
	$(".popup").popup();
	$(".popup01").popup({
		width : 540,
		height : 560
	});
});

/* option example

$(function(){
	$(".popup").popup({
		width : 200,
		height : 100
	});
});*/

$.fn.popup = function (op) {
	
	settings = {
		height: 600, // 高さ設定
		width: 700, // 幅設定
		toolbar: 0, // ツールバー 1 (YES) or 0 (NO)
		scrollbars: 1, // スクロールバー 1 (YES) or 0 (NO)
		status: 0, // ステータスバー 1 (YES) or 0 (NO)
		resizable: 1, // リサイズ 1 (YES) or 0 (NO)
		left:0, // ポジション（left）
		top:0, // ポジション（top）
		center: 1 // 中央表示 1 (YES) or 0 (NO)
	};
	
	if (settings.center == 1) {
		settings.top = (screen.height - settings.height) / 2;
		settings.left = (screen.width - settings.width) / 2;
	}
	
	$.extend(settings,op || {});
	
	return this.each(function () {

		parameters = "height=" + settings.height + ",width=" + settings.width + ",toolbar=" + settings.toolbar + ",scrollbars=" + settings.scrollbars + ",status=" + settings.status + ",resizable=" + settings.resizable + ",left=" + settings.left + ",screenX=" + settings.left + ",top=" + settings.top + ",screenY=" + settings.top;

		$(this).bind("click", function () {
			
			var name = "POPUP";
			winObj = window.open(this.href, name, parameters);
			winObj.focus();
			return false;
		});
	});
};
