// utils.js

//// Left bar 'vnav' suckerfish menu /////////

function LeftBarLinks_Texyz(ifoc)
 {
   var files = new Array("index.htm", "profile.htm", "contact.htm");
   var labels = new Array("Home", "Profile", "Contact");

   WriteLeftBarMenu("", files, labels, ifoc); 
   document.write("<p><br><center><img src='logo_small_grey.gif' border=0></center></p>");
 }

function LeftBarLinks_TExtract(ifoc)
 {
   LeftBarLinks_TExtract1("", ifoc)
}

function LeftBarLinks_TExtract_Download(ifoc)
 {
   LeftBarLinks_TExtract1("../", ifoc)
 }

function LeftBarLinks_TExtract1(path, ifoc)
 {
   var files = new Array("index.htm", "features.htm", "versions.htm", 
		"download/index.htm", "register.htm", "biblio.htm", "index.htm#UserComments", "faq.htm", "../contact.htm");
   var labels = new Array("Home", "Features", "Versions / prices", 
		"Download", "Ordering", "Bibliography", "User comments", "FAQ", "Contact");

   WriteLeftBarMenu(path, files, labels, ifoc);

   //document.write("<p><center><img src='" + path + "../logo_small_grey.gif' border=0></center></p>");
   document.write("<center><img src='" + path + "../logo_small_grey.gif' border=0></center>");
}

function LeftBarLinks_TexTable(ifoc)
 {
   LeftBarLinks_TexTable1("", ifoc);
 }

function LeftBarLinks_TexTable_Download(ifoc)
 {
   LeftBarLinks_TexTable1("../", ifoc);
 }

function LeftBarLinks_TexTable1(path, ifoc)
 {
   var files = new Array("index.htm", "textable-features.htm", "download/index.htm", 
	"examples.htm", "order.htm", "../contact.htm");
   var labels = new Array("Home", "Features", "Download", "Examples", "Ordering", "Contact");

   WriteLeftBarMenu(path, files, labels, ifoc);

   document.write("<p><br><center><img src='" + path + "textable.gif' border=0 width=120></center></p>");
 }

function LeftBarLinks_Service(ifoc)
 {
   var path = "../";
   var files = new Array("index.htm", "/textract/biblio.htm", "contact.htm");
   var labels = new Array("Texyz", "Examples", "Contact");

   WriteLeftBarMenu(path, files, labels, ifoc);
 }

function WriteLeftBarMenu(path, files, labels, ifoc)
 { 	
   document.write("<ul id='vnav'>");

   var itembgfoc = "<font color='#1050d0'>";  // 1050d0 1050f0 c9d9ff
   var itemendfoc = "</font>";
   var itembg, itemend;

   for (var i = 0; i < files.length; i++)
     {
       itembg = i==ifoc? itembgfoc : "";
       itemend = i==ifoc? itemendfoc : "";

       document.write("<li><a href='" + path + files[i] + "'>" + itembg + labels[i] + itemend + "</a></li>");
     }
   document.write("</ul>");
 }

//// Top bar 'nav' suckerfish menu /////////

function TopBarLinks_Root(ifoc)
 {
	TopBarMenu("", ifoc);
 }

function TopBarLinks_Level1(ifoc)
 {
	TopBarMenu("../", ifoc);
 }

function TopBarLinks_Level2(ifoc)
 {
	TopBarMenu("../../", ifoc);
 }

function TopBarMenu(path, ifoc)
 {
	document.write("<ul id='nav'>");

	var files = new Array("index.htm", "profile.htm", "contact.htm");
	var labels = new Array("Texyz", "Profile", "Contact");
	WriteTopBarMenu(path, "", labels, files, ifoc==0);

	files = new Array("index.htm", "features.htm", "biblio.htm", "versions.htm", "download/index.htm", "register.htm");
	labels = new Array("TExtract", "Features", "Bibliography", "Versions", "Download", "Ordering");
	WriteTopBarMenu(path, "textract/", labels, files, ifoc==1);

	files = new Array("index.htm", "textable-features.htm", "download/index.htm", "examples.htm", "order.htm");
	labels = new Array("TexTable", "Features", "Download", "Examples", "Ordering");
	WriteTopBarMenu(path, "textable/", labels, files, ifoc==2);

	files = new Array("contact.htm");
	labels = new Array("Contact");
	WriteTopBarMenu(path, "", labels, files, ifoc==3);

	document.write("</ul>");
}

function WriteTopBarMenu(path, path2, subitems, files, bfoc)
{
	var itembg = bfoc? "'><font color='#ffffff'>" :"'>"; // d0e0ff 1155ff
	var itemend = bfoc? "</font></a>" : "</a>";

	document.write("<li><a href='" + path + path2 + files[0] + itembg + subitems[0] + itemend);

	WriteTopBarSubMenu(path, path2, files, subitems);
	document.write("</li>");
}

function WriteTopBarSubMenu(path, path2, files, labels)
 { 	
   document.write("<ul>");
   var padding = "&nbsp;&nbsp;&nbsp;";		// padding hack
   for (var i = 0; i < files.length; i++)
       document.write("<li><a href='" + path + path2 + files[i] + "' class='subitem'>" + padding + labels[i] + "</a></li>");
   document.write("</ul>");
 }

// other auxs

function CopyRight(btrademark)
 {
	document.write("<hr align=center color='#70a0c0'>");
	document.write("<font size = '-2'>© 2010 TEXYZ.");
      if (btrademark)
	    document.write(" <b>TExtract</b> is a trademark of  TEXYZ.");
	document.write("</font>");
 }

function EAddress1(szid)
 {
   document.write("<a href=" + "mail" + "to" + ":" + szid + "&#0" + "64;" + "texyz" + "." + "com" + ">" + 
             szid + "&#0" + "64;" + "texyz" + "." + "com" + "</a>");
 }

function EAddress2(szid, szlinktext)
 {
   document.write("<a href=" + "mail" + "to" + ":" + szid + "&#0" + "64;" + "texyz" + "." + "com" + ">" + 
             szlinktext + "</a>");
 }

function EAddress3(user, domain, extension)
 {
   var eaddress = user + "&#0" + "64;" + domain + "." + extension;

   document.write("<a href=" + "mail" + "to" + ":" + eaddress + ">" + eaddress + "</a>");
 }

////////////////////////////