/**
	Id:$
*/
function alternateWindow() {

	this.setLocation = setLocation;
	this.setName = setName;
	this.setAttributes = setAttributes;
	this.setNewWindow = setNewWindow;
	this.setWindowFocus = setWindowFocus;

	this.location = "";
	function setLocation() {
		this.location = arguments[0];
	}

	this.name = "";
	function setName() {
		this.name = arguments[0];
	}

	function getValue() {
		return arguments[0].substring(parseInt(arguments[0].indexOf("=", 0)) + 1, arguments[0].length);
	}

	function adjustWindowWidth(W) {
		if (getAgentType() != "ms5_mac" && getAgentType() != "ms4_mac") W = parseInt(W) + 16;
		return ("" + W);
	}

	function getAgentType() {
		if (navigator) {
			if ( window.opera ) {
				if (navigator.appVersion.indexOf("Win",0) != -1) return "opera_win";
				else if (navigator.appVersion.indexOf("Mac",0) != -1) return "opera_mac";
				else return "opera";
			} else if ( document.all && document.getElementById ) {
				if (navigator.appVersion.indexOf("Win",0) != -1) return "ms5_win";
				else return "ms5_mac";
			} else if ( document.all && !document.getElementById ) {
				if (navigator.appVersion.indexOf("Win",0) != -1) return "ms4_win";
				else return "ms4_mac";
			} else if ( document.getElementById && !document.all ) {
				if (navigator.appVersion.indexOf("Win",0) != -1) return "stnrd_win";
				else if (navigator.appVersion.indexOf("Mac",0) != -1) return "stnrd_mac";
				else return "stnrd";
			} else if ( document.layers ) {
				if (navigator.appVersion.indexOf("Win",0) != -1) return "nn4x_win";
				else if (navigator.appVersion.indexOf("Mac",0) != -1) return "nn4x_mac";
				else return "nn4x";
			} else {
				return "else";
			}
		}
	}

	function setWindowFocus(targetWindow) {
		if ( getAgentType() != "ms4_win" ) {
			if ( getAgentType() != "ms4_mac" ) {
				targetWindow.focus();
			}
		}
	}

	this.attributes = new Object();
	this.attributes["width"] = "500";
	this.attributes["height"] = "400";
	this.attributes["left"] = "10";
	this.attributes["top"] = "10";
	this.attributes["directories"] = "no";
	this.attributes["location"] = "no";
	this.attributes["menubar"] = "no";
	this.attributes["resizable"] = "no";
	this.attributes["scrollbars"] = "no";
	this.attributes["status"] = "no";
	this.attributes["toolbar"] = "no";
	this.attributeSet = "";
	this.i = 0;
	this.item = "";
	function setAttributes() {
		for (this.i=0; this.i<arguments.length; this.i++) {
			if (arguments[this.i].substring(0,3) == "wid") this.attributes["width"] = getValue(arguments[this.i]);
			if (arguments[this.i].substring(0,3) == "hei") this.attributes["height"] = getValue(arguments[this.i]);
			if (arguments[this.i].substring(0,3) == "lef") this.attributes["left"] = getValue(arguments[this.i]);
			if (arguments[this.i].substring(0,3) == "top") this.attributes["top"] = getValue(arguments[this.i]);
			if (arguments[this.i].substring(0,3) == "dir") this.attributes["directories"] = "yes";
			if (arguments[this.i].substring(0,3) == "loc") this.attributes["location"] = "yes";
			if (arguments[this.i].substring(0,3) == "men") this.attributes["menubar"] = "yes";
			if (arguments[this.i].substring(0,3) == "res") this.attributes["resizable"] = "yes";
			if (arguments[this.i].substring(0,3) == "scr") this.attributes["scrollbars"] = "yes";
			if (arguments[this.i].substring(0,3) == "sta") this.attributes["status"] = "yes";
			if (arguments[this.i].substring(0,3) == "too") this.attributes["toolbar"] = "yes";
		}
		
		if (this.attributes["scrollbars"] == "yes") {
			this.attributes["width"] = (getAgentType() != "ms5_mac" && getAgentType() != "ms4_mac")? parseInt(this.attributes["width"]) + 16 : this.attributes["width"] ;
		}
		
		for (this.item in this.attributes) {
			if (!!!this.attributeSet) this.attributeSet = this.attributeSet + this.item + "=" + this.attributes[this.item];
			else this.attributeSet = this.attributeSet + "," + this.item + "=" + this.attributes[this.item];
		}
	}

	this.browsField = "";
	function setNewWindow() {
		if (!!this.name) {
			//window.name = "rootWindow";
			this.browsField = window.open( this.location, this.name, this.attributeSet);
			setWindowFocus(this.browsField);
		}
	}
}



/*---------------------------------------------------------------
 [2009.02.05] 外部リンク確認メッセージ追加    (C) Resident First

関数  linkConfirm()

引数  pageName ---- 外部サイトページ運営者
      URL --------- 外部サイトURL

注意点 
極端に古いブラウザ(IE3,NN2以下）以外は、特にありません。
aタグのonClickイベントで動かせて、hrefはvoid(0)をかけたほうが親切です

サンプル
<a href="javascript:void(0);" onClick="linkConfirm('Yahoo!' , 'http://www.yahoo.co.jp/' )">
---------------------------------------------------------------*/
function linkConfirm( pageName , URL ){
	var cfm = confirm(pageName + "のサイトにリンクします");
	if (cfm){
		var win=window.open( URL )
		win.focus();
	}
}


