﻿/*-------------------------------------------------------------
　　 JavaScript Document
-------------------------------------------------------------*/

//include FletsNews 
function FletsNews(){
document.write(
	'<div id="flets">' +
	'<div>' +
	'<p class="flets_title"><a href="https://flets-members.jp/pub/login.html" target="_blank">フレッツ光メンバーズクラブ</a></p>' +
	'<p>2009年9月10日　<a href="#">システムメンテナンス完了のお知らせ</a></p>' +
	'</div>' +
	'</div><!--/flets-->'
)}


//include SetTree
function SetTree(){
document.write(
	'<link rel="stylesheet" type="text/css" href="/themed/member/css/treeview.css" />' +
	'<scr'+'ipt type="text/javascript" src="/js/word_break.js"></scr'+'ipt>'+
	'<scr'+'ipt type="text/javascript" src="/js/treeview/jquery.treeview.js"></scr'+'ipt>' +
	'<scr'+'ipt type="text/javascript" src="/js/treeview/jquery-ui.js"></scr'+'ipt>' +
	'<scr'+'ipt type="text/javascript" src="/js/treeview/jquery.cookie.js"></scr'+'ipt>' +
	'<scr'+'ipt type="text/javascript" src="/js/treeview/treeview_action.js"></scr'+'ipt>'
)}


//include ContentsFirstTime
function FirstTime(){
document.write(
	'<scr'+'ipt type="text/javascript">' +
	'$(document).ready(function() {' +
		'var t = "使ってみよう";' +
		'var a = "first_time.html?width=370&height=280";' +
		'var g = false;' +
		'tb_show(t, a, g);' +
//		'link.blur();' +
		'return false;' +
	'});' +
	'</scr'+'ipt>'
)}


//include ContentsFirstTime
function Error(){
document.write(
	'<link rel="stylesheet" type="text/css" href="/themed/member/css/error.css" media="all" />' +
	'<scr'+'ipt type="text/javascript">' +
	'$(document).ready(function() {' +
		'var t = "ERROR";' +
		'var a = "error.html?width=370&height=280";' +
		'var g = false;' +
		'tb_show(t, a, g);' +
//		'link.blur();' +
		'return false;' +
	'});' +
	'</scr'+'ipt>'
)}



// pop up window
function html(w,h,html,target) {
	var w1;
	w1 = window.open("", target,"toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no, width="+w+",height="+h);
	w1.location.href=html
	w1.focus();
}


//SmartRollover
function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_off."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_off.", "_ov."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_ov.", "_off."));
				}
			}
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);
}


/* ----------------------------------------------------------
 * yuga.js 0.7.1 - 優雅なWeb制作のためのJS
 *
 * Copyright (c) 2009 Kyosuke Nakamura (kyosuke.jp)
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * Since:     2006-10-30
 * Modified:  2009-01-27
 *
 * jQuery 1.3.1
 * ThickBox 3.1
---------------------------------------------------------- */
(function($) {
	$(function() {
		$.yuga.scroll();
		$.yuga.stripe();
		$.yuga.css3class();
	});

	//---------------------------------------------------------------------

	$.yuga = {
		// URIを解析したオブジェクトを返すfunction
		Uri: function(path){
			var self = this;
			this.originalPath = path;
			//絶対パスを取得
			this.absolutePath = (function(){
				var e = document.createElement('span');
				e.innerHTML = '<a href="' + path + '" />';
				return e.firstChild.href;
			})();
			//絶対パスを分解
			var fields = {'schema' : 2, 'username' : 5, 'password' : 6, 'host' : 7, 'path' : 9, 'query' : 10, 'fragment' : 11};
			var r = /^((\w+):)?(\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/.exec(this.absolutePath);
			for (var field in fields) {
				this[field] = r[fields[field]];
			}
			this.querys = {};
			if(this.query){
				$.each(self.query.split('&'), function(){
					var a = this.split('=');
					if (a.length == 2) self.querys[a[0]] = a[1];
				});
			}
		},
		//ページ内リンクはするするスクロール
		scroll: function(options) {
			//ドキュメントのスクロールを制御するオブジェクト
			var scroller = (function() {
				var c = $.extend({
					easing:100,
					step:30,
					fps:60,
					fragment:''
				}, options);
				c.ms = Math.floor(1000/c.fps);
				var timerId;
				var param = {
					stepCount:0,
					startY:0,
					endY:0,
					lastY:0
				};
				//スクロール中に実行されるfunction
				function move() {
					if (param.stepCount == c.step) {
						//スクロール終了時
						setFragment(param.hrefdata.absolutePath);
						window.scrollTo(getCurrentX(), param.endY);
					} else if (param.lastY == getCurrentY()) {
						//通常スクロール時
						param.stepCount++;
						window.scrollTo(getCurrentX(), getEasingY());
						param.lastY = getEasingY();
						timerId = setTimeout(move, c.ms); 
					} else {
						//キャンセル発生
						if (getCurrentY()+getViewportHeight() == getDocumentHeight()) {
							//画面下のためスクロール終了
							setFragment(param.hrefdata.absolutePath);
						}
					}
				}
				function setFragment(path){
					location.href = path
				}
				function getCurrentY() {
					return document.body.scrollTop	|| document.documentElement.scrollTop;
				}
				function getCurrentX() {
					return document.body.scrollLeft  || document.documentElement.scrollLeft;
				}
				function getDocumentHeight(){
					return document.documentElement.scrollHeight || document.body.scrollHeight;
				}
				function getViewportHeight(){
					return (!$.browser.safari && !$.browser.opera) ? document.documentElement.clientHeight || document.body.clientHeight || document.body.scrollHeight : window.innerHeight;
				}
				function getEasingY() {
					return Math.floor(getEasing(param.startY, param.endY, param.stepCount, c.step, c.easing));
				}
				function getEasing(start, end, stepCount, step, easing) {
					var s = stepCount / step;
					return (end - start) * (s + easing / (100 * Math.PI) * Math.sin(Math.PI * s)) + start;
				}
				return {
					set: function(options) {
						this.stop();
						if (options.startY == undefined) options.startY = getCurrentY();
						param = $.extend(param, options);
						param.lastY = param.startY;
						timerId = setTimeout(move, c.ms); 
					},
					stop: function(){
						clearTimeout(timerId);
						param.stepCount = 0;
					}
				};
			})();
			$('a[href^=#], area[href^=#]').not('a[href=#], area[href=#]').each(function(){
				this.hrefdata = new $.yuga.Uri(this.getAttribute('href'));
			}).click(function(){
				var target = $('#'+this.hrefdata.fragment);
				if (target.length == 0) target = $('a[name='+this.hrefdata.fragment+']');
				if (target.length) {
					scroller.set({
						endY: target.offset().top,
						hrefdata: this.hrefdata
					});
					return false;
				}
			});
		},
		//奇数、偶数を自動追加
		stripe: function(options) {
			var c = $.extend({
				oddClass:'odd',
				evenClass:'even'
			}, options);
			$('ul, ol').each(function(){
				//JSでは0から数えるのでevenとaddを逆に指定
				$(this).children('li:odd').addClass(c.evenClass);
				$(this).children('li:even').addClass(c.oddClass);
			});
			$('table, tbody').each(function(){
				$(this).children('tr:odd').addClass(c.evenClass);
				$(this).children('tr:even').addClass(c.oddClass);
			});
		},
		//css3のクラスを追加
		css3class: function() {
			//:first-child, :last-childをクラスとして追加
			$('body :first-child').addClass('firstChild');
			$('body :last-child').addClass('lastChild');
			//css3の:emptyをクラスとして追加
			$('body :empty').addClass('empty');
		}
	};
})(jQuery);



////////////////////////////////////////////////////
//
//　Thickbox<Title> ELEMENTS
//
////////////////////////////////////////////////////
$(function(){
//	$("body *").filter(function(){
	$(".thickbox_er").filter(function(){
		return this.title && this.title.length > 0;
	}).each(function(){
		var self = $(this), title = self.attr("title");
		self.hover(function(e){
				self.attr("title","");
			},
			function(){
				self.attr("title",title);
			});

		self.click(function(e){
				self.attr("title",title);
		});


	});
});



