/**
 * swfobject.execute.locationphoto.js
 * @version	1.0.0.0 - 12:14 2009/12/16
 * @see		SWFObject JavaScript API documentation
 * 			http://code.google.com/p/swfobject/wiki/api
 * @usage	swfobject.embedSWF(
				swfURL:String,
				replaceElementId:String,
				width:String,
				height:String,
				playerVersion:String,
				expressInstallSwfUrl:String,
				flashvars:Object,
				params:Object,
				attributes:Object
			);
 */

(function() {
	
	var swfurl        = '../f/locationphoto.index.swf';
	var elementId     = 'locationPhoto';
	var swfwidth      = '980';
	var swfheight     = '878';
	var playerversion = '9.0.45';
	
	// Express Install を使わずに代替コンテンツを表示する場合は null
	var expressInstall = null;
	// var expressInstall = '../lib/swfobject2.1/expressInstall.swf';
	var fpImage = '<a class="fR" href="http://get.adobe.com/jp/flashplayer/" target="_blank"><img src="http://www.adobe.com/images/shared/download_buttons/get_adobe_flash_player.png" alt="Get Adobe Flash Player" /></a>';
	var lowerPlugIn = '<p class="lowerPlugIn">' + fpImage + ' このコンテンツをご覧いただくにはAdobe Flash Player バージョン ' + playerversion + ' 以上が必要です。お使いのブラウザには最新のFlash Playerがインストールされていません。<a href="http://get.adobe.com/jp/flashplayer/" target="_blank">Adobeのウェブサイト</a>から最新のフラッシュプレイヤーをインストールした後、このページをリロード(更新)して下さい。</p>';
	
	var flashvars = {
		imageLength: numImages,
		location: locationId
	};

	var params = {
		allowScriptAccess: 'always',
		base: '.',
		bgcolor: '#ffffff',
		menu: 'false',
		quality: 'best',
		scale: 'noScale',
		salign: 'TL',
		wmode: 'transparent'
	};

	var attributes = {};
	// attributes.id   = '';
	// attributes.name = '';
	
	
	Kaas.addEvent(window, 'load', function() {
		if (swfobject.hasFlashPlayerVersion(playerversion)) {
			swfobject.embedSWF(swfurl, elementId, swfwidth, swfheight, playerversion, expressInstall, flashvars, params, attributes);
		} else {
			document.getElementById(elementId).innerHTML = lowerPlugIn;
		}
		
		var lpControllers = [
			document.getElementById('locationPhotoNavDown'),
			document.getElementById('locationPhotoNavUp')
		];
		for (var i = 0, l = lpControllers.length; i < l; i++) setEvents(lpControllers[i].getElementsByTagName('a'));
	});
	
	function setEvents(targets) {
		for (var i = 0, l = targets.length; i < l; i++) {
			var t = targets[i]
			t.id = i;
			t.onclick = function() {
				var _this = this;
				setTimeout(function() {
					document.getElementById(elementId).setScene(_this.id);
				}, 1600);
			};
		}
	}
	
})();

