
// function body

	$(function() {
			   
		$("img.mover").mouseover(function(){
        	$(this).attr("src",$(this).attr("src").replace("_off.gif", "_on.gif"))
   		 }).mouseout(function(){
        	$(this).attr("src",$(this).attr("src").replace("_on.gif", "_off.gif"));
		}).each(function(){
			$("<img>").attr("src",$(this).attr("src").replace("_l.jpg", "_on.gif"))
   		 })
		
		orgImage = $('#item0').attr('src');
		orgHref = $('#keyVisual').attr('href');
		orgTarget = $('#keyVisual').attr('target');
		orgAlt = $('#item0').attr('alt');
	});

	var originalHyperReference = "";
	var originalTarget = "";
	var theIndex = 1;
	var fadeSpd = 200;


	function over(obj) {
		//alert("over");
		document.getElementById('keyVisual').href = obj.parentNode.href;
		document.getElementById('keyVisual').target = obj.parentNode.target;
		if ( originalHyperReference == "" ) {
			originalHyperReference = document.getElementById('keyVisual').href;
			originalTarget = document.getElementById('keyVisual').target;
		}
		if ( window.timer ) {
			clearTimeout(timer);
		}
		var item = document.createElement('img');
		item.src = "_shared/top/" + obj.src.split('_shared/top/')[1].replace('_off.gif','_l.jpg');
		item.alt = obj.alt;
		item.id = "item" + theIndex;
		item.style.zIndex = theIndex;
		$('#keyVisual').append(item);
		$('#item'+(theIndex))
			.hide()
			.fadeIn(fadeSpd);
		theIndex++;
	}

	function out(obj) {
		obj.parentNode.removeChild(obj);
		startTimer();
	}

	function stopTimer() {
		if ( window.timer ) clearTimeout(timer);
	}

	function startTimer() {
		timer = setTimeout("backToOrigin()",3000);
	}

	function backToOrigin() {
		stopTimer();
		var item = document.createElement('img');
		item.src = orgImage;
		item.alt = orgAlt;
		item.id = "item" + theIndex;
		item.style.zIndex = theIndex;
		if (orgHref != undefined ) {
			$('#keyVisual').attr('href',orgHref);
		} else {
			$('#keyVisual').removeAttr('href');
		}
		$('#keyVisual').append(item);
		$('#item'+(theIndex))
			.hide()
			.fadeIn(fadeSpd*2);
		theIndex++;
	}

