var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
function addTab(selTab) {
	var which = document.getElementById('tabrow');
	var linkArr = ['','About.htm','Gallery.htm', 'MakeBook.htm', '../Manual/index.html','Download.htm','Contact.htm'];
	var tabArr = ['','About','Gallery','Make a book', 'Instructions','Download','Contact'];
	var str = '<td height="32" width="95"></td>';
	for (var i = 1; i <= 6; i++) {
		str += '<td class="MsoNormal';
		if (selTab == tabArr[i])
			str += 'Sel';
		else
			str += 'Unsel';
		str += '" onMouseOver="movein(\'choice' + i + '\')" onMouseOut="moveout(\'choice' + i + '\')" onClick="moveclick(\'' + linkArr[i] + '\')"';
		str += ' id="choice' + i + '" width="153" height="32">' + tabArr[i] + '</td>';
	}
	str += '<td></td>';
	which.innerHTML = str;
}
function addContentTop() {
	var which = document.getElementById('contenttop');
	var str = '<td height="18" width="46" background="../HTMLimage/top-left.png"></td>';
    str += '<td height="18" background="../HTMLimage/top-middle.png"></td>';
    str += '<td height="18" width="48" background="../HTMLimage/top-right.png"></td>';
	which.innerHTML = str;
}
function addContentBottom() {
	var which = document.getElementById('contentbottom');
	var str = '<td height="80" width="46" background="../HTMLimage/bottom-left.png"></td>';
    str += '<td height="80" background="../HTMLimage/bottom-middle.png"></td>';
    str += '<td height="80" width="48" background="../HTMLimage/bottom-right.png"></td>';
	which.innerHTML = str;
}
function addPlaster(trItem) {
 	var which = document.getElementById(trItem);
    var str = '<td height="8" width="20"></td><td height="8" width="18"></td>';
    str += '<td height="8" width="180" background="../HTMLimage/plaster.gif"></td>';
    str += '<td height="8" width="18"></td>';
	which.innerHTML = str;
}
function addBorderTop() {
	var which = document.getElementById('bordertop');
	var str = '<td height="20" width="20"></td>'
    str += '<td height="20" width="18" background="../HTMLimage/ht-tl.png"></td>';
    str += '<td height="20" width="180"background="../HTMLimage/ht-tm.png"></td>';
    str += '<td height="20" width="18" background="../HTMLimage/ht-tr.png"></td>';
    which.innerHTML = str;
}
function addBorderBottom() {
	var which = document.getElementById('borderbottom');
	var str = '<td height="20" width="20"></td>'
    str += '<td height="20" width="18" background="../HTMLimage/ht-bl.png"></td>';
    str += '<td height="20" width="180"background="../HTMLimage/ht-bm.png"></td>';
    str += '<td height="20" width="18" background="../HTMLimage/ht-br.png"></td>';
    which.innerHTML = str;
}
function addList(selList) {
	var linkArr = ['About.htm', 'Details.htm', 'Publications.htm', 'Links.htm'];
	var titleArr = ['Description', 'Project details', 'Publications', 'Links'];
	addStarList(linkArr,titleArr,selList);
}
function addCList(selList) {
	var linkArr = ['Contact.htm', 'http://www.cs.waikato.ac.nz/~ihw', 'http://www.cs.waikato.ac.nz/~davidb'];
	var titleArr = ['Veronica Liesaputra', 'Ian H. Witten', 'David Bainbridge'];
	addStarList(linkArr,titleArr,selList);
}
function addStarList(linkArr,titleArr,selList) {
	var which = document.getElementById('listcolumn');
	var str = '<font size="2">';
	for (var i = 0; i < linkArr.length; i++) {
		str += '<p style="margin-left: 8.0pt;" class="MsoNormalNavigation" id="ht';
		str += i + '" onMouseOver="listin2(\'ht' + i + '\',\'ha' + i + '\')" onMouseOut="listout2(\'ht';
		str += i + '\',\'ha' + i + '\')" onClick="moveclick(\'' + linkArr[i] + '\')"><img id="ha';
		str += i + '" src="../HTMLimage/star';
		if (selList == titleArr[i])
			str += 'b';
		str += '.gif" width="10" height="10" />&nbsp;' + titleArr[i];
	}
    str += '</font>';
	which.innerHTML = str;
}
function open_bookmaker() {
	window.location.href="../Bookmaker/index.php";
}
function movein(whichItem){
  var which = document.getElementById(whichItem);
  which.style.color='#FFFFFF';
}
function moveout(whichItem){
  var which = document.getElementById(whichItem);
  if(which.className == 'MsoNormalSel')
	  which.style.color='#9c0e32';
  else
	  which.style.color='#4D4D4D';
}
function moveclick(location){
	window.open(location,"_self");
}
/*function listin(whichItem,arrowItem){
  var which = document.getElementById(whichItem);
  var arrow = document.getElementById(arrowItem);
  
  which.style.color='#99ccff';
  which.style.cursor='pointer';
  if (arrow.src.indexOf("arrow2.gif") > -1)
	  arrow.src = "../HTMLimage/arrowb2.gif";
  else if (arrow.src.indexOf("arrow.gif") > -1)
	  arrow.src = "../HTMLimage/arrowb.gif";	
}
function listout(whichItem,arrowItem){
  var which = document.getElementById(whichItem);
  var arrow = document.getElementById(arrowItem);
  
  which.style.color='#7f7f7f';
  if (arrow.src.indexOf("arrowb2.gif") > -1)
	  arrow.src = "../HTMLimage/arrow2.gif";
  else if (arrow.src.indexOf("arrowb.gif") > -1)
	  arrow.src = "../HTMLimage/arrow.gif";	
}
function listclick(whichItem,arrowItem){
  var which = document.getElementById(whichItem);
  var arrow = document.getElementById(arrowItem);
  
  if (which.style.display == "none")
  {
	  arrow.src = "../HTMLimage/arrowb.gif";
	  which.style.display = "";
  }
  else
  {
	  arrow.src = "../HTMLimage/arrowb2.gif";
	  which.style.display = "none";
  }
}*/
function listin2(whichItem,starItem){
  var which = document.getElementById(whichItem);
  var star = document.getElementById(starItem);
  
  which.style.color='#99ccff';
  which.style.cursor='pointer';
  if (star.src.indexOf("star.gif") > -1)
	  star.src = "../HTMLimage/star2.gif";
  else if (star.src.indexOf("starb.gif") > -1)
	  star.src = "../HTMLimage/starb2.gif";
}
function listout2(whichItem,starItem){
  var which = document.getElementById(whichItem);
  var star = document.getElementById(starItem);
  
  which.style.color='#ffffff';
  if (star.src.indexOf("star2.gif") > -1)
	  star.src = "../HTMLimage/star.gif";
  else if (star.src.indexOf("starb2.gif") > -1)
	  star.src = "../HTMLimage/starb.gif";
}
function chgimg(imgItem,imgFile){
  var which = document.getElementById(imgItem);
  which.src = imgFile;
}
