/*
5digistar株式会社 [ActionBrowserサービス] 
Email： support@5digistar.co.jp 
URL： http://www.5digistar.co.jp/ 

Copyright (C) 2005 5digistar Inc. All Rights Reserved.
*/

var aLinks = new Array();
var aMedia = new Array();

function showLinks()
{	
	delLinks();
	delZoomLinks();
	delZoomLinks3();
	
	if(getLinkFileName(AB.IndexCurrentPage) != AB.CurrentLinkXML)
		importLinkXML();		
	else
		createLinks();
}

function showZoomLinks()
{
	delLinks();
	delZoomLinks3();
	createZoomLinks();
}

function showZoomLinks3()
{
	delLinks();
	delZoomLinks();		
	createZoomLinks3();
}

function importLinkXML()
{
	if (window.ActiveXObject)
	{
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); 
		xmlDoc.onreadystatechange = function () { if (xmlDoc.readyState == 4) setLinkValues(); };
 	}
	else
	{
		alert('InternetExplorer6.0以上をご利用ください。');	return;
	}
	xmlDoc.load("../data/"+getLinkFileName(AB.IndexCurrentPage));
}

function getLinkFileName(aNum)
{
	var pagenum = parseInt(aNum/10,10);
	var mod = aNum%10;

	if(pagenum>0)
	{
		if(mod>0)
			return "link"+pagenum+".xml";
		else
			return "link"+(pagenum-1)+".xml";
	}
	else
		return "link0.xml";		
}

function setLinkValues()
{
	if (!xmlDoc.documentElement) return;
	var xmlHyper = xmlDoc.documentElement.childNodes.item(0).childNodes;
	var xmlMedia = xmlDoc.documentElement.childNodes.item(1).childNodes;
				
	aLinks = new Array();
	aMedia = new Array();

	aLinks = getHyperLinkXML(xmlHyper);
	aMedia = getMediaLinkXML(xmlMedia);
	
	AB.CurrentLinkXML = getLinkFileName(AB.IndexCurrentPage);
	showLinks();
}

function getHyperLinkXML(Obj)
{
	var xmlIcon, xmlWnd;
	var aCL = new Array();
	
	for(var i=0; i<Obj.length; i++)
	{
		xmlIcon = Obj.item(i).childNodes.item(1);
		xmlWnd = Obj.item(i).childNodes.item(2);
		xmlBdr = Obj.item(i).childNodes.item(0);
		
		aCL[i] = new Array(parseInt(Obj.item(i).getAttribute('no'),10),//0
					parseInt(Obj.item(i).getAttribute('left')),
					parseInt(Obj.item(i).getAttribute('top')),
					parseInt(Obj.item(i).getAttribute('width')),
					parseInt(Obj.item(i).getAttribute('height')),   
					Obj.item(i).getAttribute('url'),                  //5
					xmlIcon.getAttribute('type'),
					xmlIcon.getAttribute('text'),
					xmlWnd.getAttribute('width'),
					xmlWnd.getAttribute('height'),
					xmlWnd.getAttribute('type'),                      //10
					xmlBdr.getAttribute('type'),
					xmlBdr.getAttribute('color'));
	}
	return aCL;
}

function getMediaLinkXML(Obj)
{
	var aML = new Array();
	
	for(var i=0; i<Obj.length; i++)
		aML[i] = new Array(parseInt(Obj.item(i).getAttribute('no'),10),
					parseInt(Obj.item(i).getAttribute('left')),
					parseInt(Obj.item(i).getAttribute('top')),
					parseInt(Obj.item(i).getAttribute('width')),
					parseInt(Obj.item(i).getAttribute('height')),
					Obj.item(i).getAttribute('url'),
					parseInt(Obj.item(i).getAttribute('onplay')));
	return aML;
}

function createLinks()
{
	if(AB.FlipDirection == 0)
	{
		impLinks(getCurLinks(AB.IndexCurrentPage-1),getCurLinks(AB.IndexCurrentPage));
		impMedia(getCurMedia(AB.IndexCurrentPage-1),getCurMedia(AB.IndexCurrentPage));
	}
	else
	{
		impLinks(getCurLinks(AB.IndexCurrentPage),getCurLinks(AB.IndexCurrentPage-1));
		impMedia(getCurMedia(AB.IndexCurrentPage),getCurMedia(AB.IndexCurrentPage-1));
	}
}

function createZoomLinks()
{
	if(AB.FlipDirection == 0)
	{
		switch(AB.ViewerStatus)
		{
		case 60: 
			impZoomLinks(getCurLinks(AB.IndexCurrentPage-1));
			impZoomMedia(getCurMedia(AB.IndexCurrentPage-1));
			break;
		case 61:
			impZoomLinks(getCurLinks(AB.IndexCurrentPage));
			impZoomMedia(getCurMedia(AB.IndexCurrentPage));
			break;
		}
	}
	else
	{
		switch(AB.ViewerStatus)
		{
		case 60:
			impZoomLinks(getCurLinks(AB.IndexCurrentPage));
			impZoomMedia(getCurMedia(AB.IndexCurrentPage));
			break;
		case 61:
			impZoomLinks(getCurLinks(AB.IndexCurrentPage-1));
			impZoomMedia(getCurMedia(AB.IndexCurrentPage-1));
			break;
		}
	}
}

function createZoomLinks3()
{
	if(AB.FlipDirection == 0)
	{
		switch(AB.ViewerStatus)
		{
		case 600: 
			impZoomLinks3(getCurLinks(AB.IndexCurrentPage-1));
			impZoomMedia3(getCurMedia(AB.IndexCurrentPage-1));
			break;
		case 610:
			impZoomLinks3(getCurLinks(AB.IndexCurrentPage));
			impZoomMedia3(getCurMedia(AB.IndexCurrentPage));
			break;
		}
	}
	else
	{
		switch(AB.ViewerStatus)
		{
		case 600:
			impZoomLinks3(getCurLinks(AB.IndexCurrentPage));
			impZoomMedia3(getCurMedia(AB.IndexCurrentPage));
			break;
		case 610:
			impZoomLinks3(getCurLinks(AB.IndexCurrentPage-1));
			impZoomMedia3(getCurMedia(AB.IndexCurrentPage-1));
			break;
		}
	}
}

function getCurLinks()
{
	var iCount = 0;
	var aCount = new Array();
	
	if ( ((arguments[0]-AB.StartPageNum)>=(0-AB.StartPageNum)) && ((arguments[0]-AB.StartPageNum)<=(AB.PageCount-1-AB.StartPageNum)) )
	{
		for(var i=0;i<aLinks.length;i++) 
			if(aLinks[i][0] == arguments[0])
			{
				aCount[iCount] = aLinks[i];
				iCount++;
			}
		return aCount;
	}
	else
		return aCount;
}

function getCurMedia()
{
	var iCount = 0;
	var aCount = new Array();
	
	if ( ((arguments[0]-AB.StartPageNum)>=(0-AB.StartPageNum)) && ((arguments[0]-AB.StartPageNum)<=(AB.PageCount-1-AB.StartPageNum)) )
	{
		for(var i=0;i<aMedia.length;i++) 
			if(aMedia[i][0] == arguments[0])
			{
				aCount[iCount] = aMedia[i];
				iCount++;
			}
		return aCount;
	}
	else
		return aCount;
}

function getLinkCSS(aType,aColor)
{
	var CSSText;
	
	switch(aType)
	{
	case "0":
		CSSText = "position:absolute;visiblity:visible;z-index:11;background-color:#"+aColor+";filter:alpha(Opacity=10);"
				+ "border-left:1 white solid;border-top:1 white solid;border-right:1 black solid;border-bottom:1 black solid;";
		break;
	case "1":
		CSSText = "position:absolute;visiblity:visible;z-index:11;filter:alpha(Opacity=0);"
				+ "border-left:1 #"+aColor+" solid;border-top:1 #"+aColor+" solid;border-right:1 #"+aColor+" solid;border-bottom:1 #"+aColor+" solid;";
		break;	
	}
	
	return CSSText;
}

function impLinks(aLeftLink, aRightLink)
{
	
	var CurDiv, pleft,ptop,pwidth,pheight;
	AB.lyLeftLinks = new Array();
	AB.lyRightLinks = new Array();
	
	var CSSText;
	var blankImg="<img width='100%' height='100%' src='./menu/blank.gif'>";

	for(var i=0;i<aLeftLink.length;i++)
	{
		CurDiv = document.createElement("DIV");		
		
		pleft = aLeftLink[i][1]*AB.SmallImage;
		ptop = aLeftLink[i][2]*AB.SmallImage;
		pwidth = aLeftLink[i][3]*AB.SmallImage;
		pheight = aLeftLink[i][4]*AB.SmallImage;
							
		CSSText = getLinkCSS(aLeftLink[i][11],aLeftLink[i][12]) 
				+ "left:" + pleft 
				+ ";top:" + ptop 
				+ ";width:" + pwidth 
				+ ";height:" + pheight 
				+ "; ";
			
		AB.lyLeftLinks[i] = new Array('lyLeftLink'+i, parseInt(pleft,10), parseInt(ptop,10), parseInt(pwidth,10), parseInt(pheight,10) );
		CurDiv.style.zIndex = 11;
		if(getObj('lyLeftLink'+i))	continue;
		CurDiv.innerHTML = "<div id='lyLeftLink"+i
					+"' linkurl='"+isLinkNum(aLeftLink[i][5])
					+"' IconType='"+aLeftLink[i][6]
					+"' IconText='"+aLeftLink[i][7]
					+"' WndWidth='"+aLeftLink[i][8]
					+"' WndHeight='"+aLeftLink[i][9]
					+"' WndType='"+aLeftLink[i][10]
					+"' LinkType='"+aLeftLink[i][11]
					+"' style='"+CSSText+"' onmouseover='overLink(this)' onmouseout='outLink(this)' onmousedown='downLink(this)' onmouseup='upLink(this)' onclick='clickLink(this)'>"+blankImg+"</div>";
		getObj('lyLeftCanvas').appendChild(CurDiv);
	}

	for(var i=0;i<aRightLink.length;i++)
	{
		CurDiv = document.createElement("DIV");		
		
		pleft = aRightLink[i][1]*AB.SmallImage;
		ptop = aRightLink[i][2]*AB.SmallImage;
		pwidth = aRightLink[i][3]*AB.SmallImage;
		pheight = aRightLink[i][4]*AB.SmallImage;

		CSSText = getLinkCSS(aRightLink[i][11],aRightLink[i][12]) 
				+ "left:" + pleft 
				+ ";top:" + ptop 
				+ ";width:" + pwidth 
				+ ";height:" + pheight
				+ "; ";
				
		AB.lyRightLinks[i] = new Array('lyRightLink'+i, parseInt(pleft,10), parseInt(ptop,10), parseInt(pwidth,10), parseInt(pheight,10) );
		CurDiv.style.zIndex = 11;
		if(getObj('lyRightLink'+i))	continue;
		CurDiv.innerHTML = "<div id='lyRightLink"+i+"' linkurl='"+isLinkNum(aRightLink[i][5])+"' IconType='"+aRightLink[i][6]+"' IconText='"+aRightLink[i][7]+"' WndWidth='"+aRightLink[i][8]+"' WndHeight='"+aRightLink[i][9]+"' WndType='"+aRightLink[i][10]+"' LinkType='"+aRightLink[i][11]+"' style='"+CSSText+"' onmouseover='overLink(this)' onmouseout='outLink(this)' onmousedown='downLink(this)' onmouseup='upLink(this)' onclick='clickLink(this)'>"+blankImg+"</div>";
		getObj('lyRightCanvas').appendChild(CurDiv);
	}
}

function isLinkNum(arg)
{
	return ((isNaN(arg))?arg:(parseInt(arg,10)-AB.StartPageNum));
}

function impMedia(aLeftMedia, aRightMedia)
{
	var CurDiv, pleft,ptop,pwidth,pheight;
	var mediaPath = "/data/media/";
	var CurURL = window.location.toString();
	var tmpPath = CurURL.substring(0, CurURL.lastIndexOf('/'));
	
	mediaPath = tmpPath.substring(0, tmpPath.lastIndexOf('/')) + mediaPath;
	
	AB.lyLeftMedia = new Array();
	AB.lyRightMedia = new Array();
	
	for(var i=0;i<aLeftMedia.length;i++)
	{
		CurDiv = document.createElement("DIV");

		pleft = aLeftMedia[i][1]*AB.SmallImage;
		ptop = aLeftMedia[i][2]*AB.SmallImage;
		pwidth = aLeftMedia[i][3]*AB.SmallImage;
		pheight = aLeftMedia[i][4]*AB.SmallImage;
							
		AB.lyLeftMedia[i] = new Array('lyLeftMedia'+i, parseInt(pleft,10), parseInt(ptop,10), parseInt(pwidth,10), parseInt(pheight,10));
		CurDiv.style.zIndex = 12;
		if(getObj('lyLeftMedia'+i))	continue;
		CurDiv.innerHTML = "<div align='right' id='lyLeftMedia"+i
					+"' style='position:absolute;left:"+pleft+";top:"+ptop+";width:"+pwidth+";height:"+pheight+";z-index:12' onmouseover='javascript:AB.ActivateLink=true;' onmouseout='javascript:AB.ActivateLink=false;'>"
					+selectMedia(returnMediaType(aLeftMedia[i][5]),'lyLeftMMP'+i, aLeftMedia[i][6])
					+"</div>";
				
		getObj('lyLeftCanvas').appendChild(CurDiv);
	}
	
	for(var i=0;i<aRightMedia.length;i++)
	{
		CurDiv = document.createElement("DIV");

		pleft = aRightMedia[i][1]*AB.SmallImage;
		ptop = aRightMedia[i][2]*AB.SmallImage;
		pwidth = aRightMedia[i][3]*AB.SmallImage;
		pheight = aRightMedia[i][4]*AB.SmallImage;

		AB.lyRightMedia[i] = new Array('lyRightMedia'+i, parseInt(pleft,10), parseInt(ptop,10), parseInt(pwidth,10), parseInt(pheight,10));
		CurDiv.style.zIndex = 12;
		if(getObj('lyRightMedia'+i))	continue;
		CurDiv.innerHTML = "<div align='right' id='lyRightMedia"+i
					+"' style='position:absolute;left:"+pleft+";top:"+ptop+";width:"+pwidth+";height:"+pheight+";z-index:12;' onmouseover='javascript:AB.ActivateLink=true;' onmouseout='javascript:AB.ActivateLink=false;'>"
					+selectMedia(returnMediaType(aRightMedia[i][5]),'lyRightMMP'+i, aRightMedia[i][6])
					+"</div>";

		getObj('lyRightCanvas').appendChild(CurDiv);
	}
}

function returnMediaType(aURL)
{
	var MType = aURL.substring(aURL.lastIndexOf('.')+1,aURL.length);

	return new Array(MType.toLowerCase(),aURL);	
}

function selectMedia(aURL,aID,aPlay)
{
	var MTag, MPath, MPlay, MPlay1;

	if(aURL[1].indexOf('://')>0) 
		MPath = unescape(aURL[1]);
	else
		MPath = unescape(AB.MediaPath+aURL[1]);
		
	MPlay = (isNaN(aPlay))?0:aPlay;
	MPlay1 = (MPlay==1)?true:false;

	switch(aURL[0])
	{
	case "asf":
	case "asx":
	case "mpg":
	case "mpeg":
	case "avi":
	case "wmv":
		MTag = "<embed type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/' name='"+aID+"' transparentatStart='1' showcontrols='0' autostart='"+MPlay+"' autosize='1' filename='"+MPath+"' showdisplay='0' showstatusbar='0' displaysize='0' width='100%' height='100%' showcaptioning='0' AllowChangeDisplaySize='0' EnableContextMenu='0'></embed>"
		MTag += "<div id='lyCM_"+aID+"'>"+btnMediaTag(0,aPlay,aID)+"</div>";
		break;
	case "swf":
		MTag = "<embed type='application/x-shockwave-flash' id='"+aID+"' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' name='"+aID+"' wmode='transparent' src='"+MPath+"' loop=false quality=high width='100%' height='100%' showcaptioning=0></embed>";
		break;
	case "mov":
		MTag = "<embed type='video/quicktime' id='"+aID+"' width='100%' height='100%' scale='TOFIT' kioskmode='True' autoplay='"+MPlay1+"' controller='False' pluginspage='http://www.apple.com/quicktime/download/' src='"+MPath+"'></embed>"
			+ "<div id='lyCM_"+aID+"'>"+btnMediaTag(1,aPlay,aID)+"</div>";
		break;
	case "mp3":
		MTag = "<embed type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/' name='"+aID+"' filename='"+MPath+"' autostart='"+MPlay+"' showdisplay='0' showstatusbar='0' displaysize='0' width='0' height='0'></embed>"
		MTag += "<div id='lyCM_"+aID+"'>"+btnMediaTag(0,aPlay,aID)+"</div>";
		break;
	default:
		MTag = "<embed id='"+aID+"' autopaly='"+MPlay+"' width='100%' height='100%' src='"+MPath+"'></embed>";
		break;
	}
	
	return MTag;
}

function btnMediaTag(st,aPlay,aID)
{
	if(aPlay==0)
		return "<img name='btnPlay_"+aID+"' id='btnPlay_"+aID+"' src='"+AB.TImageTool+"/movie_play_out.gif' onmousedown=\"Cimage('btnPlay_"+aID+"',45)\" onmouseout=\"Cimage('btnPlay_"+aID+"',46)\" onmouseover=\"Cimage('btnPlay_"+aID+"',47)\" onmouseup=\"Cimage('btnPlay_"+aID+"',47)\" onclick=\"onTogglePlayer("+st+",1,'"+aID+"')\">";
	else
		return "<img name='btnStop_"+aID+"' id='btnStop_"+aID+"' src='"+AB.TImageTool+"/movie_stop_out.gif' onmousedown=\"Cimage('btnStop_"+aID+"',48)\" onmouseout=\"Cimage('btnStop_"+aID+"',49)\" onmouseover=\"Cimage('btnStop_"+aID+"',50)\" onmouseup=\"Cimage('btnStop_"+aID+"',50)\" onclick=\"onTogglePlayer("+st+",0,'"+aID+"')\">";
}

function impZoomLinks(aZoomLink)
{
	var CurDiv, pleft,ptop,pwidth,pheight;
	AB.lyZoomLinks = new Array();
	
	var blankImg="<img border='0' width='100%' height='100%' src='./menu/blank.gif'>";
		
	var CSSText;
	
	for(var i=0;i<aZoomLink.length;i++)
	{
		CurDiv = document.createElement("DIV");

		pleft = aZoomLink[i][1]*AB.MiddleImage;
		ptop = aZoomLink[i][2]*AB.MiddleImage;
		pwidth = aZoomLink[i][3]*AB.MiddleImage;
		pheight = aZoomLink[i][4]*AB.MiddleImage;
							
		CSSText = getLinkCSS(aZoomLink[i][11],aZoomLink[i][12])+"left:"+pleft+";top:"+ptop+";width:"+pwidth+";height:"+pheight+";";
			
		AB.lyZoomLinks[i] = new Array('lyZoomLink'+i, parseInt(pleft,10), parseInt(ptop,10), parseInt(pwidth,10), parseInt(pheight,10));
		CurDiv.style.zIndex = 11;
		if(getObj('lyZoomLink'+i))	continue;
		CurDiv.innerHTML = "<div id='lyZoomLink"+i
					+"' linkurl='"+isLinkNum(aZoomLink[i][5])
					+"' IconType='"+aZoomLink[i][6]
					+"' IconText='"+aZoomLink[i][7]
					+"' WndWidth='"+aZoomLink[i][8]
					+"' WndHeight='"+aZoomLink[i][9]
					+"' WndType='"+aZoomLink[i][10]
					+"' LinkType='"+aZoomLink[i][11]
					+"' style='"+CSSText+"' onmouseover='overLink(this)' onmouseout='outLink(this)' onmousedown='downLink(this)' onmouseup='upLink(this)' onclick='clickLink(this)'>"+blankImg+"</div>";

		getObj('lyZoom').appendChild(CurDiv);
	}
}

function impZoomLinks3(aZoomLink)
{
	var CurDiv, pleft,ptop,pwidth,pheight;
	AB.lyZoomLinks3 = new Array();
	
	var blankImg="<img border='0' width='100%' height='100%' src='./menu/blank.gif'>";
		
	var CSSText;
	
	for(var i=0;i<aZoomLink.length;i++)
	{
		CurDiv = document.createElement("DIV");

		pleft = aZoomLink[i][1];
		ptop = aZoomLink[i][2];
		pwidth = aZoomLink[i][3];
		pheight = aZoomLink[i][4];
							
		CSSText = getLinkCSS(aZoomLink[i][11],aZoomLink[i][12])+"left:"+pleft+";top:"+ptop+";width:"+pwidth+";height:"+pheight+";";
			
		AB.lyZoomLinks3[i] = new Array('lyZoomLink3_'+i, parseInt(pleft,10), parseInt(ptop,10), parseInt(pwidth,10), parseInt(pheight,10));
		CurDiv.style.zIndex = 11;
		if(getObj('lyZoomLink3_'+i))	continue;
		CurDiv.innerHTML = "<div id='lyZoomLink3_"+i
					+"' linkurl='"+isLinkNum(aZoomLink[i][5])
					+"' IconType='"+aZoomLink[i][6]
					+"' IconText='"+aZoomLink[i][7]
					+"' WndWidth='"+aZoomLink[i][8]
					+"' WndHeight='"+aZoomLink[i][9]
					+"' WndType='"+aZoomLink[i][10]
					+"' LinkType='"+aZoomLink[i][11]
					+"' style='"+CSSText+"' onmouseover='overLink(this)' onmouseout='outLink(this)' onmousedown='downLink(this)' onmouseup='upLink(this)' onclick='clickLink(this)'>"+blankImg+"</div>";

		getObj('lyZoom3').appendChild(CurDiv);
	}
}

function impZoomMedia(aZoomMedia)
{
	var CurDiv, pleft,ptop,pwidth,pheight;
	var mediaPath = "/data/media/";
	var CurURL = window.location.toString();
	var tmpPath = CurURL.substring(0, CurURL.lastIndexOf('/'));
	
	mediaPath = tmpPath.substring(0, tmpPath.lastIndexOf('/')) + mediaPath;
	
	AB.lyZoomMedia = new Array();
	
	for(var i=0;i<aZoomMedia.length;i++)
	{
		CurDiv = document.createElement("DIV");

		pleft = aZoomMedia[i][1]*AB.MiddleImage;
		ptop = aZoomMedia[i][2]*AB.MiddleImage;
		pwidth = aZoomMedia[i][3]*AB.MiddleImage;
		pheight = aZoomMedia[i][4]*AB.MiddleImage;
							
		AB.lyZoomMedia[i] = new Array('lyZoomMedia'+i, parseInt(pleft,10), parseInt(ptop,10), parseInt(pwidth,10), parseInt(pheight,10));
		CurDiv.style.zIndex = 12;
		if(getObj('lyZoomMedia'+i))	continue;
		CurDiv.innerHTML = "<div align='right' id='lyZoomMedia"+i
					+"' style='position:absolute;left:"+pleft+";top:"+ptop+";width:"+pwidth+";height:"+pheight+";z-index:12' onmouseover='javascript:AB.ActivateLink=true;' onmouseout='javascript:AB.ActivateLink=false;'>"
					+selectMedia(returnMediaType(aZoomMedia[i][5]),'lyZoomMMP'+i, aZoomMedia[i][6])
					+"</div>";
	
		getObj('lyZoom').appendChild(CurDiv);
	}
}

function impZoomMedia3(aZoomMedia)
{
	var CurDiv, pleft,ptop,pwidth,pheight;
	var mediaPath = "/data/media/";
	var CurURL = window.location.toString();
	var tmpPath = CurURL.substring(0, CurURL.lastIndexOf('/'));
	
	mediaPath = tmpPath.substring(0, tmpPath.lastIndexOf('/')) + mediaPath;
	
	AB.lyZoomMedia3 = new Array();
	
	for(var i=0;i<aZoomMedia.length;i++)
	{
		CurDiv = document.createElement("DIV");

		pleft = aZoomMedia[i][1];
		ptop = aZoomMedia[i][2];
		pwidth = aZoomMedia[i][3];
		pheight = aZoomMedia[i][4];
							
		AB.lyZoomMedia3[i] = new Array('lyZoomMedia3_'+i, parseInt(pleft,10), parseInt(ptop,10), parseInt(pwidth,10), parseInt(pheight,10));
		CurDiv.style.zIndex = 12;
		if(getObj('lyZoomMedia3_'+i))	continue;
		CurDiv.innerHTML = "<div align='right' id='lyZoomMedia3_"+i
					+"' style='position:absolute;left:"+pleft+";top:"+ptop+";width:"+pwidth+";height:"+pheight+";z-index:12' onmouseover='javascript:AB.ActivateLink=true;' onmouseout='javascript:AB.ActivateLink=false;'>"
					+selectMedia(returnMediaType(aZoomMedia[i][5]),'lyZoomMMP'+i, aZoomMedia[i][6])
					+"</div>";
	
		getObj('lyZoom3').appendChild(CurDiv);
	}
}

function overLink(Obj)
{	
	with(Obj.style)
	{
		switch(Obj.LinkType)
		{
		case "0":
			borderLeft = "1 white solid"; borderTop = "1 white solid"; borderRight = "1 black solid"; borderBottom = "1 black solid";
			filter = "alpha(Opacity=40)";			
			break;
		case "1":			
			filter = "alpha(Opacity=100)";
			break;
		}
		cursor = "hand";
	}
	AB.ActivateLink = true;

	showLinkIcon(Obj);
}

function outLink(Obj) 
{
	with(Obj.style)
	{
		switch(Obj.LinkType)
		{
		case "0":
			borderLeft = "1 white solid"; borderTop = "1 white solid"; borderRight = "1 black solid"; borderBottom = "1 black solid";
			filter = "alpha(Opacity=10)";
			break;
		case "1":
			filter = "alpha(Opacity=0)";
			break;
		}
		cursor = "default";		
	}
	AB.ActivateLink = false;

	hideLinkIcon(Obj);
}

function downLink(Obj) 
{
	with(Obj.style)
	{
		switch(Obj.LinkType)
		{
		case "0":
			borderLeft = "1 black solid"; borderTop = "1 black solid"; borderRight = "1 white solid"; borderBottom = "1 white solid";
			filter = "alpha(Opacity=40)";
			break;
		case "1":
			filter = "alpha(Opacity=100)";
			break;
		}
	}
}

function upLink(Obj)
{
	with(Obj.style)
	{
		switch(Obj.LinkType)
		{
		case "0":
			borderLeft = "1 black solid"; borderTop = "1 black solid"; borderRight = "1 white solid"; borderBottom = "1 white solid";
			filter = "alpha(Opacity=10)";
			break;
		case "1":
			filter = "alpha(Opacity=0)";
			break;
		}
	}
}

function clickLink(Obj) 
{
	switch(chkLinkURL(Obj.linkurl)) 
	{
		case 0:
			openWnd(parseInt(Obj.WndType,10), Obj.WndWidth, Obj.WndHeight, "http://"+Obj.linkurl);
			break;
		case 1:
		case 5:
		case 7:
			openWnd(parseInt(Obj.WndType,10), Obj.WndWidth, Obj.WndHeight, Obj.linkurl);
			break;
		case 2:
			location.href = "mailto:"+Obj.linkurl;
			break;
		case 3:
		case 6:
			location.href = Obj.linkurl;
			break;			
		case 4:
			AB.PageJumpNum = parseInt(Obj.linkurl,10);
			GoToPageNum(parseInt(Obj.linkurl,10));
			break;
	}
}

function chkLinkURL(aURL)
{
	var tURL = aURL.toLowerCase();
	
	if(tURL.indexOf('mailto:')>=0) return 6;
	else if(tURL.indexOf('@')>=0) return 2;
	else if(tURL.indexOf('https://')>=0) return 1;	
	else if(tURL.indexOf('mms://')>=0) return 3;
	else if(!isNaN(tURL)) return 4;
	else if(tURL.indexOf('http://')>=0) return 5;
	else if(tURL.indexOf(':\\')>=0) return 7;
	else return 0;
}

function delLinks()
{
	for(var i=0; i<10; i++)
	{
	removeLinkEL('lyLeftCanvas',11);
	removeLinkEL('lyRightCanvas',11);
		
	removeLinkEL('lyLeftCanvas',12);
	removeLinkEL('lyRightCanvas',12);
	}

}

function delZoomLinks()
{
	for(var i=0; i<10; i++)
	{
	removeLinkEL('lyZoom',11);
	removeLinkEL('lyZoom',12);
	}
}

function delZoomLinks3()
{
	for(var i=0; i<10; i++)
	{
	removeLinkEL('lyZoom3',11);
	removeLinkEL('lyZoom3',12);
	}
}

function removeLinkEL(Obj,delIdx)
{   	
	var oParent = getObj(Obj);

	for(var iIdx=0; iIdx < oParent.childNodes.length; iIdx++) 
	{
		var oChild=oParent.children(iIdx);
		
		if(oChild)
		{
			if ((oParent.children(iIdx).style.zIndex == delIdx)&&(oParent.children(iIdx).tagName=="DIV"))
				oParent.removeChild(oChild);
		}
	}
}

function openWnd(aType, aWidth, aHeight, aURL)
{
	var wFeature;
	
	switch(aType)
	{
	case 0: //_blank
		wFeature = "";
		break;
	case 1: //fullscreen
		wFeature = "fullscreen=1";
		break;
	case 2: //resizable
		wFeature = "scrollbars=1, resizable=yes, width="+aWidth+", height="+aHeight;
		break;
	case 3: //pop-up
		wFeature = "width="+aWidth+", height="+aHeight;
		break;						
	}
	
	window.open(aURL,"_blank",wFeature);
}

function showLinkIcon(Obj)
{
	createLinkIcon(Obj);
	moveLinkIcon(Obj);
}

function hideLinkIcon(Obj)
{	
	IconTimer = setTimeout('null',1);
	removeLinkIcon();
}

function createLinkIcon(Obj)
{
	var oNewDiv = document.createElement("Div");
	var oParent = document.getElementById("oViewer");
	var IconNum = "0"+Obj.IconType;
	
	IconNum = IconNum.substring(IconNum.length-2,IconNum.length);
	
	oParent.appendChild(oNewDiv);	
	oNewDiv.outerHTML = "<div id='oLinkIcon' style='position:absolute;z-index:35;left:100px;top:100px;'></div>";	
	
	var oNewImg = document.createElement("IMG");
	var oParentDiv = document.getElementById("oLinkIcon");
	
	oParentDiv.appendChild(oNewImg);
	
	oNewImg.outerHTML = "<img src='"+AB.TImageLink + initLang + "link_"+IconNum+".gif'>";

	
	var oNewTB = document.createElement("MARQUEE");
	var oComment;
	
	if (Obj.IconText == "")
		switch (parseInt(Obj.IconType,10))
		{
		case 11:
			oComment = Obj.linkurl+"ページにジャンプします。";
			if(initLang=="en_") 
				oComment = "Jump To "+(parseInt(Obj.linkurl,10));
			break;
		case 9:
			oComment = Obj.linkurl;
			oComment = oComment.toLowerCase();
			if(oComment.indexOf('mailto:')>-1)
				oComment = oComment.substring(oComment.indexOf('mailto:')+7,oComment.length);			
			break;
		default:
			oComment = Obj.linkurl;
			if(oComment.indexOf('mailto:')>-1)
				oComment = oComment.substring(oComment.indexOf('mailto:')+7,oComment.length);			
			break;			
		}		
	else	
		oComment = Obj.IconText;
	
	oParentDiv.appendChild(oNewTB);	
	oNewTB.outerHTML = "<marquee behavior='scroll' direction='left' width='157' height='17' style='position:absolute;left:4px;top:23px;font-size:12px;font-weight:normal;'><font color='#999999' valign='center'>"+oComment+"</font></marquee>";	
}
var IconTimer = setTimeout('null',1);
function moveLinkIcon()
{
	var oDiv = document.getElementById("oLinkIcon");
	
	try
	{
		oDiv.style.left = x+15+"px";
		oDiv.style.top = y+"px";
	
		IconTimer = setTimeout("moveLinkIcon()",10);
	}
	catch(err)
	{}
}

function removeLinkIcon()
{   	
	var oDelDiv = getObj("oLinkIcon");
	var oParent = getObj("oViewer");

	for(var iIdx=0; iIdx < oParent.childNodes.length; iIdx++) 
	{
		var oChild=oParent.children(iIdx);
		if ((oParent.children(iIdx).style.zIndex == 35)&&(oParent.children(iIdx).tagName=="DIV"))
			oParent.removeChild(oChild);
	}
	
	return true;
}
