/**
 * =============================================================
 *  open_window.js
 * =============================================================
 *  @copyright	COPYRIGHT (C) 2009 MdN Corporation., ALL RIGHTS RESERVED.
 *  @version	$Id
 */

var windowList = new Array();

windowList.push({
	url : "content/flash.html",
	window_name : "popup_window",
	options : {
		width : 600,
		height : 600,
		location : "yes",
		scrollbars : "yes",
		resizable : "yes",
		top : 100,
		left : 100
	}
});

windowList.push({
	url : "content/googleMap.html",
	window_name : "popup_window",
	options : {
		width : 800,
		height : 600,
		location : "yes",
		scrollbars : "yes",
		resizable : "yes",
		top : 100,
		left : 100
	}
});

windowList.push({
	url : "http://www.mdn.co.jp/di/book/6083/",
	window_name : "popup_window",
	options : {
		width : 800,
		height : 600,
		location : "yes",
		scrollbars : "yes",
		resizable : "yes",
		top : 100,
		left : 100
	}
});

windowList.push({
	url : "http://www.mdn.co.jp/di/book/6063/",
	window_name : "popup_window",
	options : {
		width : 800,
		height : 600,
		location : "yes",
		scrollbars : "yes",
		resizable : "yes",
		top : 100,
		left : 100
	}
});

MyLib.event.observe(window, "load", openPopupWindow, false);

function openPopupWindow(){
	var list;
	var anchor;
	var anchors = document.getElementsByTagName("a");

	if(typeof(windowList) != "undefined"){
		for(var i=0; anchor=anchors[i]; i++){
			for(var j=0; list=windowList[j]; j++){
				if(anchor.href.match(new RegExp(list.url, "i"))){
					anchor.list = list;

					MyLib.event.observe(anchor, "click", function(event){
						var options = "";

						for(var index in this.list.options){
							options += index + "=" + this.list.options[index] + ",";
						}

						options = options.replace(/,$/, "");

						window.open(this.href, this.list.window_name, options).focus();

						MyLib.event.stop(event);
					}, false);

					break;
				}
			}
		}
	}
}

