///////////////////////////////////////
//        Data Master 2003           //
//   Copyright (c) 1993-2009 RRR     //
///////////////////////////////////////

/* scripts for building navigation and design */

function isCHM()
{
var PHREF=window.location.href;  
var nav=navigator.userAgent;
if ((PHREF.indexOf('@MSITStore')>0) || (window.location.search=='?chm') || (nav.indexOf('Windows CE')>0)) 
{return true} else {return false};
};

// this function builds DIFFERENT headers only for pages that must be included into CHM
function buildTopH1(Title)
{
// add Title for some pages
var PHREF=window.location.href; 
if ((PHREF.indexOf('about')>0) || (PHREF.indexOf('usrguide')>0) || (PHREF.indexOf('pgmguide')>0) 
  || (PHREF.indexOf('applications')>0) || (PHREF.indexOf('gettingstarted')>0) || (PHREF.indexOf('disclaim')>0)) 
{document.writeln('<h1 class="WWWHeader">'+Title+'</h1>')};
};

function buildTop(Title)
{
  if (window.location.search=='?print') {buildTopH1(Title); return;};
  if (isCHM()) {buildTopCHM(Title)} else {buildTopWWW(Title); buildTopH1(Title);};
};

function buildBottom()
{
  if (window.location.search=='?print') return;
  if (isCHM()) {buildBottomCHM()} else {buildBottomWWW()};
};

/* scripts for DM2003 Help file */

function buildTopCHM(Title)
{
document.write('<h1 class="CHMHeader">'+Title+'</h1>');
};

function MyYe()
{
var d=new Date();
return d.getFullYear();
}

function buildBottomCHM()
{
document.write('<div class="CHMFooter"><a href="disclaim.htm" class="CHMFooterLnk">'+
'&nbsp;&copy; '+MyYe()+' RRR. All rights reserved. Terms of use.</a></div>');
};

/* scripts for DM2003 web site */

var NewsDate='8.3.2010';
var NewsBox='New version of DM2003 ActiveX fitting engine (build #380) made available for download.';

function WWWHMenuOn(item)
{
  item.className="WWWHMenuActive";
};

function WWWHMenuOff(item)
{
  item.className="WWWHMenuNormal";
};

function WWWLMenuOn(item)
{
  item.className="WWWLMenuActive";
};

function WWWLMenuOff(item)
{
  item.className="WWWLMenuNormal";
};

function WWWLMenuOffG(item)
{
  item.className="WWWLMenuGuide";
};

var BaseHRef=''; // define '../' for pages placed in subdirs BEFORE call Build functions

function WWWMenuClick(fname)
{
// horizontal menu
  if (fname==0) window.location.href=BaseHRef+'news.html';
  if (fname==1) window.location.href=BaseHRef+'index.html';
  if (fname==2) window.location.href=BaseHRef+'download.html';
  if (fname==3) window.location.href=BaseHRef+'about.htm';
  if (fname==4) window.location.href=BaseHRef+'links.html';
// common
  if (fname==10) window.location.href=BaseHRef+'screenshots.html';
  if (fname==11) window.location.href=BaseHRef+'usrguide.htm';
  if (fname==12) window.location.href=BaseHRef+'pgmguide.htm';
// for buildUsrBox()
  if (fname==21) window.location.href=BaseHRef+'gettingstarted.htm';
  if (fname==22) window.location.href=BaseHRef+'uiarchitecture.htm';
  if (fname==23) window.location.href=BaseHRef+'mainform.htm';
  if (fname==24) window.location.href=BaseHRef+'dataform.htm';
// for buildPgmBox()
  if (fname==31) window.location.href=BaseHRef+'dm.htm';
  if (fname==32) window.location.href=BaseHRef+'dmforms.htm';
  if (fname==33) window.location.href=BaseHRef+'scripting.htm';
  if (fname==34) window.location.href=BaseHRef+'applets.htm';
  if (fname==35) window.location.href=BaseHRef+'daq.htm';
// for buildGenBox()
  if (fname==41) window.location.href=BaseHRef+'applications.htm';
  if (fname==42) window.location.href=BaseHRef+'gettingstarted.htm';
// for awards
  if (fname==100) window.location.href=BaseHRef+'links.html#awards';
};

/* design build scripts converted from webpagetemplate.html */

function buildUsrBox() // user's guide links
{
document.writeln('<tr><td class="WWWLMenuNormal" onmouseover="WWWLMenuOn(this)" onmouseout="WWWLMenuOff(this)" ');
document.writeln('onclick="WWWMenuClick(21)">Getting Started</td></tr>');

document.writeln('<tr><td class="WWWLMenuNormal" onmouseover="WWWLMenuOn(this)" onmouseout="WWWLMenuOff(this)" ');
document.writeln('onclick="WWWMenuClick(22)">User Interface Architecture</td></tr>');

document.writeln('<tr><td class="WWWLMenuNormal" onmouseover="WWWLMenuOn(this)" onmouseout="WWWLMenuOff(this)" ');
document.writeln('onclick="WWWMenuClick(23)">Main Window</td></tr>');

document.writeln('<tr><td class="WWWLMenuNormal" onmouseover="WWWLMenuOn(this)" onmouseout="WWWLMenuOff(this)" ');
document.writeln('onclick="WWWMenuClick(24)">Data Windows</td></tr>');
};

function buildPgmBox() // programmer's guide links
{
document.writeln('<tr><td class="WWWLMenuNormal" onmouseover="WWWLMenuOn(this)" onmouseout="WWWLMenuOff(this)" ');
document.writeln('onclick="WWWMenuClick(31)">DM2003 Objects</td></tr>');

document.writeln('<tr><td class="WWWLMenuNormal" onmouseover="WWWLMenuOn(this)" onmouseout="WWWLMenuOff(this)" ');
document.writeln('onclick="WWWMenuClick(32)">DMForms Objects</td></tr>');

document.writeln('<tr><td class="WWWLMenuNormal" onmouseover="WWWLMenuOn(this)" onmouseout="WWWLMenuOff(this)" ');
document.writeln('onclick="WWWMenuClick(33)">Scripting Overview</td></tr>');

document.writeln('<tr><td class="WWWLMenuNormal" onmouseover="WWWLMenuOn(this)" onmouseout="WWWLMenuOff(this)" ');
document.writeln('onclick="WWWMenuClick(34)">HTML Applets</td></tr>');

document.writeln('<tr><td class="WWWLMenuNormal" onmouseover="WWWLMenuOn(this)" onmouseout="WWWLMenuOff(this)" ');
document.writeln('onclick="WWWMenuClick(35)">Advanced DAQ</td></tr>');
};

function buildGenBox() // general links
{
document.writeln('<tr><td class="WWWLMenuNormal" onmouseover="WWWLMenuOn(this)" onmouseout="WWWLMenuOff(this)" ');
document.writeln('onclick="WWWMenuClick(41)">Applications</td></tr>');

document.writeln('<tr><td class="WWWLMenuNormal" onmouseover="WWWLMenuOn(this)" onmouseout="WWWLMenuOff(this)" ');
document.writeln('onclick="WWWMenuClick(0)">News</td></tr>');

document.writeln('<tr><td class="WWWLMenuNormal" onmouseover="WWWLMenuOn(this)" onmouseout="WWWLMenuOff(this)" ');
document.writeln('onclick="WWWMenuClick(2)">Downloads</td></tr>');

document.writeln('<tr><td class="WWWLMenuNormal" onmouseover="WWWLMenuOn(this)" onmouseout="WWWLMenuOff(this)" ');
document.writeln('onclick="WWWMenuClick(42)">Getting Started</td></tr>');
};

function buildBox(Title) // builds context links
{
  if (Title=="User's Guide") buildUsrBox();
  if (Title=="Programmer's Guide") buildPgmBox();
  if ((Title!="User's Guide") && (Title!="Programmer's Guide")) buildGenBox();
};

function buildTopWWW(Title)
{
document.writeln('<table border="0" cellpadding="0" cellspacing="4">');
document.writeln('  <tr>');
document.writeln('    <td><table border="0" width="100%" cellspacing="0" cellpadding="5" class="WWWTitleTable">');
document.writeln('    <tr><td class="WWWTitleCell" nowrap>Data Master 2003</td></tr></table>');
document.writeln('  </td>');
document.writeln('  </tr>');
document.writeln('  <tr>');
document.writeln('    <td>');
document.writeln('    <table border="0" cellpadding="0" cellspacing="0" width="100%">');
document.writeln('      <tr>');
document.writeln('        <td valign="top">');
document.writeln('        <table width="100" border="0" cellpadding="4" cellspacing="0">');
document.writeln('          <tr><td class="WWWHMenuNormal" height="24" onmouseover="WWWHMenuOn(this)" ');
document.writeln('          onmouseout="WWWHMenuOff(this)" onclick="WWWMenuClick(0)">What\'s New</td></tr>');
document.writeln('          <tr><td class="WWWLMenuSpace">');
document.writeln('<b>'+NewsDate+'</b><br>'+NewsBox);
document.writeln('<br><a type="application/rss+xml" href="'+BaseHRef+'rss.xml"><img src="'+BaseHRef);
document.writeln('rss.gif" border="0" width="88" height="15" hspace="2" vspace="5" alt="RSS 2.0"></a>');
document.writeln('&nbsp;&nbsp;&nbsp;<a href="'+BaseHRef+'news.html">More news &gt;&gt;</a>');
document.writeln('          </td></tr>');
document.writeln('          <tr>');
// document.writeln('            <td>&nbsp;</td>');
document.writeln('            <td><img src="'+BaseHRef+'design/clear.gif" width="1" height="1" border="0"></td>');
document.writeln('          </tr>');
// document.writeln('          <tr><td class="WWWHMenuSpace" height="24">More Links</td></tr>');
document.writeln('<tr><td class="WWWHMenuNormal" height="24" onmouseover="WWWHMenuOn(this)" ');
document.writeln(' onmouseout="WWWHMenuOff(this)" onclick="WWWMenuClick(100)">Awards</td></tr>');
document.writeln('<tr><td class="WWWLMenuSpace">Data Master 2003 have got highest &quot;5&nbsp;Cows&quot; score at Tucows.com <br>');
document.writeln('<a href="http://www.tucows.com/preview/411087" target="_blank"><img ');
document.writeln('src="'+BaseHRef+'tucows.gif" border="0" width="76" height="12" hspace="7" vspace="5" alt="5 Tucows rating"></a> ');
document.writeln('&nbsp;&nbsp;&nbsp;<a href="'+BaseHRef+'links.html#awards">More awards &gt;&gt;</a></td></tr>');
document.writeln('<tr><td><img src="'+BaseHRef+'design/clear.gif" width="1" height="1" border="0"></td></tr>');
///
document.writeln('          <tr><td class="WWWHMenuNormal" height="24" onmouseover="WWWHMenuOn(this)" ');
document.writeln('          onmouseout="WWWHMenuOff(this)" onclick="WWWMenuClick(4)">More Links</td></tr>');
document.writeln('          <tr><td class="WWWLMenuNormal" onmouseover="WWWLMenuOn(this)" onmouseout="WWWLMenuOff(this)" ');
document.writeln('          onclick="WWWMenuClick(10)">Screenshots</td></tr>');
if (Title=="User's Guide")
{document.writeln('          <tr><td class="WWWLMenuGuide" onmouseover="WWWLMenuOn(this)" onmouseout="WWWLMenuOffG(this)" ');} else
{document.writeln('          <tr><td class="WWWLMenuNormal" onmouseover="WWWLMenuOn(this)" onmouseout="WWWLMenuOff(this)" ');}
document.writeln('          onclick="WWWMenuClick(11)">User\'s Guide</td></tr>');
if (Title=="Programmer's Guide")
{document.writeln('          <tr><td class="WWWLMenuGuide" onmouseover="WWWLMenuOn(this)" onmouseout="WWWLMenuOffG(this)" ');} else
{document.writeln('          <tr><td class="WWWLMenuNormal" onmouseover="WWWLMenuOn(this)" onmouseout="WWWLMenuOff(this)" ');};
document.writeln('          onclick="WWWMenuClick(12)">Programmer\'s<br>Guide</td></tr>');
buildBox(Title);
buildSiteMeter();
document.writeln('        </table>');
document.writeln('        </td>');
document.writeln('        <td><img src="'+BaseHRef+'design/clear.gif" width="4" height="1" border="0"></td>');
document.writeln('        <td class="WWWDividerLine"><img src="'+BaseHRef+'design/clear.gif" width="1" height="1" border="0"></td>');
document.writeln('        <td><img src="'+BaseHRef+'design/clear.gif" width="4" height="1" border="0"></td>');
document.writeln('        <td valign="top">');
document.writeln('        <table border="0" cellpadding="0" cellspacing="0" height="24" width="100%">');
document.writeln('          <tr>');
document.writeln('            <td class="WWWHMenuNormal" onmouseover="WWWHMenuOn(this)" onmouseout="WWWHMenuOff(this)" onclick="WWWMenuClick(1)">&nbsp;<img');
document.writeln('            src="'+BaseHRef+'design/home.gif" width="16" height="16" border="0" align="absmiddle" hspace="3">Home&nbsp;&nbsp;</td>');
document.writeln('            <td width="1" class="WWWHMenuDivider"><img src="'+BaseHRef+'design/clear.gif" width="1" height="1" border="0"></td>');
document.writeln('            <td class="WWWHMenuNormal" onmouseover="WWWHMenuOn(this)" onmouseout="WWWHMenuOff(this)" onclick="WWWMenuClick(2)">&nbsp;<img');
document.writeln('            src="'+BaseHRef+'design/download.gif" width="16" height="16" border="0" align="absmiddle" hspace="3">Download&nbsp;&nbsp;</td>');
document.writeln('            <td width="1" class="WWWHMenuDivider"><img src="'+BaseHRef+'design/clear.gif" width="1" height="1" border="0"></td>');
document.writeln('            <td class="WWWHMenuNormal" onmouseover="WWWHMenuOn(this)" onmouseout="WWWHMenuOff(this)" onclick="WWWMenuClick(3)">&nbsp;<img');
document.writeln('            src="'+BaseHRef+'design/manual.gif" width="16" height="16" border="0" align="absmiddle" hspace="3">About&nbsp;DM2003&nbsp;&nbsp;</td>');
document.writeln('            <td width="1" class="WWWHMenuDivider"><img src="'+BaseHRef+'design/clear.gif" width="1" height="1" border="0"></td>');
document.writeln('            <td nowrap align="right" width="99%" class="WWWHMenuSpace"><a href="'+BaseHRef+'feedback.html" class="WWWEMail"> ');
document.writeln('            <img src="'+BaseHRef+'design/mail.gif" width="16" height="16" border="0" align="absmiddle" hspace="3">Contacts</a>&nbsp;</td>');
document.writeln('          </tr>');
document.writeln('        </table>');
};

function buildBottomWWW()
{
document.writeln('        </td>');
document.writeln('      </tr>');
document.writeln('    </table>');
document.writeln('    </td>');
document.writeln('  </tr>');
document.writeln('  <tr>');
document.writeln('    <td class="WWWDividerLine" height="1"></td>');
document.writeln('  </tr>');
document.writeln('  <tr>');
document.writeln('    <td>');
document.writeln('      <table border="0" width="100%" cellspacing="0" cellpadding="0"><tr>');
document.writeln('      <td class="WWWFooter">&copy; '+MyYe()+' <a href="http://rrr.datamaster2003.com" class="WWWFooterLnk">RRR</a>. ');
document.writeln('      All rights reserved.&nbsp;<a href="'+BaseHRef+'disclaim.htm" class="WWWFooterLnk">Terms of use.</a></td>');
document.writeln('      <td align="right" class="WWWFooter"><a href="#top" class="WWWFooterLnk"><img border="0" src="'+BaseHRef+'design/top.gif" ');
document.writeln('      hspace="4" align="absbottom" width="9" height="11">Top</a>&nbsp;&nbsp;&nbsp;<a href="?print" ');
document.writeln('      class="WWWFooterLnk"><img border="0" src="'+BaseHRef+'design/printer.gif" align="absbottom" hspace="4" width="15" ');
document.writeln('      height="11">Printable version</a></td>');
document.writeln('      </tr></table>');
document.writeln('    </td>');
document.writeln('  </tr>');
document.writeln('</table>');
};

/* Show and hide dynamic item descriptions */

function ShowItemDescription(dName, ClsName)
{
var i;
var divs;
var nav=navigator.userAgent;
var isMSIE4=nav.indexOf('MSIE 4')>0;
  if (isMSIE4)
    divs=document.all.tags('div') // doesn't work in Mozilla!
  else
    divs=document.body.getElementsByTagName("DIV"); // doesn't work in MSIE4!
  if (divs==null) return;
  for (i=0; i<divs.length; i++)
  {
    if (divs[i].className==ClsName)
    {
      divs[i].style.display='none';
    }; 
    if (divs[i].id==dName)
    {
      divs[i].style.display='block';
      divs[i].scrollIntoView();
    };
  };
};

/* script for interface table (PGM Guide) */

function ShowMemberDescription(dName)
{
  ShowItemDescription(dName, 'PgmGuideMemberDescription');
};

/* script for interface table (USR Guide) */

function ShowActionDescription(dName)
{
  ShowItemDescription(dName, 'UsrGuideActionDescription');
};

/* scripts for thumbnails (about and screenshots) */

function ThOn(el)
{
  if (document.all) {el.className="ThGrooved"};
};

function ThOff(el)
{
  if (document.all) {el.className="ThNormal"};
};

/* sitemeter code */

// Copyright (c)2003 Site Meter, Inc.
// modified by RRR for DM2003 site 

function buildSiteMeter()
{

var g_date=new Date();
var g_hours=0;
var g_minutes=0;
var g_r="";
var g_rtype="0";
var g_server ="sm1.sitemeter.com"
var g_ip="";
var site="sm1dm2003"

// Get the User Agent Name
var g_agent = navigator.appName;

// if g_frames is true then try getting the framed referral (with out error checking)
if (typeof(g_frames) != "undefined")
	if (g_frames)
		g_r=top.document.referrer;

// Get the referral for non-multi-domained-framed sites using a Netscape browser
if ((g_r == "") || (g_r == "[unknown origin]") || (g_r == "unknown") || (g_r == "undefined"))
	if (document["parent"] != null) 
		if (parent["document"] != null) // ACCESS ERROR HERE!
			if (parent.document["referrer"] != null) 
				if (typeof(parent.document) == "object")
				{
					g_rtype="1";
					g_r=parent.document.referrer; 
				}

// Get the referral for the current document if a framed referral wasn't found
if ((g_r == "") || (g_r == "[unknown origin]") || (g_r == "unknown") || (g_r == "undefined"))
	if (document["referrer"] != null) 
	{
		g_rtype="4";
		g_r = document.referrer;
	}

// Get the hours
if (g_date)
	g_hours=g_date.getHours();

// Get the minutes
if (g_date)
	g_minutes=g_date.getMinutes();

// Convert all the 'unknown's into blank
if ((g_r == "") || (g_r == "[unknown origin]") || (g_r == "unknown") || (g_r == "undefined"))
	g_r = "";

// Create the image url and write it into the page. 

document.write('<tr><td>&nbsp;</td></tr><tr><td align="center"><div style="visibility: hidden">');
document.write("<a href=\"http://www.sitemeter.com/");
document.write("stats.asp?site="+site+"\" target=_top>");
document.write("<img src=\"http://" + g_server + "/");
document.write("meter.asp?site="+site); 
document.write("&refer="+escape(g_r));
if (g_ip != "")
	document.write("&ip="+g_ip);
document.write("&hours="+g_hours);
document.write("&minutes="+g_minutes);
document.write("&rtype="+g_rtype);
document.write("\" border=0 title=\"Site Meter\"></a>");
document.write('</div></td></tr>');

};

/* script for DMFitter (correctly redirects links for shared pages) */

function AClicked(url)
{
  var PHREF=window.location.href;
  if ((PHREF.indexOf('@MSITStore')>0) || (PHREF.indexOf('ile://')>0)) 
  {
    window.location.href=url; // warning: don't use isCHM() here!
  }
  else 
  {
    window.location.href='http://www.datamaster2003.com/'+url;
  };
};
