//########################//
//## 動画 Flashタグ挿入 ##//
//########################//
var PromotionVideo = {
	'init' : function(file, sizeX, sizeY, flv, jump) {
		var parent = document.getElementById("info-push-unit");
		var div = document.createElement("div");
		div.setAttribute("id", "pv");
		
		var h4 = document.createElement("h4");
		h4.innerHTML = 'ニューリリース';
		
		parent.appendChild(h4);
        
		if(YAHOO.env.ua.ie) {
			div.innerHTML += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + sizeX + '" height="' + sizeY + '"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="' + file + '" /><param name="quality" value="high" /><param name="wmode" value="opaque" /><param name="FlashVars" value="flvPath=' + flv + '&jumpURL=' + jump + '" /></object>';
        } else {
            var wrapper = document.createElement("div");
            var embed = document.createElement("embed");
            
            embed.setAttribute("src", file);
            embed.setAttribute("quality", "high");
            embed.setAttribute("wmode", "opaque");
            embed.setAttribute("width", sizeX);
            embed.setAttribute("height", sizeY);
            embed.setAttribute("FlashVars", 'flvPath=' + flv + '&jumpURL=' + jump);
            embed.setAttribute("allowScriptAccess", "sameDomain");
            embed.setAttribute("type", "application/x-shockwave-flash");
            embed.setAttribute("pluginspage", "http://www.macromedia.com/go/getflashplayer");
            
            wrapper.appendChild(embed);
            div.appendChild(wrapper);
        }
        parent.appendChild(div);
    }
};

//##############//
//## 更新履歴 ##//
//##############//
var Modified = {
	'option' : {
		'maxHeight' : 225,
		'overflow' : false,
		'touchID' : setTimeout("", 50),
		'delayID' : setTimeout("", 5000),
		'memory' : 0,
		'limit' : 30,
		'k' : 0.3
	},
	
	'init' : function() {
		if(document.getElementById("modified")) {
			var that = this;
			
			var parent = document.getElementById("modified");
			
			if(parent.getElementsByTagName("UL")[0]) {
				var ulTag = parent.getElementsByTagName("UL")[0];
				var liTags = ulTag.getElementsByTagName("LI");
				var aTags = ulTag.getElementsByTagName("A");
				
				parent.rollID = setTimeout("", 40);
				
				this.check(liTags);
				
				parent.defaultHeight = ulTag.scrollHeight;
				if(parent.defaultHeight > this.option.maxHeight) {
					this.option.overflow = true;
					parent.defaultHeight = this.option.maxHeight;
				}
				
				for(var i = 0, len_i = liTags.length; i < len_i; i++) {
					liTags[i].no = i;
					liTags[i].moveXID = setTimeout("", 40);
					
					if(i != len_i - 1) {
						liTags[i].next = liTags[i + 1];
					} else {
						liTags[i].next = liTags[0];
					}
					
					Scroller.init(liTags[i]);
				}
				
				if(liTags.length > 0) {
					parent.touched = false;
					
					ulTag.opacity = 0;
					ulTag.fadeInID = setTimeout("", 40);
					
					parent.onmouseover = function() {
						clearTimeout(this.rollID);
						clearTimeout(that.option.touchID);
						clearTimeout(that.option.delayID);
						
						if(!this.touched && liTags.length != 1) {
							this.touched = true;
							
							ulTag.opacity = 0;
							ulTag.fadeInID = that.fadeIn(ulTag);
							
							that.clear();
						}
						
						if(that.option.overflow) this.style.overflow = "auto";
						this.rollID = that.roll(this, parent.defaultHeight);
						
						for(var i = 0, len_i = aTags.length; i < len_i; i++) {
							aTags[i].style.textDecoration = "underline";
						}
					}
					parent.onmouseout = function() {
						var self = this;
						
						clearTimeout(this.rollID);
						clearTimeout(that.option.touchID);
						clearTimeout(that.option.delayID);
						
						that.option.touchID = setTimeout(function() {
							self.touched = false;
							if(liTags.length != 1) that.start();
							
							if(that.option.overflow) self.style.overflow = "hidden";
							self.rollID = that.roll(self, liTags[that.option.memory].offsetHeight);
							
							for(var i = 0, len_i = aTags.length; i < len_i; i++) {
								aTags[i].style.textDecoration = "none";
							}
						}, 50);
					}
					
					parent.style.height = liTags[this.option.memory].offsetHeight + "px";
					
					this.start();
					
					parent.style.visibility = "visible";
					
					ulTag.style.height = "auto";
					
					this.fineScrollPlus();
				}
			}
		}
	},
	
	'check' : function(array) {
		var skip = false;
		var notInfo = 0;
		
		var re = new RegExp("[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]");
		var re2 = new RegExp("［information］");
		
		for(var i = 0; i < array.length; i++) {
			if(GET.className(array[i])) {
				
				if(GET.className(array[i]).match(/^del_\d\d\d\d-\d\d-\d\d/)) {
					var parts = GET.className(array[i]).split(" ");
					
					parts[0] = parts[0].replace("del_", "");
					var YMD = parts[0].split("-");
					if(typeof parts[1] != 'undefined') {
						if(parts[1].match(/^\d\d:\d\d:\d\d$/)) {
							var HMS = parts[1].split(":");
							var d = new Date(YMD[0], YMD[1]-1, YMD[2], HMS[0], HMS[1], HMS[2]);
						} else {
							var d = new Date(YMD[0], YMD[1]-1, YMD[2]);
						}
					} else {
						var d = new Date(YMD[0], YMD[1]-1, YMD[2]);
					}
					
					if(serverTime > d.getTime()) {
						array[i].parentNode.removeChild(array[i--]);
					} else {
						if(re2.exec(array[i].innerHTML) != null) {
							if(!skip) {
								this.option.memory++;
							}
						} else {
							skip = true;
							notInfo++;
						}
					}
				}
			} else {
				if(re.exec(array[i].innerHTML) != null) {
					var string = re.exec(array[i].innerHTML);
					var dateValue = string[0].split("-");
					var targetDate = new Date(dateValue[0], dateValue[1]-1, dateValue[2]);
					
					if(serverTime - targetDate.getTime() > this.option.limit * 24 * 60 * 60 * 1000) {
						array[i].parentNode.removeChild(array[i--]);
					} else {
						skip = true;
						notInfo++;
					}
				} else if(re2.exec(array[i].innerHTML) != null) {
					if(!skip) {
						this.option.memory++;
					}
				}
			}
		}
		
		if(notInfo == 0) this.option.memory = 0;
	},
	
	'start' : function() {
		var that = this;
		
		var parent = document.getElementById("modified");
		var ulTag = parent.getElementsByTagName("UL")[0];
		var liTags = parent.getElementsByTagName("LI");
		
		for(var i = 0, len_i = liTags.length; i < len_i; i++) {
			liTags[i].style.left = parent.offsetWidth + "px";
			
			if(i != this.option.memory) {
				liTags[i].style.position = "absolute";
			} else {
				liTags[i].style.position = "relative";
			}
		}
		
		liTags[this.option.memory].moveXID = this.moveX(liTags[this.option.memory], 0);
	},
	
	'clear' : function() {
		var that = this;
		
		var parent = document.getElementById("modified");
		var ulTag = parent.getElementsByTagName("UL")[0];
		var liTags = ulTag.getElementsByTagName("LI");
		
		for(var i = 0, len_i = liTags.length; i < len_i; i++) {
			clearTimeout(liTags[i].moveXID);
			
			liTags[i].style.position = "relative";
			liTags[i].style.left = 0;
		}
	},
	
	'moveX': function(obj, end) {
		var that = this;
		
		var parent = document.getElementById("modified");
		var ulTag = parent.getElementsByTagName("UL")[0];
		var liTags = parent.getElementsByTagName("LI");
		
		var speed = 0;
		var tempPos = parseInt(GET.style(obj, "left"));
		
		if(Math.abs(tempPos - end) > 1) {
			speed = (end - tempPos) * this.option.k;
			speed > 0 ? speed = Math.ceil(speed) : speed = Math.floor(speed);
			
			obj.style.left = tempPos + speed + "px";
			
			return setTimeout(function() {
				obj.moveXID = that.moveX(obj, end);
			}, 40);
		} else {
			clearTimeout(obj.moveXID);
			
			if(liTags.length > 1) {
				this.option.delayID = setTimeout(function() {
					obj.style.position = "absolute";
					obj.style.left = parent.offsetWidth + "px";
					
					that.option.memory = obj.next.no;
					obj.next.style.position = "relative";
					obj.next.moveXID = that.moveX(obj.next, 0);
				}, 5000);
			}
		}
	},
	
	'roll': function(obj, end) {
		var that = this;
		
		var speed = 0;
		var tempHeight = parseInt(GET.style(obj, "height"));
		
		if(Math.abs(tempHeight - end) > 1) {
			speed = (end - tempHeight) * this.option.k;
			speed > 0 ? speed = Math.ceil(speed) : speed = Math.floor(speed);
			
			obj.style.height = tempHeight + speed + "px";
			
			return setTimeout(function() {
				obj.rollID = that.roll(obj, end);
			}, 40);
		} else {
			clearTimeout(obj.rollID);
			
			obj.style.height = end + "px";
		}
	},
	
	'fadeIn': function(obj) {
		var that = this;
		
		if(obj.opacity <= 10) {
			if(YAHOO.env.ua.ie)     obj.style.filter = 'alpha(opacity=' + obj.opacity * 10 + ')'; // IE
			obj.style.MozOpacity = obj.opacity / 10; // Firefox
			obj.style.opacity = obj.opacity / 10; // Safari
			obj.opacity += 1;
			
			return setTimeout(function() {
				obj.fadeInID = that.fadeIn(obj);
			}, 40);
		} else {
			clearTimeout(obj.fadeInID);
			if(YAHOO.env.ua.ie) obj.style.removeAttribute('filter');
		}
	},
   	
   	'fineScrollPlus' : function() {
		var parent = document.getElementById("modified");
		var aTags = parent.getElementsByTagName("A");
		
		for(var i = 0, len_i = aTags.length; i < len_i; i++) {
			if(aTags[i].getAttribute("href") && aTags[i].getAttribute("href").match(/#/)) {
				aTags[i].baseURL  = aTags[i].getAttribute("href").replace(/(.*)#(.+)$/i, "$1");
				aTags[i].targetID = aTags[i].getAttribute("href").replace(/(.*)#(.+)$/i, "$2");
				
				if((location.href).indexOf(aTags[i].baseURL) != -1) {
					aTags[i].onclick = function() {
						clearInterval(FineScroll.option.intervalID);
						
						if(document.getElementById(this.targetID)) {
							var target = document.getElementById(this.targetID);
							while(!target || target.nodeName != "DL") {
								target = target.parentNode;
							}
							
							if(target.info) {
								if(!target.info.isOpened) {
									target.dt.style.fontWeight = target.date.style.fontWeight = "bold";
									target.dt.style.color = target.date.style.color = TopicsSlider.option.selectedColor;
									target.info.isOpened = true;
									target.info.style.height = "auto";
								}
							}
							FineScroll.option.intervalID = FineScroll.setFunc(this.targetID);
						}
						return false;
					}
				}
			}
		}
	}
};

//##################//
//## コントロール ##//
//##################//
var CtrlInfoOtherUnit = {
	'option' : {
		'hotInfoHeight' : 0,      //親要素 #hot-info の高さ
		'always'        : 1,      //常に表示する li要素 の数（上から）
		'maxHeight'     : 380,    //#info-other-unit 最大サイズ
		'marginBottom'  : 0,     //#info-other-unit の初期位置（#hot-infoの最下端より）
		'overflow'      : false,  //親要素 #hot-info からはみでてしまうか。
		'k'             :  0.2    //アニメーション係数
	},
	
	'init': function() {
		var that = this;
		
		if(document.getElementById("hot-info") && document.getElementById("info-other-unit")) {
			var parent = document.getElementById("hot-info");
			this.option.hotInfoHeight = parent.offsetHeight;
			
			var target = document.getElementById("info-other-unit");
			target.openID = setTimeout("", 40);
			target.touchID = setTimeout("", 40);
			
			var targetBorderTopWidth = 0;
			if(parseInt(GET.style(target, "border-top-width"))) targetBorderTopWidth = parseInt(GET.style(target, "border-top-width"));
			
			var targetBorderBottomWidth = 0;
			if(parseInt(GET.style(target, "border-bottom-width"))) targetBorderBottomWidth = parseInt(GET.style(target, "border-bottom-width"));
			
			target.defaultHeight = target.offsetHeight + targetBorderTopWidth + targetBorderBottomWidth;
			
			if(this.option.marginBottom * 2 + target.defaultHeight > this.option.maxHeight) {
				this.option.overflow = true;
				target.defaultHeight = this.option.maxHeight;
			}
			
			//ブログをチェック
			var tempATags = target.getElementsByTagName("A");
			for(var i = 0, len_i = tempATags.length; i < len_i; i++) {
				if(tempATags[i].getAttribute("rel") && tempATags[i].getAttribute("rel").match(/^http/)) {
					this.check(tempATags[i].parentNode, tempATags[i].getAttribute("rel"));
				}
			}
			
			var liTags = target.getElementsByTagName("LI");
			
			var displayHeight = 0;
			for(var i = 0; i < this.option.always; i++) {
				(function() {
					var temp = liTags[i];
					
					var tempBorderTopWidth = 0;
					if(parseInt(GET.style(temp, "border-top-width"))) tempBorderTopWidth = parseInt(GET.style(temp, "border-top-width"));
					
					var tempBorderBottomWidth = 0;
					if(parseInt(GET.style(temp, "border-bottom-width"))) tempBorderBottomWidth = parseInt(GET.style(temp, "border-bottom-width"));
					
					var tempMarginTop = 0;
					if(parseInt(GET.style(temp, "margin-top"))) tempMarginTop = parseInt(GET.style(temp, "margin-top"));
					
					var tempMarginBottom = 0;
					if(parseInt(GET.style(temp, "margin-bottom"))) tempMarginBottom = parseInt(GET.style(temp, "margin-bottom"));
					
					displayHeight += temp.offsetHeight + tempMarginTop + tempMarginBottom + tempBorderTopWidth + tempBorderBottomWidth;
				})();
			}
			
			if(liTags.length > 1) {
				target.onmouseover = function() {
					clearTimeout(this.touchID);
					clearTimeout(this.openID);
					
					if(that.option.overflow) this.style.overflow = "auto";
					this.openID = that.open(this, that.option.hotInfoHeight - this.defaultHeight - that.option.marginBottom, this.defaultHeight);
				}
				
				target.onmouseout = function() {
					var self = this;
					
					clearTimeout(this.openID);
					clearTimeout(this.touchID);
					
					this.touchID = setTimeout(function() {
						if(that.option.overflow) self.style.overflow = "hidden";
						self.scrollTop = 0;
						self.openID = that.open(self, that.option.hotInfoHeight - displayHeight - that.option.marginBottom, displayHeight);
					}, 500);
				}
			}
			
			target.style.zoom = 1;
			target.style.overflow = "hidden";
			target.style.height = displayHeight + "px";
			target.style.top = this.option.hotInfoHeight - displayHeight - this.option.marginBottom + "px";
			target.style.marginBottom = this.option.hotInfoHeight - displayHeight - this.option.marginBottom + "px";
			
			target.style.visibility = "visible";
		}
	},
	
	'open': function(obj, endPosY, endHeight) {
		var that = this;
		
		var speed = 0;
		var tempPosY = parseInt(GET.style(obj, "top"));
		var tempHeight = parseInt(GET.style(obj, "height"));
		
		if(Math.abs(tempPosY - endPosY) > 1 || Math.abs(tempHeight - endHeight) > 1) {
			if(Math.abs(tempPosY - endPosY) > 1) {
				speed = (endPosY - tempPosY) * this.option.k;
				speed > 0 ? speed = Math.ceil(speed) : speed = Math.floor(speed);
				
				obj.style.top = tempPosY + speed + "px";
				obj.style.marginBottom = -(tempPosY + speed) + "px";
			}
			
			if(Math.abs(tempHeight - endHeight) > 1) {
				speed = (endHeight - tempHeight) * this.option.k;
				speed > 0 ? speed = Math.ceil(speed) : speed = Math.floor(speed);
				
				obj.style.height = tempHeight + speed + "px";
			}
			
			return setTimeout(function() {
				obj.openID = that.open(obj, endPosY, endHeight);
			}, 40);
		} else {
			clearTimeout(obj.openID);
			
			obj.style.top = endPosY + "px";
			obj.style.height = endHeight + "px";
		}
	},
	
	'check' : function(target, url) {
		var that = this;
		
		var parent = document.getElementById("info-other-unit");
		
		var span = document.createElement("span");
		span.className = "article";
		
		if(window.XMLHttpRequest) {
			var message = new XMLHttpRequest;
		} else if(window.ActiveXObject) {
			try {
				var message = new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
				var message = new ActiveXObject("Microsoft.XMLHTTP");
			}
		} else {
			return null;
		}
		
		message.onreadystatechange = function() {
			if(message.readyState == 4) {
				if(message.status == 200) {
					span.innerHTML = message.responseText;
					target.appendChild(span);
				} else {
					span.innerHTML = 'ブログの読み込みに失敗しました。';
					target.appendChild(span);
				}
			} else {
				span.innerHTML = 'ブログチェック中...';
				target.appendChild(span);
			}
		}
		if(url) {
			try {
				var dummyTime = (new Date()).getTime();
				
				if(GET.className(target) === "episode") {
					message.open('GET', "./script/original/get_episode.php?t=" + dummyTime, true);
				} else {
					message.open('GET', "./script/original/get_blog.php?url=" + url + "&t=" + dummyTime, true);
				}
				message.send(null);
			} catch(e) {
				span.innerHTML = 'データの読み込みに失敗しました。';
				target.appendChild(span);
			}
		}
	}
};

//############################//
//## クイックリンク機能追加 ##//
//############################//
var CtrlQuickLink = {
	'init' : function() {
		if(document.getElementById("info-quicklink-unit")) {
			var parent = document.getElementById("info-quicklink-unit");
			var aTags = parent.getElementsByTagName("A");
			
			for(var i = 0, len_i = aTags.length; i < len_i; i++) {
				if(aTags[i].getAttribute("href") && aTags[i].getAttribute("href").match(/#/)) {
					aTags[i].baseURL  = aTags[i].getAttribute("href").replace(/(.*)#(.+)$/i, "$1");
					aTags[i].targetID = aTags[i].getAttribute("href").replace(/(.*)#(.+)$/i, "$2");
					
					if((location.href).indexOf(aTags[i].baseURL) != -1) {
						aTags[i].onclick = function() {
							clearInterval(FineScroll.option.intervalID);
							
							if(document.getElementById(this.targetID)) {
								var target = document.getElementById(this.targetID);
								while(!target || target.nodeName != "DL") {
									target = target.parentNode;
								}
								
								if(target.info) {
									if(!target.info.isOpened) {
										target.dt.style.fontWeight = target.date.style.fontWeight = "bold";
										target.dt.style.color = target.date.style.color = TopicsSlider.option.selectedColor;
										target.info.isOpened = true;
										target.info.style.height = "auto";
									}
								}
								FineScroll.option.intervalID = FineScroll.setFunc(this.targetID);
							}
							return false;
						}
					}
				}
			}
		}
	}
};

//########################//
//## トピックスライダー ##//
//########################//
var TopicsSlider = {
	'option': {
		'minHeight' : 1,
		'baseColor' : "#333333",
		'selectedColor' : "#ff0000",
		'k' : 0.4
	},
	
	'init' : function() {
		var that = this;
		
		if(typeof document.body.style.maxHeight != "undefined") this.option.minHeight = 0;
		
		var parent = document.getElementById("topics");
		var dlTags = parent.getElementsByTagName("DL");
		
		for(var i = 0; i < dlTags.length; i++) {
			if(GET.className(dlTags[i])) {
				if(GET.className(dlTags[i]).match(/^del_\d\d\d\d-\d\d-\d\d/)) {
					var parts = GET.className(dlTags[i]).split(" ");
					
					parts[0] = parts[0].replace("del_", "");
					var YMD = parts[0].split("-");
					if(typeof parts[1] != 'undefined') {
						if(parts[1].match(/^\d\d:\d\d:\d\d$/)) {
							var HMS = parts[1].split(":");
							var d = new Date(YMD[0], YMD[1]-1, YMD[2], HMS[0], HMS[1], HMS[2]);
						} else {
							var d = new Date(YMD[0], YMD[1]-1, YMD[2]);
						}
					} else {
						var d = new Date(YMD[0], YMD[1]-1, YMD[2]);
					}
					
					if(serverTime > d.getTime()) {
						dlTags[i].parentNode.removeChild(dlTags[i--]);
						continue;
					}
				}
			}
			
			dlTags[i].dt = dlTags[i].getElementsByTagName("DT")[0];
			dlTags[i].dt.paddingLeft = parseInt(GET.style(dlTags[i].dt, "padding-left"));
			
			typeof document.body.style.minWidth != "undefined" ? dlTags[i].dt.style.cursor = "pointer" : dlTags[i].dt.style.cursor = "hand";
			
			var tempNodes = dlTags[i].getElementsByTagName("DD");
			for(var j = 0, len_j = tempNodes.length; j < len_j; j++) {
				if(GET.className(tempNodes[j]).match(/date/)) {
					dlTags[i].date = tempNodes[j];
					continue;
				}
				
				if(GET.className(tempNodes[j]) == "info") {
					dlTags[i].info = tempNodes[j];
					dlTags[i].info.style.overflow = "hidden";
					dlTags[i].info.defaultHeight = dlTags[i].info.scrollHeight;
					dlTags[i].info.rollID = setTimeout("", 40);
					dlTags[i].info.isMoveing = false;
					dlTags[i].info.angle = 0;
					
					if(dlTags[i].date && GET.className(dlTags[i].date).match(/always/)) {
						dlTags[i].info.isOpened = true;
						dlTags[i].dt.style.fontWeight = dlTags[i].date.style.fontWeight = "bold";
						dlTags[i].dt.style.color = dlTags[i].date.style.color = this.option.selectedColor;
						dlTags[i].info.style.height = "auto";
					} else if(dlTags[i].date.innerHTML.match(/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]/)) {
						var dateValue = dlTags[i].date.innerHTML.split("-")
						var targetDate = new Date(dateValue[0], dateValue[1]-1, dateValue[2]);
						
						if (serverTime - targetDate.getTime() < 1 * 24 * 60 * 60 * 1000) {
							dlTags[i].info.isOpened = true;
							dlTags[i].dt.style.fontWeight = dlTags[i].date.style.fontWeight = "bold";
							dlTags[i].dt.style.color = dlTags[i].date.style.color = this.option.selectedColor;
							dlTags[i].info.style.height = "auto";
						} else {
							dlTags[i].info.isOpened = false;
							dlTags[i].info.style.height = this.option.minHeight + "px";
						}
					} else {
						dlTags[i].info.isOpened = false;
						dlTags[i].info.style.height = this.option.minHeight + "px";
					}
					continue;
				}
			}
			
			dlTags[i].dt.onclick = function() {
				if(!this.parentNode.info.isMoveing) {
					clearTimeout(this.parentNode.info.rollID);
					
					this.parentNode.info.isMoveing = true;
					this.parentNode.info.angle = 0;
					
					this.parentNode.info.style.height = this.parentNode.info.offsetHeight + "px";
					
					if(this.parentNode.info.isOpened) {
						this.style.fontWeight = this.parentNode.date.style.fontWeight = "normal";
						this.style.color = this.parentNode.date.style.color = that.option.baseColor;
						this.parentNode.info.rollID = that.roll(this.parentNode.info, that.option.minHeight);
					} else {
						this.style.fontWeight = this.parentNode.date.style.fontWeight = "bold";
						this.style.color = this.parentNode.date.style.color = that.option.selectedColor;
						this.parentNode.info.rollID = that.roll(this.parentNode.info, this.parentNode.info.defaultHeight);
					}
				}
			}
			
			if(window.addEventListener) {
				dlTags[i].dt.addEventListener("mouseover", function() {
					var charSize = that.getCharLen(this);
					
					if(charSize + this.paddingLeft > this.offsetWidth) {
						this.style.backgroundImage = "none";
					}
				}, false);
				
				dlTags[i].dt.addEventListener("mouseout", function() {
					this.style.backgroundImage = "url(./img/basic/icon_topic.gif)";
				}, false);
			} else if(window.attachEvent) {
				dlTags[i].dt.attachEvent("onmouseover", function() {
					var charSize = that.getCharLen(event.srcElement);
						
					if(charSize + event.srcElement.paddingLeft > event.srcElement.offsetWidth) {
						event.srcElement.style.backgroundImage = "none";
					}
				});
				
				dlTags[i].dt.attachEvent("onmouseout", function() {
					event.srcElement.style.backgroundImage = "url(./img/basic/icon_topic.gif)";
				});
			}
			
			if(location.href.match(/\?anchor=/)) {
				var query = location.search.substring(1); 
				var temp = query.split("=");
				
				if(temp[temp.length - 1] == dlTags[i].dt.getAttribute("id")) {
					dlTags[i].dt.style.fontWeight = dlTags[i].date.style.fontWeight = "bold";
					dlTags[i].dt.style.color = dlTags[i].date.style.color = this.option.selectedColor;
					dlTags[i].info.isOpened = true;
					dlTags[i].info.style.height = "auto";
				}
	   	 	}
	   	 	
	   	 	Scroller.init(dlTags[i].dt);
		}
		this.fineScrollPlus();
	},
	
	'roll': function(obj, end) {
		var that = this;
		
		var speed;
		var tempHeight;
		
		tempHeight = parseInt(GET.style(obj, "height"));
		if(Math.abs(tempHeight - end) > 1) {
			speed = (end - tempHeight) * (Math.sin(Math.PI / 180 * obj.angle));
			speed > 0 ? speed = Math.ceil(speed) : speed = Math.floor(speed);
			
			obj.style.height = tempHeight + speed + "px";
			
			obj.angle += 3;
			
			return setTimeout(function() {
				obj.rollID = that.roll(obj, end);
			}, 40);
		} else {
			clearTimeout(obj.touchID);
			
			obj.isMoveing = false;
			obj.isOpened = !obj.isOpened;
			
			if(obj.isOpened) {
				obj.style.height = "auto";
			} else {
				obj.style.height = end + "px";
			}
		}
	},
	
	'getCharLen': function(obj) {
   		var charSize = 0;
   		
   		var span = document.createElement("span");
		var text = document.createTextNode(obj.innerHTML.replace(/<!--.*-->|<\/?[^>]+>/gi, ""));
		span.appendChild(text);
		
		obj.appendChild(span);
		charSize = span.offsetWidth;
		obj.removeChild(span);
		
		return charSize;
   	},
   	
   	'fineScrollPlus' : function() {
		var parent = document.getElementById("topics");
		var aTags = parent.getElementsByTagName("A");
		
		for(var i = 0, len_i = aTags.length; i < len_i; i++) {
			if(aTags[i].getAttribute("href") && aTags[i].getAttribute("href").match(/#/)) {
				aTags[i].baseURL  = aTags[i].getAttribute("href").replace(/(.*)#(.+)$/i, "$1");
				aTags[i].targetID = aTags[i].getAttribute("href").replace(/(.*)#(.+)$/i, "$2");
				
				if((location.href).indexOf(aTags[i].baseURL) != -1) {
					aTags[i].onclick = function() {
						clearInterval(FineScroll.option.intervalID);
						
						if(document.getElementById(this.targetID)) {
							var target = document.getElementById(this.targetID);
							while(!target || target.nodeName != "DL") {
								target = target.parentNode;
							}
							
							if(target.info) {
								if(!target.info.isOpened) {
									target.dt.style.fontWeight = target.date.style.fontWeight = "bold";
									target.dt.style.color = target.date.style.color = TopicsSlider.option.selectedColor;
									target.info.isOpened = true;
									target.info.style.height = "auto";
								}
							}
							FineScroll.option.intervalID = FineScroll.setFunc(this.targetID);
						}
						return false;
					}
				}
			}
		}
	}
};

//####################//
//## ジャケット浮遊 ##//
//####################//
var FloatingBanner = {
	'init': function() {
		var that = this;
		
		if(document.getElementById("banner")) {
			var target = document.getElementById("banner");
			target.defaultTop = GET.posY(target);
			target.style.top =  GET.style(target, "top");
			target.amplitude = 2; //振幅
			target.calcY = 0;
			
			target.timerID = setInterval(function() {
				that.move(target);
			}, 150);
		}
	},
	
	'move' : function(obj) {
		obj.calcY = obj.calcY * 1 + (obj.defaultTop - obj.amplitude - GET.posY(obj)) * 0.30;
		obj.style.top = parseInt(obj.style.top) + obj.calcY + "px";
	}
};

//####################//
//## イニシャライズ ##//
//####################//
YAHOO.util.Event.onDOMReady(function() {
	if(YAHOO.env.ua.ie && YAHOO.env.ua.ie < 7) {
		DD_belatedPNG.fix('#modified');
		DD_belatedPNG.fix('#info-other-unit');
	}
	
	Modified.init();
	CtrlInfoOtherUnit.init();
	CtrlQuickLink.init();
	TopicsSlider.init();
	
	FloatingBanner.init();
});
