var menuwidth=125
var pagewidth 
var offsetleft=0
//var offsettop=96
var offsettop=75
var offset_submenus=40
var language
var lan
var MenuObject



 // Texts in different languages. ["English","Nederlands"]
 // When switching languages, the variable 'lan' is set to the right index for the language,
 // so txtProducts[lan] will show 'Products' or 'Producten' depending on the language setting
 
var txtProgramming=    ["Programming","Programmeren"];
var txtSearch = 	   ["Search","Zoeken"];
var txtHome = 		   ["Home","Home"];
var txtAbout =   	   ["About","Algemeen"];
var txtLinks = 		   ["Links","Links"];
var txtNews =  		   ["News","Nieuws"];
var txtSupport = 	   ["Support","Service"];
var txtApplications =  ["Applications","Toepassingen"]
var txtSpecifications= ["Specifications","Specificaties"]
var txtElectronics =   ["Electronic design", "Electronika"]; 
var txtOpinions =     ["My Opinions", "Mijn Mening"];
var txtPapers = 	   ["Papers","Lectuur"];
var txtDownloads = ["Downloads", "Downloads"];

var ns4=document.layers?1:0
var ie4=document.all?1:0
var ns6=document.getElementById&&!document.all?1:0

if (ns4) {
visible = 'show';
hidden = 'hide';
}
else
{
visible = 'visible';
hidden = 'hidden';
}

function makeStatic(){
if (ie4) {object1.style.pixelTop=document.body.scrollTop+offsettop}
else if (ns6) {document.getElementById("object1").style.top=window.pageYOffset+offsettop}
else if (ns4) {eval(document.object1.top=eval(window.pageYOffset+offsettop));}

submenu_offset = offsettop + offset_submenus;
if (ie4) {object2.style.pixelTop=document.body.scrollTop+submenu_offset}
else if (ns6) {document.getElementById("object2").style.top=window.pageYOffset+submenu_offset}
else if (ns4) {eval(document.object2.top=eval(window.pageYOffset+submenu_offset));}
setTimeout("makeStatic()",0);
}

function write_submenu(Number,MenuItem,MenuLink,offset)
{
MenuObject = "object" + Number;
menu_left_pos = menuwidth -2;
//if (ie4||ns6) {document.write('<span ALIGN="CENTER" ID="object2" onmouseover="showSubMenu()" onMouseout="hideSubMenu()" STYLE=" Position:absolute; Top:'+offset+'; Left:'+menu_left_pos+'; Z-Index:4;cursor:hand;background-color:black;"><TABLE BORDER="1" width="'+menuwidth+'" CELLPADDING="0" CELLSPACING="0" BORDERCOLOR="white" bgcolor="white">')}
//else if (ns4){ document.write('<LAYER top="'+offset+'" name="object2" left="'+offsetleft+'" BGCOLOR=black><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="1"><TR><TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" width="'+menuwidth+'">')}
if (ie4||ns6) {document.write('<span ALIGN="CENTER" ID="'+MenuObject+'" onmouseover="showSubMenu('+ MenuObject+ ')" onMouseout="hideSubMenu('+ MenuObject+ ')" STYLE=" Position:absolute; Top:'+offset+'; Left:'+menu_left_pos+'; Z-Index:4;cursor:hand;background-color:black;"><TABLE BORDER="1" width="'+menuwidth+'" CELLPADDING="0" CELLSPACING="0" BORDERCOLOR="white" bgcolor="white">')}
else if (ns4){ document.write('<LAYER top="'+offset+'" name="'+MenuObject+'" left="'+offsetleft+'" BGCOLOR=black><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="1"><TR><TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" width="'+menuwidth+'">')}

if (this.document.location.href.indexOf("/en/") >=0) 
{languagestring="English"} else {languagestring="Nederlands"}

this.document.write('<TR><TD>SubMenu Item</TD></TR>');
if (ie4||ns6) {document.write('</TABLE></span>')}
else if (ns4){document.write('</TABLE></TD></TR></TABLE></LAYER>')}
//if (ie4) {object2.style.visibility = hidden}
//else 
{document.getElementById(MenuObject).style.visibility = visible}

}

function showSubMenu(MenuObjectName){
//if (ie4) {object2.style.visibility = visible}
//else
 {document.getElementById(MenuObjectName).style.visibility = visible}
}

function hideSubMenu(MenuObjectName){
//if (ie4) {object2.style.visibility = hidden}
//else 
{document.getElementById(MenuObjectName).style.visibility = hidden}
}


function create_menu(menu_type)
{

var MenuItem = new Array();
var MenuLink = new Array();
var SubMenuItems = new Array();
var SubMenuLinks = new Array();

var MenuTitle = 'C-Scope';			 		   // Default. Should be replaced in following if/then
var MenuTitleLink='index.html'
var SubMenuTitle = 'Menu'
// Menu items. Each menu item consists of a MenuItem[] (Item text) and a MenuLink[] (link)
// When a page is only available in English, the link path must be include '../en/' so the page will
// always be read from the 'en/' directory.
// MenuTitle and MenuTitleLink make up the title of the menu.
// When a MenuItem text is preceded by a @ it is treated as a submenu title (eg: '@Submenu')

var Path = this.document.location.href.toLowerCase();       // Ex.: /pages/en/programming_main.htm
PathParts = Path.split('/');								// Split in 'pages', 'en' and 'programming_main'   
ThisPageName = PathParts[PathParts.length -1 ];				// Find name of this page.
PageParts=ThisPageName.split('_');		  	 				// Split on '_' ('programming' and 'main')
menu_type = PageParts[0];								    // Menu is set by first part of page name
var PointPos;
for (I=0; I < PageParts.length; I++)
 {
 PointPos = PageParts[I].indexOf('.');								    
 if (PointPos >= 0) 
  { PageParts[I]=PageParts[I].substr(0,PointPos); }   				// Remove extension if there is one
 }
menu_type = PageParts[0];
if(PageParts.length > 1)submenu_type= PageParts[1];else submenu_type = "";

FirstPage = menu_type.indexOf("~1st-");
if ( FirstPage>=0 ) menu_type = menu_type.substr(5); //Remove First Page prefix (only for debugging)

switch(menu_type)
{
case 'index':
 MenuTitle = txtHome[lan];
 MenuItem.push(txtProgramming[lan]);			   
 MenuLink.push("programming_main.html");
 MenuItem.push(txtElectronics[lan]);			   
 MenuLink.push("electronics.html");
 MenuItem.push(txtDownloads[lan]);			   
 MenuLink.push("downloads.html");
break;
case 'downloads':
 MenuTitle = txtDownloads[lan];
 MenuTitleLink = "downloads.html" ;
break;
case 'electronics':
 MenuTitle = txtElectronics[lan];
 MenuTitleLink = "electronics.html" ;
 MenuItem.push('Rabbit Core' );			   
 MenuLink.push("electronics_rabbit.html");
 MenuItem.push('Misc. Analog' );			   
 MenuLink.push("electronics_analog.html");
			   
break;
case 'opinions':
 MenuTitle = txtOpinions[lan];
 MenuTitleLink = "opinions.html" ;
 MenuItem.push('Microsoft' );			   
 MenuLink.push("opinions_microsoft.html");
   
break;
case 'programming':
 MenuTitle = txtProgramming[lan];			   
 MenuTitleLink='programming_main.html';
 MenuItem.push('PocketPC');
 MenuLink.push("programming_pocketpc.html");
 MenuItem.push('MFC');
 MenuLink.push("programming_mfc.html");
 MenuItem.push( 'Bascom 8051');
 MenuLink.push("programming_bascom.html");
 MenuItem.push( 'C++Builder');
 MenuLink.push("programming_cppbuilder.html");
 MenuItem.push( 'DynamicC (Rabbit)');
 MenuLink.push("programming_dynamicc.html"); 
 MenuItem.push( 'Firebird database');
 MenuLink.push("programming_firebird.html");
 MenuItem.push( 'Miscellaneous');
 MenuLink.push("programming_misc.html");
break;
default :
MenuTitle = txtHome[lan];
MenuTitleLink= "index.html";
break;
}//end of switch
switch(submenu_type)
{
  case 'analog' :
  SubMenuTitle= 'Analog Electronics';
  SubMenuItems.push('LM-317' );			   
  SubMenuLinks.push("electronics_analog_lm317.html");
  break;
  case 'bascom':
  SubMenuTitle= 'Bascom 8051';
  SubMenuItems.push('Pitfalls' );			   
  SubMenuLinks.push("programming_bascom_problems.html");
  break;
  case 'firebird':
  SubMenuTitle= 'Firebird database';
  break;
  case 'rabbit':
  SubMenuTitle= 'Rabbit';
  SubMenuItems.push('LCD and Keyboard interfacing' );			   
  SubMenuLinks.push("electronics_rabbit_lcd_keyboard.html");
  break;
  case 'dynamicc':
  SubMenuTitle= 'DynamicC (Rabbit)';
  SubMenuItems.push('DynamicC Pitfalls' );			   
  SubMenuLinks.push("programming_dynamicc_problems.html");
  break;
  case 'misc':
  SubMenuTitle= 'Miscellaneous';
  SubMenuItems.push('Programming with Time' );			   
  SubMenuLinks.push("programming_misc_time.html");
  break; 
  case 'mfc':
  SubMenuTitle= 'MFC';
  SubMenuItems.push('Using Propertysheets' );			   
  SubMenuLinks.push("programming_mfc_propertysheets.html");
  SubMenuItems.push('Using MFC classes in C++Builder' );			   
  SubMenuLinks.push("programming_mfc_using_mfc_in_bcb.html");
  SubMenuItems.push('Creating a resource-only dll (for&nbsp;localization)' );			   
  SubMenuLinks.push("programming_mfc_creating_a_resource_DLL.html");
  SubMenuItems.push('Migrating eVc projects to Visual Studio' );			   
  SubMenuLinks.push("programming_pocketpc_evc_to_visual_studio.html");

  break;
  case 'pocketpc':
  SubMenuTitle= 'Pocket PC';
  SubMenuItems.push('MFC / VisualC Pitfalls' );			   
  SubMenuLinks.push("programming_pocketpc_mfc_problems.html");
  SubMenuItems.push('Creating a resource-only dll (for&nbsp;localization)' );			   
  SubMenuLinks.push("programming_mfc_creating_a_resource_DLL.html");
  SubMenuItems.push('Migrating eVc projects to Visual Studio' );			   
  SubMenuLinks.push("programming_pocketpc_evc_to_visual_studio.html");
  break;
  case 'cppbuilder':
  SubMenuTitle= 'C++Builder';
  SubMenuItems.push('Using DBChart' );			   
  SubMenuLinks.push("programming_cppbuilder_dbchart.html");
  SubMenuItems.push('Using MFC Classes in C++Builder' );			   
  SubMenuLinks.push('programming_mfc_using_mfc_in_bcb.html');
  SubMenuItems.push('Adding different help files to the Tools menu' );			   
  SubMenuLinks.push('programming_cppbuilder_help.html');
  break;
  default:
  SubMenuTitle= 'C-Scope';
  break;
  

}
write_menu(MenuTitle,MenuTitleLink,MenuItem,MenuLink,SubMenuTitle,SubMenuItems,SubMenuLinks);
}   // end of create_menu

function write_menu(MenuTitle,MenuTitleLink,MenuItem,MenuLink,SubMenuTitle,SubMenuItems,SubMenuLinks)
{

document.write('<span ALIGN="CENTER" ID="object1" STYLE="Position:absolute; Top:'+ offsettop+'; Left:'+offsetleft+'; Z-Index:5;background-color:black;">');
document.write('<TABLE border="0" class= menuItemStyle width="'+menuwidth+'" CELLPADDING="0" CELLSPACING="0">');
document.write('<TR width=100% height=24 class="menuTitleStyle"><TD colspan ="2"onmouseover="className=\'menuTitleStyleHover\'" onMouseout="className=\'menuTitleStyle\'" ONCLICK="location=\''+MenuTitleLink+'\'"><P align="center">'+MenuTitle+'</p></td></tr>')
document.write('<tr><td colspan="2" rowspan="1"><table class= "menuItemStyle" border ="0" Bordercolor="Black">'); 
var MenuObjectName;
for (i=0;i<=MenuItem.length-1;i++)
{
MenuObjectName = "object"+i;
 document.write('<TR>');
 if ( MenuItem[i].indexOf("@") == 0 ) 					   // check if this is a subtitle (starts with @)
  { 
  var MenuI;
  MenuI = MenuItem[i].substr(1);
  document.write('<TD colspan="2" rowspan="1" class="submenu" border="0" onmouseover="className=\'submenuh\'" onMouseout="className=\'submenu\'">'+ MenuI +'<BR></TD></TR>');
  }
 else
  {
   document.write('<TD border="0" ><img src="../images/menu_mark.gif" width="11" height="11" alt="" border="0"></TD>') 
  document.write('<TD border="0" ONCLICK="location=\''+MenuLink[i]+'\'" onmouseover="className=\'menuh\'" onMouseout="className=\'menu\'">'+MenuItem[i]+'<BR></TD></TR>');
//   document.write('<TD border="0" ONCLICK="location=\''+MenuLink[i]+'\'" onmouseover="showSubMenu(' + MenuObjectName+ ')" onMouseout="hideSubMenu(' + MenuObjectName+ ')">'+MenuItem[i]+'<BR></TD></TR>');

  } 
}

document.write('<TR><TD><BR></TD></tr></td></table></TR>')

// Google search bar

document.write('<TR width=100% class="menuTitleStyle"><TD colspan="2"><P ALIGN=CENTER>' + txtSearch[lan] + '</p></TD></TR>')
document.write('<TR><TD colspan=2 border="0"><FORM method=GET action="http://www.google.nl/search" target=_top><input type=hidden name=ie value=UTF-8><input type=hidden name=oe value=UTF-8>');
document.write('<input type=hidden value="http://www.ckns-meijer.demon.nl" name=sitesearch><!INPUT TYPE=hidden name=hl value=en><input type=hidden value="http://www.ckns-meijer.demon.nl" name=domains>');
document.write('<INPUT TYPE=text style="ALIGN:top;" name=q size=10 maxlength=255 value="">');
document.write('<font size=12><input ID=submit style="WIDTH: 30px; HEIGHT: 22px" type=submit value="Go" name="btnG"></font></form></div></td></tr>');

document.write('<TR width=100% height=24 class="menuTitleStyle">');
document.write('<TD colspan=2><P align="center">'+SubMenuTitle+'</p></td></tr>')

for (i=0;i<=SubMenuItems.length-1;i++)
{
document.write('<TR  onmouseover="className=\'subSectionLinkStyleHover\'" onMouseout="className=\'subSectionLinkStyle\'" class="subSectionLinkStyle" width=100% >');
document.write('<TD BGCOLOR="white" border="0" valign="top"><img src="../images/menu_mark.gif" width="11" height="11" alt="" border="0" >&nbsp;</TD>') 
document.write('<TD BGCOLOR="white" ONCLICK="location=\''+SubMenuLinks[i]+'\'">'+SubMenuItems[i]+'</TD></TR>');
}  


document.write('</TABLE></span>');     // Main menu span and Table end

} // end of write_menu()

function create_header()
{
document.write('<table style="Position:absolute; top:0; left:0" align="left" valign = "top" WIDTH="full" CELLPADDING="0" CELLSPACING="0" BORDER="0" >');
document.write('<tr><td height="70" align="center" border="0" cellspacing="0" cellpadding="0"><img src="../images/banner_cees.png" width="780" height="70" alt="" >');

document.write('</td></tr></table>');
document.write('<table style="Position:absolute; top:45; left:' + menuwidth + '" align="left" valign = "top" WIDTH="full" CELLPADDING="0" CELLSPACING="0" BORDER="0" >');
document.write('<tr><td align="center" valign ="center" border="0"><div class="bttext">');
//document.write('<a href="products_main.htm"><img src="../images/products.gif" border="0" align="top" WIDTH="19" HEIGHT="20">'+txtProducts[lan]+'</a>');
//document.write('<img src="../images/separator.gif" width="19" height="20" align="top" border="0">');
document.write('<a href="index.html"><img src="../images/home.gif" border="0" align="top" WIDTH="19" HEIGHT="20">' + txtHome[lan] + '</a>');
document.write('<img src="../images/separator.gif" width="19" height="20" align="top" border="0">');
document.write('<a href="about.htm"><img src="../images/info.gif" border="0" align="top" WIDTH="19" HEIGHT="20">' + txtAbout[lan] + '</a>');
document.write('<img src="../images/separator.gif" width="19" height="20" align="top" border="0">');
document.write('<a href="links.html"><img src="../images/links.gif" border="0" align="top" WIDTH="19" HEIGHT="20">' + txtLinks[lan] + '</a>');
document.write('<img src="../images/separator.gif" width="19" height="20" align="top" border="0">');
//document.write('<a href="news.htm"><img src="../images/news.gif" border="0" align="top" WIDTH="19" HEIGHT="20">' + txtNews[lan] + '</a>');
//document.write('<img src="../images/separator.gif" width="19" height="20" align="top" border="0">');
//document.write('<a href="support.htm"><img src="../images/tool.gif" border="0" align="top" WIDTH="19" HEIGHT="20">' + txtSupport[lan] + '</a>');
//document.write('<img src="../images/separator.gif" width="19" height="20" align="top" border="0">');
//document.write('<img src="../images/separator.gif" width="19" height="20" align="top" border="0">');
if (language == 'nl'){
 document.write('<a href="../en/index.html"><img src="../images/flag_uk.gif" width="40" height="20" border="0" alt="English" align="center"></a>');
 }
else{ 
document.write('<a href="../nl/index.html"><img src="../images/flag_nl.gif" width="30" height="20" border="0" alt="Nederlands"align="center"></a>');
} 
document.write('<img src="../images/separator.gif" width="19" height="20" align="top" border="0">');
document.write('</div></td></table>');



}

function start_page(type)
{
// If the pathname contains /en/, this page is in english
if (this.document.location.href.indexOf("/en/") >=0) { language="en"; lan=0; } // English						 
else{ language ='nl';lan=1 }	  // Nederlands
// Create menu and top of page header
create_menu(type);
//createSubMenu();
//makeStatic();
create_header();
// Create start of main Table where the pages will be displayed
pagewidth = 785 - 124; // Size of header - left of table
pagetop = offsettop-5;
document.write('<body><table border=0 style="Position:absolute; top:'+ pagetop +'; left:124" width="'+ pagewidth +'"  font="arial"><td>');
}

function end_page(){
document.write('</td></table></body>');
}

// ----------------------------------------------------------------------------------------------
// Password protection script.

function goForit() {
var location;
var password;
password=this.document.testform.inputbox.value
location= "../en/" + password + ".html";
document.location.href = location;
}

