function gd_gateway(){
	this.client = gd_client;
	this.Win = (navigator.appVersion.indexOf("Win") != -1);
	this.Mac = (navigator.userAgent.indexOf("Mac",0) != -1);
	this.OSX = (navigator.userAgent.indexOf("Mac OS X",0) != -1);// Firefox Mozilla Netscape Safari
	this.MSIE = (navigator.userAgent.indexOf("MSIE") != -1);
	this.NN = (navigator.appName.indexOf("Netscape",0) != -1);
	this.Mozilla = (navigator.userAgent.indexOf("Mozilla") != -1);
	this.Opera = (navigator.userAgent.indexOf("Opera") != -1);
	this.swfRequireVer = null;
	this.swfYourVer = null;
	this.swflash = "application/x-shockwave-flash";
	this.navimt = navigator.mimeTypes;
	this.plugin = (this.navimt && this.navimt[this.swflash]) ? this.navimt[this.swflash].enabledPlugin : 0;
	this.atts = new Array();
	this.params = new Array();
	this.embed = new Array();
	this.flashElement;
	this.AS_SCROLLEVENT_METHOD_NAME = 'handleScrollEvent';
	this.browserMajorVersion = this.client.getBrowserVersion().major;
}
gd_gateway.prototype = {
	set_Attribute : function(a_name,a_value){
		this.atts[a_name] = a_value;
	},
	get_Attribute : function(a_name,a_value){
		for (i in this.atts){
		    document.write(i + '   ' + this.atts[i] +'<br />');
		}
	},
	set_Param : function(a_name,a_value){
		this.params[a_name] = a_value;
	},
	set_Embed : function(a_name,a_value){
		this.embed[a_name] = a_value;
	},
	generate_Swf : function(){
		this.check_FlashPlayer();
		if(parseInt(this.swfYourVer) >= parseInt(this.swfRequireVer)){
			this.put_Swf();
		}else{
			this.put_Noswf();
		}
	},
	put_Swf : function(){
		document.write('<object id="' + this.swfName + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+this.swfRequireVer+',0,0,0" width="' + this.swfWidth + '" height="' + this.swfHeight + '">');
		document.write('<param name="movie" value="' + this.swfFile + '" />');
		for(key in this.atts){
			document.write('<param name="' + key + '" value="' + this.atts[key] +'" />');
		}
		for(key in this.params){
			document.write('<param name="' + key + '" value="' + this.params[key] +'" />');
		}
		document.write('<embed');
		document.write(' src="' + this.swfFile + '"');
		document.write(' width="' + this.swfWidth + '"');
		document.write(' height="' + this.swfHeight + '"');
		document.write(' name="' + this.swfName + '"');
		for(key in this.atts){
			document.write(' ' + key + '="' + this.atts[key] +'"');
		}
		for(key in this.embed){
			document.write(' ' + key + '="' + this.embed[key] +'"');
		}
		document.write(' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"');
		document.write(' />');
		document.write('</object>');
		document.close();
	},
	put_Noswf : function(){
		document.write('<div class="alert"><a href="http://www.macromedia.com/go/getflashplayer" target="_blank">本サイトの閲覧には最新のFlashPlayerが必要になります。お持ちでない方はこちらよりダウンロードしてください。</a></div>');
		document.close();
	},
	check_FlashPlayer : function(){
		if(this.plugin){
			var nnswflash = navigator.plugins["Shockwave Flash"].description.split(" ");
			for(var i = 0; i < nnswflash.length; ++i){
				if(isNaN(parseInt(nnswflash[i]))) continue;
				this.swfYourVer = nnswflash[i];
			}
		}else if(navigator.userAgent && this.MSIE && this.Win){
			document.write('<scr' + 'ipt language=\"VBScript"\ type=\"text/vbscript\"\> \n');
			document.write('on error resume next \n');
			//document.write('startMovie = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & 8)))\n');
			document.write('yourVer = Left(Hex(Int(CreateObject("ShockwaveFlash.ShockwaveFlash").FlashVersion)),1)\n');
			document.write('</scr' + 'ipt\> \n');
			this.swfYourVer = yourVer;
		}
	},
	set_Swf : function(swfFile,swfName,swfWidth,swfHeight,swfVersion,backGround){
		this.swfRequireVer = swfVersion;
		this.swfFile = swfFile;
		this.swfName = swfName;
		this.swfWidth = swfWidth;
		this.swfHeight = swfHeight;
		this.swfBackGround = backGround;
	},
	set_SWFObject : function(pelement){
		this.flashElement = pelement;
		so = new SWFObject(this.swfFile, this.swfName, this.swfWidth, this.swfHeight, this.swfRequireVer, this.swfBackGround);
		so.addParam('menu', 'false');
		so.addParam('allowScriptAccess','sameDomain');
		so.write(this.flashElement);
		
		if(so.installedVer.major >= this.swfRequireVer){
			document.getElementById('defaultcontent').style.display = "none";
			this.setSWFfocus(this.flashElement);
		}
	},
	setSWFfocus : function(){
		var lgd = this;
		window.onload = function(){
			document.getElementById(lgd.swfName).focus();
		};
	},
	add_MouseWheelEvent : function(){
		if(this.client.isEventListener && this.client.isGecko)
		{
			window.addEventListener('DOMMouseScroll', createDelegate(this, this.move_Wheel), false);
		}else
		{
			window.onmousewheel = document.onmousewheel = createDelegate(this, this.move_Wheel);
		}
	},
	move_Wheel : function(e)
	{
		var delta = 0;
		if(! e) e = window.event;
		if(e.wheelDelta)
		{
			var d = e.wheelDelta;
			delta = d / Math.abs(d);
			if(this.client.isOpera && this.browserMajorVersion <= 8)
			{
				delta = -delta;
			}
		}else if(e.detail)
		{
			var d = e.detail; 
			delta = -d / Math.abs(d);
		}
		if(delta != 0)
		{	
			var element = document.getElementById(this.swfName);
			if(element[this.AS_SCROLLEVENT_METHOD_NAME]) element[this.AS_SCROLLEVENT_METHOD_NAME](delta);
		}
	},
	remove_MouseWheelEvent : function(){
		window.removeEventListener('DOMMouseScroll',this.move_Wheel,false);
	},
	addResizeHandler : function(){
		window.onresize = createDelegate(this, this.onResize);
	},
	removeResizeHandler : function(){
		window.onresize = null;
	},
	onResize : function(w){
		var le = document.getElementById(this.flashElement);
		if(typeof(this.flashcontentHeight) == "number"){
			if(this.getInnerHeight() > this.flashcontentHeight ){
				le.style.height = '100%';
			}else{
				le.style.height = this.setFlashHeight(this.flashcontentHeight);
			}
		}
	},
	getInnerWidth : function(){
		return (this.MSIE) ? document.body.clientWidth : window.innerWidth;
	},
	getInnerHeight : function(){
		return (this.MSIE) ? document.body.clientHeight : window.innerHeight;
	},
	get_ScreenSize : function(){
		var S = new Object();
		if(screen.availWidth){
			S.w = screen.availWidth;
			S.h = screen.availHeight;
		}else{
			S.w = screen.width;
			S.h = screen.height;
		}
		return S;
	},
	setTracker : function(ptrack){
		//
	},
	setFlashHeight : function(lh){
		//arguments
		var le = document.getElementById(this.flashElement);
		var lwh = (lh < this.getInnerHeight()) ? 0 : lh;
		if(lwh <= 0){
			this.flashcontentHeight = '100%';
			le.style.height = '100%';
		}else{
			this.flashcontentHeight = lwh;
			le.style.height = lwh;
		}
		//document.body.className = "flashcontent-" + lscroll;
	}
};


function createDelegate(pIns, phandler){
	var del = function(){ return phandler.apply(pIns, arguments); };
	del.phandler = phandler;
	del.pIns = pIns;
	return del; 

}





/*
 * Anchor
 *
 */

// Scroll
if(parseInt( navigator.appVersion ) >= 4){
	RunScriptRun = true;
}else{
	RunScriptRun = false;
}
function offsetXY(which){
	if(document.all){
		if(document.compatMode == "CSS1Compat"){
			x = document.documentElement.scrollLeft;
			y = document.documentElement.scrollTop;
		}else{
			x = document.body.scrollLeft;
			y = document.body.scrollTop;
		}
	}else if(window.pageXOffset !== undefined){
		x = window.pageXOffset;
		y = window.pageYOffset;
	}else{
		x = window.scrollX;
		y = window.scrollY;
	}

	if(which == "top"){
		return y;
	}else{
		return x;
	}
}
function scrollSet(nowX,targetX,nowY,targetY){
	var diffX,diffY,stepX,stepY,moveX,moveY;
	diffX = .1 * (targetX - nowX);
	if(diffX > 0){
		stepX = Math.ceil(diffX);
	}else{
		stepX = Math.floor(diffX);
	}
	diffY = .1 * (targetY - nowY);
	if(diffY > 0){
		stepY = Math.ceil(diffY);
	}else{
		stepY = Math.floor(diffY);
	}
	moveX = nowX + stepX;
	moveY = nowY + stepY;
	if( stepX > 0 && moveX <= targetX || stepY > 0 && moveY <= targetY || stepX < 0 && moveX >= targetX || stepY < 0 && moveY >= targetY ){
		window.scroll(moveX,moveY);
		nowX += stepX;
		nowY += stepY;
		setTimeout("scrollSet( " +nowX+ "," +targetX+ "," +nowY+ "," +targetY+ " )",1);
	}else{
		return true;
	}
}
function scrTar(targetX,targetY){
	if(RunScriptRun){
		var nowX = offsetXY("left");
		var nowY = offsetXY("top");
		scrollSet(nowX,targetX,nowY,targetY);
	}else{
		location.href='#top';
	}
}


function Anchor(AnchorName){
	if(MSIE){
		var posY = this[AnchorName].offsetTop;
		scrTar(0,posY);
	}else{
		location.href = "#" + AnchorName;
	}
}


