function displayContent(barID, contentID)
{
	if (contentID.style.display=="none") 
	{
		// display the content
		barID.style.background="seashell";
		barID.style.color="black";
		contentID.style.display="";
		barID.style.borderBottomColor="seashell";
		currentBarColor="seashell";
		hideOtherContent(contentID);
	}
}

function hideOtherContent(contentID)
{
	if (contentID['id']!="subContent1")
	{
		mainMenuBar1.style.background="gainsboro";
		mainMenuBar1.style.color="gray";
		mainMenuBar1.style.borderBottomColor="darksalmon";
		subContent1.style.display="none";
	}
	if (contentID['id']!="subContent2")
	{
		mainMenuBar2.style.background="gainsboro";
		mainMenuBar2.style.color="gray";
		mainMenuBar2.style.borderBottomColor="darksalmon";
		subContent2.style.display="none";
	}
	if (contentID['id']!="subContent3")
	{	
		mainMenuBar3.style.background="gainsboro";
		mainMenuBar3.style.color="gray";
		mainMenuBar3.style.borderBottomColor="darksalmon";
		subContent3.style.display="none";
	}
}

function displayContent2(barID, contentID)
{
	if (contentID.style.display=="none")
	{
		barID.style.background="url(http://hkclweb.hkpl.gov.hk/doc/images/tab_active.png)";
		barID.style.color="black";
		contentID.style.display="";
		
		hideOtherContent2(contentID);
	}
}

function hideOtherContent2(contentID)
{
	if (contentID['id'] != "subContent1")
	{
		document.getElementById('mainMenuBar1').style.background="url(http://hkclweb.hkpl.gov.hk/doc/images/tab_off.png)";
		document.getElementById('mainMenuBar1').style.color="gray";
		document.getElementById('subContent1').style.display="none";
	}
	if (contentID['id'] != "subContent2")
	{
		document.getElementById('mainMenuBar2').style.background="url(http://hkclweb.hkpl.gov.hk/doc/images/tab_off.png)";
		document.getElementById('mainMenuBar2').style.color="gray";
		document.getElementById('subContent2').style.display="none";
	}
	if (contentID['id'] != "subContent3")
	{
		document.getElementById('mainMenuBar3').style.background="url(http://hkclweb.hkpl.gov.hk/doc/images/tab_off.png)";
		document.getElementById('mainMenuBar3').style.color="gray";
		document.getElementById('subContent3').style.display="none";
	}
}

function hideOtherContent3(contentID)
{
	hideOtherContent2(contentID);
	if (contentID['id'] != "subContent4")
	{
		document.getElementById('mainMenuBar4').style.background="url(http://hkclweb.hkpl.gov.hk/doc/images/tab_off.png)";
		document.getElementById('mainMenuBar4').style.color="gray";
		document.getElementById('subContent4').style.display="none";
	}
}

function displayContent3(barID, contentID)
{
	if (contentID.style.display=="none")
	{
		barID.style.background="url(http://hkclweb.hkpl.gov.hk/doc/images/tab_active.png)";
		barID.style.color="black";
		contentID.style.display="";
		
		hideOtherContent3(contentID);
	}
}

function cellOn(obj, colorName)
{
	obj.style.background=colorName;
}

function cellOff(obj, colorName)
{
	obj.style.background=colorName;
}

function imageOn(obj, h, w)
{
	obj.style.border="2px solid lightblue";
	obj.height=h-4;
	obj.width=w-4;
}

function imageOff(obj, h, w)
{
	obj.style.border="none";
	obj.height=h;
	obj.width=w;
}

function imageOn2(obj)
{
	var h=obj.height-6;
	var w=obj.width-6;
	obj.style.border="3px inset lightblue";
	obj.height=h;
	obj.width=w;
}

function imageOff2(obj)
{
	var h=obj.height+6;
	var w=obj.width+6;
	obj.style.border="none";
	obj.height=h;
	obj.width=w;
}

var currentBarColor="";

function menuBarOn(obj)
{
	currentBarColor=obj.style.background;
	obj.style.background="lightblue";
}

function menuBarOff(obj)
{
	obj.style.background=currentBarColor;
}

function displayPastContent(itemID)
{
	itemID.style.visibility=itemID.style.visibility=="hidden" ? "visible" : "hidden";
}

var newspaperWidth=750, newspaperHeight=140, newspaperBg='gainsboro', newspaperPause=3000;
var paperImgWidth=170, paperImgHeight=140;
var newspaper=new Array();

function setNewspaperWidth(w)
{
	newspaperWidth=w;
}

function setNewspaperHeight(h)
{
	newspaperHeight=h;
}

function setPaperImgWidth(w)
{
	paperImgWidth=w;
}

function setPaperImgHeight(h)
{
	paperImgHeight=h;
}

/*function createArray()
{
	newspaper[0]='<a href="http://hkclweb.hkpl.gov.hk/hkclr2/igateway?svc=bsch&amp;col=128&amp;stype=fts&amp;param=title&amp;schtxt=%A4%75%B0%D3%A4%E9%B3%F8&amp;frm=1&amp;to=10&amp;max=200&amp;hitperpage=10&amp;ss=FullDetail"><img src="http://hkclweb.hkpl.gov.hk/doc/images/KS.jpg" alt="香港工商日報 / The Kung Sheung Daily News" border="0" onMouseOver="imageOn2(this)" onMouseOut="imageOff2(this)" width="'+paperImgWidth+'" height="'+paperImgHeight+'"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://hkclweb.hkpl.gov.hk/hkclr2/igateway?svc=bsch&amp;col=128&amp;stype=fts&amp;param=title&amp;schtxt=%B5%D8%B9%B4%A4%E9%B3%F8&amp;frm=1&amp;to=10&amp;max=200&amp;hitperpage=10&amp;ss=FullDetail"><img src="http://hkclweb.hkpl.gov.hk/doc/images/WK.jpg" alt="華僑日報 / Wah Kiu Yat Po" border="0" onMouseOver="imageOn2(this)" onMouseOut="imageOff2(this)" width="'+paperImgWidth+'" height="'+paperImgHeight+'"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://hkclweb.hkpl.gov.hk/hkclr2/igateway?svc=bsch&amp;col=128&amp;stype=fts&amp;param=title&amp;schtxt=%B9%49%C2%E2%B3%65%AC%C3&amp;frm=1&amp;to=10&amp;max=200&amp;hitperpage=10&amp;ss=FullDetail"><img src="http://hkclweb.hkpl.gov.hk/doc/images/IDC.jpg" alt="遐邇貫珍 / Chinese Serial" border="0" onMouseOver="imageOn2(this)" onMouseOut="imageOff2(this)" width="'+paperImgWidth+'" height="'+paperImgHeight+'"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://hkclweb.hkpl.gov.hk/hkclr2/igateway?svc=bsch&amp;col=128&amp;stype=fts&amp;param=title&amp;schtxt=%AD%BB%B4%E4%B5%D8%A6r%A4%E9%B3%F8&amp;frm=1&amp;to=10&amp;max=200&amp;hitperpage=10&amp;ss=FullDetail"><img src="http://hkclweb.hkpl.gov.hk/doc/images/CM2.jpg" alt="香港華字日報 / The Chinese Mail" border="0" onMouseOver="imageOn2(this)" onMouseOut="imageOff2(this)" width="'+paperImgWidth+'" height="'+paperImgHeight+'"></a>';
	newspaper[1]='<a href="http://hkclweb.hkpl.gov.hk/hkclr2/igateway?svc=bsch&amp;col=128&amp;stype=fts&amp;param=title&amp;schtxt=%AD%BB%B4%E4%B5%D8%A6r%B1%DF%B3%F8&amp;frm=1&amp;to=10&amp;max=200&amp;hitperpage=10&amp;ss=FullDetail"><img src="http://hkclweb.hkpl.gov.hk/doc/images/CEP.jpg" alt="香港華字晚報 / The Chinese Evening Post" border="0" onMouseOver="imageOn2(this)" onMouseOut="imageOff2(this)" width="'+paperImgWidth+'" height="'+paperImgHeight+'"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://hkclweb.hkpl.gov.hk/hkclr2/igateway?svc=bsch&amp;col=128&amp;stype=fts&amp;param=title&amp;schtxt=%A4j%A4%BD%B3%F8&amp;frm=1&amp;to=10&amp;max=200&amp;hitperpage=10&amp;ss=FullDetail"><img src="http://hkclweb.hkpl.gov.hk/doc/images/TKP.jpg" alt="大公報 / Tai Kung Pao" border="0" onMouseOver="imageOn2(this)" onMouseOut="imageOff2(this)" width="'+paperImgWidth+'" height="'+paperImgHeight+'"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://hkclweb.hkpl.gov.hk/hkclr2/igateway?svc=bsch&amp;col=128&amp;stype=fts&amp;param=title&amp;schtxt=China Mail&amp;frm=1&amp;to=10&amp;max=200&amp;hitperpage=10&amp;ss=FullDetail"><img src="http://hkclweb.hkpl.gov.hk/doc/images/CM.jpg" alt="China Mail" border="0" onMouseOver="imageOn2(this)" onMouseOut="imageOff2(this)" width="'+paperImgWidth+'" height="'+paperImgHeight+'"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://hkclweb.hkpl.gov.hk/hkclr2/igateway?svc=bsch&amp;col=128&amp;stype=fts&amp;param=title&amp;schtxt=Hong Kong Daily Press&amp;frm=1&amp;to=10&amp;max=200&amp;hitperpage=10&amp;ss=FullDetail"><img src="http://hkclweb.hkpl.gov.hk/doc/images/HKDP.jpg" alt="Hong Kong Daily Press" border="0" onMouseOver="imageOn2(this)" onMouseOut="imageOff2(this)" width="'+paperImgWidth+'" height="'+paperImgHeight+'"></a>';
	newspaper[2]='<a href="http://hkclweb.hkpl.gov.hk/hkclr2/igateway?svc=bsch&amp;col=128&amp;stype=fts&amp;param=title&amp;schtxt=Hong Kong Sunday Herald&amp;frm=1&amp;to=10&amp;max=200&amp;hitperpage=10&amp;ss=FullDetail"><img src="http://hkclweb.hkpl.gov.hk/doc/images/HKSH.jpg" alt="Hong Kong Sunday Herald" border="0" onMouseOver="imageOn2(this)" onMouseOut="imageOff2(this)" width="'+paperImgWidth+'" height="'+paperImgHeight+'"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://hkclweb.hkpl.gov.hk/hkclr2/igateway?svc=bsch&amp;col=128&amp;stype=fts&amp;param=title&amp;schtxt=Hong Kong Telegraph&amp;frm=1&amp;to=10&amp;max=200&amp;hitperpage=10&amp;ss=FullDetail"><img src="http://hkclweb.hkpl.gov.hk/doc/images/HKT.jpg" alt="Hong Kong Telegraph" border="0" onMouseOver="imageOn2(this)" onMouseOut="imageOff2(this)" width="'+paperImgWidth+'" height="'+paperImgHeight+'"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://hkclweb.hkpl.gov.hk/hkclr2/igateway?svc=bsch&amp;col=128&amp;stype=fts&amp;param=title&amp;schtxt=Hong Kong Weekly Press&amp;frm=1&amp;to=10&amp;max=200&amp;hitperpage=10&amp;ss=FullDetail"><img src="http://hkclweb.hkpl.gov.hk/doc/images/HKWP.jpg" alt="Hong Kong Weekly Press" border="0" onMouseOver="imageOn2(this)" onMouseOut="imageOff2(this)" width="'+paperImgWidth+'" height="'+paperImgHeight+'"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://hkclweb.hkpl.gov.hk/hkclr2/igateway?svc=bsch&amp;col=128&amp;stype=fts&amp;param=title&amp;schtxt=%A4%75%B0%D3%A4%E9%B3%F8&amp;frm=1&amp;to=10&amp;max=200&amp;hitperpage=10&amp;ss=FullDetail"><img src="http://hkclweb.hkpl.gov.hk/doc/images/KS.jpg" alt="香港工商日報 / The Kung Sheung Daily News" border="0" onMouseOver="imageOn2(this)" onMouseOut="imageOff2(this)" width="'+paperImgWidth+'" height="'+paperImgHeight+'"></a>';
	if (newspaper.length>1) i=2;
	else i=0;
}

function move1(layerID)
{
	tlayer=eval(layerID);
	if (tlayer.top>0 && tlayer.top<=5)
	{
		tlayer.top=0;
		setTimeout("move1(tlayer)",newspaperPause);
		setTimeout("move2(document.oldPaper.document.oldPaper3)",newspaperPause);
		return;
	}
	if (tlayer.top>=tlayer.document.height*-1)
	{
		tlayer.top-=5;
		setTimeout("move1(tlayer)",100);
	}
	else
	{
		tlayer.top=newspaperHeight;
		tlayer.document.write(newspaper[i]);
		tlayer.document.close();
		if (i==newspaper.length-1) i=0;
		else i++;
	}
}

function move2(layerID)
{
	tlayer2=eval(layerID);
	if (tlayer2.top>0 && tlayer2.top<=5)
	{
		tlayer2.top=0;
		setTimeout("move2(tlayer2)",newspaperPause);
		setTimeout("move1(document.oldPaper.document.oldPaper1)",newspaperPause);
		return;
	}
	if (tlayer2.top>=tlayer2.document.height*-1)
	{
		tlayer2.top-=5;
		setTimeout("move2(tlayer2)",100);
	}
	else
	{
		tlayer2.top=newspaperHeight;
		tlayer2.document.write(newspaper[i]);
		tlayer2.document.close();
		if (i==newspaper.length-1) i=0;
		else i++;
	}
}

function move3(divID)
{
	tdiv=eval(divID);
	if (tdiv.style.pixelTop>0 && tdiv.style.pixelTop<=5)
	{
		tdiv.style.pixelTop=0;
		setTimeout("move3(tdiv)",newspaperPause);
		setTimeout("move4(oldPaper4)",newspaperPause);
		return;
	}
	if (tdiv.style.pixelTop>=tdiv.offsetHeight*-1)
	{
		tdiv.style.pixelTop-=5;
		setTimeout("move3(tdiv)",100);
	}
	else
	{
		tdiv.style.pixelTop=newspaperHeight;
		tdiv.innerHTML=newspaper[i];
		if (i==newspaper.length-1) i=0;
		else i++;
	}
}

function move4(divID)
{
	tdiv2=eval(divID);
	if (tdiv2.style.pixelTop>0 && tdiv2.style.pixelTop<=5)
	{
		tdiv2.style.pixelTop=0;
		setTimeout("move4(tdiv2)",newspaperPause);
		setTimeout("move3(oldPaper2)",newspaperPause);
		return
	}
	if (tdiv2.style.pixelTop>=tdiv2.offsetHeight*-1)
	{
		tdiv2.style.pixelTop-=5;
		setTimeout("move4(oldPaper4)",100);
	}
	else
	{
		tdiv2.style.pixelTop=newspaperHeight;
		tdiv2.innerHTML=newspaper[i];
		if (i==newspaper.length-1) i=0;
		else i++;
	}
}
 
function scrollNewspaper()
{
	if (document.all)
	{
		move3(oldPaper2);
		oldPaper4.style.top=newspaperHeight;
	}
	else if (document.layers)
	{
		document.oldPaper.visibility="show";
		move1(document.oldPaper.document.oldPaper1);
		document.oldPaper.document.oldPaper3.top=newspaperHeight+5;
		document.oldPaper.document.oldPaper3.visibility="show";
	}
	else
	{
		move3(document.getElementById('oldPaper2'));
		document.getElementById('oldPaper4').style.top=newspaperHeight;
	}
}

function createNewspaperBanner(bh, bw, h, w)
{
	if (bh>0) setNewspaperHeight(bh);
	if (bw>0)setNewspaperWidth(bw);
	if (h>0) setPaperImgHeight(h);
	if (w>0) setPaperImgWidth(w);
	createArray();
	document.write('<ilayer id="oldPaper" width='+newspaperWidth+'; height='+newspaperHeight+'; bgColor='+newspaperBg+'; visibility="hidden">');
	document.write('<layer id="oldPaper1" left=0 top=1 width='+newspaperWidth+'; >');
	if (document.layers) document.write(newspaper[0]);
	document.write('</layer>');
	document.write('<layer id="oldPaper3" left=0 top=0 width='+newspaperWidth+'; visibility="hidden">');
	if (document.layers) document.write(newspaper[1]);
	document.write('</layer></ilayer>');
	document.write('<center>');

	if (document.all)
	{
		document.write('<span id="main2" style="position:relative; width:'+newspaperWidth+'; height:'+newspaperHeight+'; overflow:hidden; background-color:'+newspaperBg+'">');
		document.write('<div style="position:absolute;width:'+newspaperWidth+';height:'+newspaperHeight+';clip:rect(0 '+newspaperWidth+' '+newspaperHeight+' 0);left:0;top:0">');
		document.write('<div id="oldPaper2" style="position:absolute;width:'+newspaperWidth+';left:0;top:1;">');
		document.write(newspaper[0]);
		document.write('</div>');
		document.write('<div id="oldPaper4" style="position:absolute;width:'+newspaperWidth+';left:0;top:0">');
		document.write(newspaper[1]);
		document.write('</div></div></span>');
	}
	else
	{
		document.write('<table width="'+newspaperWidth+'" bgcolor="gainsboro">');
		document.write('<tr><td width="100%">');
		document.write(newspaper[0]);
		document.write('</td></tr><tr><td width="100%">');
		document.write(newspaper[1]);
		document.write('</td></tr><tr><td width="100%">');
		document.write('<a href="http://hkclweb.hkpl.gov.hk/hkclr2/igateway?svc=bsch&amp;col=128&amp;stype=fts&amp;param=title&amp;schtxt=Hong Kong Sunday Herald&amp;frm=1&amp;to=10&amp;max=200&amp;hitperpage=10&amp;ss=FullDetail"><img src="http://hkclweb.hkpl.gov.hk/doc/images/HKSH.jpg" alt="Hong Kong Sunday Herald" border="0" onMouseOver="imageOn2(this)" onMouseOut="imageOff2(this)" width="'+paperImgWidth+'" height="'+paperImgHeight+'"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://hkclweb.hkpl.gov.hk/hkclr2/igateway?svc=bsch&amp;col=128&amp;stype=fts&amp;param=title&amp;schtxt=Hong Kong Telegraph&amp;frm=1&amp;to=10&amp;max=200&amp;hitperpage=10&amp;ss=FullDetail"><img src="http://hkclweb.hkpl.gov.hk/doc/images/HKT.jpg" alt="Hong Kong Telegraph" border="0" onMouseOver="imageOn2(this)" onMouseOut="imageOff2(this)" width="'+paperImgWidth+'" height="'+paperImgHeight+'"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://hkclweb.hkpl.gov.hk/hkclr2/igateway?svc=bsch&amp;col=128&amp;stype=fts&amp;param=title&amp;schtxt=Hong Kong Weekly Press&amp;frm=1&amp;to=10&amp;max=200&amp;hitperpage=10&amp;ss=FullDetail"><img src="http://hkclweb.hkpl.gov.hk/doc/images/HKWP.jpg" alt="Hong Kong Weekly Press" border="0" onMouseOver="imageOn2(this)" onMouseOut="imageOff2(this)" width="'+paperImgWidth+'" height="'+paperImgHeight+'"></a>');
		document.write('</td></tr></table>');
	}

	document.write('</center>');
}
*/
