function open_fullscreen(){
	var S = get_ScreenSize();
	window.open('main.html','Cybershot',"width=" + (S.w - 8) + ",height=" + (S.h - 28) + ",left=" + 0 + ",top=" + 0 + ",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no");
}
function get_ScreenSize(){
	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;
}
function gd_gateway(){
	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); // NN and Mozilla
	this.NN6orL = (navigator.userAgent.indexOf("Netscape") != -1); // 6.0 or later
	this.Mozilla = (navigator.userAgent.indexOf("Mozilla") != -1); // NN and Mozilla
	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();
}
gd_gateway.prototype = {
	set_Swf : function(swfFile,swfName,swfWidth,swfHeight,swfVersion){
		this.swfRequireVer = swfVersion;
		this.swfFile = swfFile;
		this.swfName = swfName;
		this.swfWidth = swfWidth;
		this.swfHeight = swfHeight;
	},
	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(){
		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;
		}

		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" onclick="javascript:goAdobe()">本サイトの閲覧には最新のFlashPlayerが必要になります。お持ちでない方はこちらよりダウンロードしてください。</a></div>');
		document.close();
	},
	add_MouseWheelEvent : function(){
		if(this.OSX){
			if(window.addEventListener){
				window.addEventListener('DOMMouseScroll',this.move_Wheel,false);
			}
			window.onmousewheel = this.move_Wheel;
			document.onmousewheel = this.move_Wheel;
		}
	},
	move_Wheel : function(event){
		var delta = 0;
		if(! event) event = window.event;
		if(event.wheelDelta){
			delta = event.wheelDelta / 4; 
			if(window.opera) delta = -delta;
		}else if(event.detail){
			delta = -event.detail;
		}
		if(delta != 0){
			if(parent.MSIE){
				window[parent.swfName].handleScrollEvent(delta);
			}else{
				document[parent.swfName].handleScrollEvent(delta);
			}
		}
	},
	remove_MouseWheelEvent : function(){
		window.removeEventListener('DOMMouseScroll',this.move_Wheel,false);
	}
}

function goAdobe(){
	window.close();
	window.open("http://www.macromedia.com/go/getflashplayer","","toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=yes,resizable=yes");
	return false;
}


// 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;
	}
}

function changeImg(ptarget, pimage, pw, ph){
	var lhtml = "<img src='" + pimage +"' width='" + pw + "' height='" + ph + "' alt='' />";
	var lid = document.getElementById(ptarget);
	lid.innerHTML = lhtml;
	lid.style.width = pw + 'px';
	lid.style.height = ph + 'px';
	return false;
}

