﻿/*
	--------------------------------
	Created: 2008.04.15
	Last Modified: 2008.04.18
	--------------------------------
	- Table of Contents -

	リニューアル
	--------------------------------
*/



/* --------------------------------
	リニューアル
-------------------------------- */

var renewal = new Renewal();
$_.addEvent(window, 'load', function() { renewal.init('renewal'); }, false);

function Renewal() {
	// クエリに [ renewal=1 ] が指定されている場合はクッキーの状態にかかわらずリニューアルを表示
	this.skip = !location.search.match('(^[?]|&)renewal=1(&|$)') && $_.getCookie('oicRenewal')

	// 初期化
	this.init = function(id) {
		if (this.skip) {
			$_.setCookie('oicRenewal', 1, 1000 * 60 * 60 * 24 * 7, '/');
		} else {
			this.container = $_.element('div', { id: id });// コンテナ
			var body = document.getElementsByTagName('body')[0];
			body.appendChild(this.container);
			var so = new SWFObject('default/flash/renewal.swf', 'renewal_swf', '100%', '400', '9', '#ffffff');
			so.addParam('allowScriptAccess', 'always');
			so.addParam('allowFullScreen', 'false');
			so.addParam('wmode', 'transparent');
			so.write(id);
		}
	}

	// リニューアルを非表示
	this.hide = function() {
		$_.setCookie('oicRenewal', 1, 1000 * 60 * 60 * 24 * 7, '/');
		this.container.style.display = 'none';
		if (!navigator.appVersion.match('Win')) this.swapCover();
	}

	// カバーをセット
	this.setCover = function() {
		var so = new SWFObject('oic_top.swf', 'oic_top', '605', '343', '8', '#ffffff');
		so.addParam('allowScriptAccess', 'always');
		so.addParam('allowFullScreen', 'false');
		so.addParam('wmode', 'transparent');
		so.write('cover_flash');
		if (navigator.appVersion.match('Win') || this.skip) this.swapCover();
	}

	// カバーを切り替え
	this.swapCover = function() {
		$_('#cover_img').style.display = 'none';
		$_('#cover_flash').style.display = 'block';
	}
}






