
// This script is © Aephid Technologies www.aephid.com.

// IMPORTANT NOTE: This file is not to be published to online store.
//                 See "Store Specific\bars.js".

function WriteTopBar(Title)
{
  WriteTopBarEx(Title, "");
}

function WriteTopBarEx(Title, ImagePrefix)
{
  WriteTopBarExNoSpaceBelow(Title, ImagePrefix);
	document.writeln("<br clear = all>");
}

function WriteSpacerTableInBarsJs(pixelWidth, pixelHeight)
{
  document.writeln("<table border = 0 cellpadding = 0 cellspacing = 0 ");
  
  if(pixelWidth > 0)
  {
    document.writeln("width = " + pixelWidth);
  }

  if(pixelHeight > 0)
  {
    document.writeln("height = " + pixelHeight);
  }

  document.writeln("><tr><td></td></tr></table>");
}

function WriteTopBarExNoSpaceBelow(Title, ImagePrefix)
{
  WriteWebpositionTracking();

  AeLogoImageLink = ImagePrefix + "ae-logo-top-bar.jpg";

	document.writeln("<table cellspacing = 0 cellpadding = 0 border = 0 width = 100%>");
	document.writeln("<tr>");
	document.writeln("  <td valign = bottom width = 100%>");
	
	document.writeln("    <table cellspacing = 0 cellpadding = 0 border = 0"
                      + " width = 100%>");
	document.writeln("    <tr>");
	document.writeln("      <td align = center valign = center>");
                            WriteBarLinkUnterminated("index.html");

	document.writeln("  	    <img src = '" + AeLogoImageLink + 
                            "' alt = 'ae home'" +
                            " border = 0></img><a>");

	document.writeln("      </td>");

/*
  if(!DoesUrlContain("\affiliate.html") && !DoesUrlContain("regsoft"))
  {
	  document.writeln("    <td valign = center width = 100%>");
	  document.writeln("      <center>");
	  document.writeln("      <p class = 'bodytext'>");
	  document.writeln("        <a href = 'photokeeper-download.html'>get</a>");
	  document.writeln("        the hot new 2004 March release!");
	  document.writeln("      </p>");
	  document.writeln("      </center>");
	  document.writeln("    </td>");
  }
  */

	document.writeln("   </tr>");
	document.writeln("   </table>");

          	            WriteSpacerTableInBarsJs(0, 5);

                        WriteAnyBarEx(Title, true, true, ImagePrefix);

	document.writeln("</tr>");
	document.writeln("</table>");
}

function WriteBigBar(Title)
{
  WriteBigBarEx(Title, "");
}

function WriteBigBarEx(Title, ImagePrefix)
{
  WriteAnyBarEx(Title, true, false, ImagePrefix);
}

function WriteLittleBar(Title)
{ 
  WriteLittleBarEx(Title, "");
}

function WriteLittleBarEx(Title, ImagePrefix)
{
  WriteAnyBarEx(Title, false, false, ImagePrefix);
}

function WriteAnyBar(Title, isBig, isTop)
{    
  WriteAnyBarEx(Title, isBig, isTop, "");
}

function WriteAnyBarEx(Title, isBig, isTop, ImagePrefix)
{
  RefString = GetStringWithDashesInsteadOfSpaces(Title);

  AlignString = "left";
  {
    //if(isTop)
    {
      AlignString = "center";
    }
  }

	document.writeln("<table border = 0 cellspacing = 0 cellpadding = 5 width = 100%");
	document.writeln(" background = 'barback.jpg'>");
	document.writeln("	<tr>");
	document.writeln("	<td background = 'barback.jpg' align = '" + 
	                    AlignString + "' valign = 'center' width = 100%>");
	document.writeln("		<table border = 0 cellspacing = 0 cellpadding = 1 bgcolor = '' ");
	document.writeln("		 background = 'barback.jpg'>");
	document.writeln("		<tr>");

                          WriteBmpTextEx(Title, "20", true, ImagePrefix);

	document.writeln("		</tr>");
	document.writeln("		</table>");
	document.writeln("	</td>");

	document.writeln("	<td align = 'right'>");
	document.writeln("		<table border = 0 cellspacing = 0 cellpadding = 3 bgcolor = '' ");
	document.writeln("		 background = 'barback.jpg'>");
	document.writeln("		<tr>");

/*
  if(isBig)
  {
	  document.writeln("		<td>");
    document.writeln("      <p class = 'h1noalign'>");
    document.writeln("      nav:");
    document.writeln("      </p>");
	  document.writeln("		</td>");
  }

  if(Title != ' ' && !IsHomePage())
  {
    document.writeln("		<td>");
                            WriteBarLinkUnterminated("index.html");
    document.writeln("      <div class = 'linkorange'>");
    document.writeln("       ae</a>");
    document.writeln("      </div>");
	  document.writeln("		</td>");
  }

  if(isBig)
  {
	  document.writeln("		<td>");
                            WriteBarLinkUnterminated("news.html");
    document.writeln("      <div class = 'linkorange'>");
    document.writeln("      news</a>");
    document.writeln("      </div>");
	  document.writeln("		</td>");

	  document.writeln("		<td>");
                            WriteBarLinkUnterminated("products.html");
    document.writeln("      <div class = 'linkorange'>");
    document.writeln("      products</a>");
    document.writeln("      </div>");
	  document.writeln("		</td>");

	  document.writeln("		<td>");
                            WriteBarLinkUnterminated("photokeeper-dental.html");
    document.writeln("      <div class = 'linkorange'>");
    document.writeln("      dental</a>");
    document.writeln("      </div>");
	  document.writeln("		</td>");

	  document.writeln("		<td>");
                            WriteBarLinkUnterminated("store.html");
    document.writeln("      <div class = 'linkorange'>");
    document.writeln("      store</a>");
    document.writeln("      </div>");
	  document.writeln("		</td>");

	  document.writeln("		<td>");
                            WriteBarLinkUnterminated("photokeeper-download.html");
    document.writeln("      <div class = 'linkorange'>");
    document.writeln("      download</a>");
    document.writeln("      </div>");
	  document.writeln("		</td>");

	  document.writeln("		<td>");
                            WriteBarLinkUnterminated("photokeeper-tour.html");
    document.writeln("      <div class = 'linkorange'>");
    document.writeln("      tour</a>");
    document.writeln("      </div>");
	  document.writeln("		</td>");

	  document.writeln("		<td>");
                            WriteBarLinkUnterminated("photokeeper-tutorial.html");
    document.writeln("      <div class = 'linkorange'>");
    document.writeln("      tutorial</a>");
    document.writeln("      </div>");
	  document.writeln("		</td>");

	  document.writeln("		<td>");
                            WriteBarLinkUnterminated("support.html");
    document.writeln("      <div class = 'linkorange'>");
    document.writeln("      support</a>");
    document.writeln("      </div>");
	  document.writeln("		</td>");

	  document.writeln("		<td>");
                            WriteBarLinkUnterminated("privacy.html");
    document.writeln("      <div class = 'linkorange'>");
    document.writeln("      privacy</a>");
    document.writeln("      </div>");
	  document.writeln("		</td>");
  }
  */

	document.writeln("		</tr>");
	document.writeln("		</table>");
	document.writeln("	</td>");

	document.writeln("	</tr>");
	document.writeln("</table>");
}

function DoesUrlContain(SearchUrlCriteria)
{
  CurrentUrl = "";
  CurrentUrl = document.location.href;

  if(CurrentUrl.search(SearchUrlCriteria) != -1)
  {
    return true;
  }
  else
  {
    return false;
  }
}

function IsHomePage()
{
  CurrentUrl = "";
  CurrentUrl = document.location.href;

  if(CurrentUrl == "http://www.aephid.com/" ||
   CurrentUrl == "http://www.aephid.com")
  {
    return true;
  }
  else
  {
    SearchUrlCriteria = "\index.html";
    if(CurrentUrl.search(SearchUrlCriteria) != -1)
    {
      return true;
    }
    else
    {
      return false;
    }
  }
}

function WriteBarLinkUnterminated(RelativeUrl)
{
  StoreUrlCriteria = "regsoft";
  CurrentUrl = "";
  CurrentUrl = document.location.href;

  if(CurrentUrl.search(StoreUrlCriteria) != -1)
  {
    // In store. Use absolute url.
    AbsoluteUrl = "http://www.aephid.com/";
    AbsoluteUrl += RelativeUrl;
    document.writeln("<a href = '" + AbsoluteUrl + "' target = '_top'>");
  }
  else
  {
    // Not in store. 
    document.writeln("<a href = '" + RelativeUrl + "' target = '_top'>");
  }
}

function GetImageFilenameForLetter(Letter, PointSize)
{
  Filename = PointSize + "-";

  if(Letter == " ")
  {
    Filename += "_";
  }
  else
  {
    if(Letter == "æ" || Letter == "*")
    { 
      Filename += "ae";
    }
    else 
    if(Letter == "'")
    { 
      Filename += "apo";
    }
    else 
    if(Letter == "+")
    { 
      Filename += "plus";
    }
    else 
    if(Letter == ".")
    { 
      Filename += "period";
    }
    else 
    if(Letter == "?")
    { 
      Filename += "question";
    }
    else
    {
      Filename += Letter;
    }
  }

  Filename += ".gif";

  return Filename;
}

function WriteBmpText(Text, PointSize, defineColumn)
{   
  WriteBmpTextEx(Text, PointSize, defineColumn, "");
}

function WriteBmpTextEx(Text, PointSize, defineColumn, ImagePrefix)
{
  Text = GetStringWithSomethingInsteadOfSpaces(Text, "_");

  Line = "";
  Line += "<b>";
  Line += Text;
  Line += "</b>";
  document.writeln(Line);
}

function GetStringWithSomethingInsteadOfSpaces(Text, Something)
{
  StringWithSomethingInsteadOfSpaces = "";
  for(letter = 0; letter < Text.length; letter++)
  {
	  character = Text.substr(letter, 1);

    if(character == " ")
    {
      StringWithSomethingInsteadOfSpaces += Something;
    }
    else
    {
      StringWithSomethingInsteadOfSpaces += character;
    }
  }

  return StringWithSomethingInsteadOfSpaces;
}
function GetStringWithDashesInsteadOfSpaces(Text)
{
  StringWithDashesInsteadOfSpaces = 
    GetStringWithSomethingInsteadOfSpaces(Text, "-");

  return StringWithDashesInsteadOfSpaces;
}

function WriteWebpositionTracking()
{}

