var lastUpdated = "Last Updated: June 30, 2010";

var indent = 4;
//var sidebars = [];
var sidebars = [];

//entry 1 - url
//entry 2 - description
//entry 3 - indent (optional)
//entry 4 - directory required to show link (optional - but must specify indent)

sidebars[0] = ["hardware",[
    ["/hardware/hardware.html",                                                      "Hardware - Home"],
	["/hardware/cubicles/cubicles.html",                                             "Cubicles"],
	//["/hardware/ircswitch/ircswitch.html",                                           "IRC Switch"],
	["/hardware/gtwif/gtwif.html",                                                   "GTWIF"],
	["/hardware/gpc/gpc.html",                                                       "GPC"],
	["/hardware/gtio/gtio.html",                                                     "GT I/O"],
	["/hardware/gtnet/gtnet.html",                                                   "GTNET"],
	["/hardware/interface-panels/interface-panels.html",   							 "Interface Panels"],
	["/hardware/gbh/gbh.html", 														 "Global Bus Hub"]
	
	]];
	
sidebars[1] = ["about-us",[
    ["/about-us/about-us.html",                                                      "About Us - Home"],
	["/clients-rep/reps.html",                                              		 "Contact Us"],
	["/about-us/services/services.html",                                             "Services We Provide"],
	["/about-us/events/events.html",                                                 "News & Events"],
	["/about-us/events/rtds-news/rtds-news.html",                                    "Newsletter",			    indent,"/about-us/events/"],
	["/clients-rep/clients.html",                                                    "RTDS Clients"],
	["/about-us/training-courses/training-courses.html",                      		 "RTDS Training Courses"],
	["/about-us/technical-publications/technical-publications.html", 				 "Technical Publications"],
	["/about-us/technical-publications/archives.html",                               "Archives",			    indent,"/about-us/technical-publications/"],
	["/about-us/links/links.html",                       							 "Links"]
	]];
	
sidebars[2] = ["software",[
    ["/software/software.html",                                                      "Software - Home"],
	["/software/rscad/rscad.html",                                                   "RSCAD"],
	["/software/rscad/filemanager/filemanager.html",                                 "FileManager",			    indent,"/software/rscad/"],
	["/software/rscad/draft/draft.html",                                             "Draft",					indent,"/software/rscad/"],
	["/software/rscad/runtime/runtime.html",                                         "RunTime",					indent,"/software/rscad/"],
	["/software/rscad/componentbuilder/componentbuilder.html", 						 "ComponentBuilder",		indent,"/software/rscad/"],
	["/software/rscad/multiplot/multiplot.html",                       				 "MultiPlot",				indent,"/software/rscad/"],
	["/software/rscad/tline/tline.html", 											 "TLine",					indent,"/software/rscad/"],
	["/software/rscad/cable/cable.html", 											 "Cable",					indent,"/software/rscad/"],
	["/software/power-system-components/power-system-components.html", 				 "Power System Components"],
	["/software/control-system-components/control-system-components.html", 			 "Control System Components"],
	["/software/protection-automation/protection-automation.html", 					 "Protection & Automation Components"],
	["/software/automated-batch-mode/automated-batch-mode.html", 					 "Automated Batch Mode Operation"],
	["/software/small-timestep/small-timestep.html", 					 			 "Small Timestep VSC Subnetworks"]
	]];
	
sidebars[3] = ["applications",[
    ["/applications/applications.html",                                                    "Applications - Home"],
	["/applications/closed-loop-testing/closed-loop-testing.html", 						   "Closed Loop Testing of Physical Devices"],
	["/applications/protective-relay-systems/protective-relay-systems.html", 			   "Protective Relay Systems Testing"],
	["/applications/iec-61850-device/iec-61850-device.html", 					 		   "IEC 61850 Device Testing"],
	["/applications/control-systems/control-systems.html", 								   "Control Systems Testing"],
	["/applications/education-and-training/education-and-training.html", 				   "Simulation for Education and Training"],
	["/applications/high-speed-power-system-studies/high-speed-power-system-studies.html", "High Speed Power System Studies"]
	]];

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		homepage05_over = newImage("/images_over/homepage05.jpg");
		homepage06_over = newImage("/images_over/homepage06.jpg");
		homepage07_over = newImage("/images_over/homepage07.jpg");
		homepage08_over = newImage("/images_over/homepage08.jpg");
		homepage09_over = newImage("/images_over/homepage09.jpg");
		preloadFlag = true;
	}
}

function dumpHeader()
{
document.write("<div id=\"header\">");
document.write("	<div id=\"logo\"><a href=\"/index/index.html\"><img src=\"/images_normal/homepage02.jpg\" alt=\"\" width=\"500\" height=\"116\" /></a></div>");
document.write("	<div id=\"header-menu\">");
document.write("		<ul>");
document.write("			<li><a href=\"/clients-rep/reps.html\" id=\"header-menu1\" accesskey=\"1\" class=\"link1\">Contact Us</a></li>");
document.write("			<li><a href=\"#\" id=\"header-menu2\" accesskey=\"2\" class=\"link1\">Sitemap</a></li>");
document.write("		</ul>");
document.write("	</div>");
document.write("</div>");

document.write("<div id=\"mainmenu\">");
document.write("	<ul>");
document.write("		<li><a href=\"/about-us/about-us.html\"         id=\"mainmenu1\" accesskey=\"3\" title=\"About Us\"><b>About Us</b></a></li>");
document.write("		<li><a href=\"/hardware/hardware.html\"         id=\"mainmenu2\" accesskey=\"4\" title=\"Hardware\"><b>Hardware</b></a></li>");
document.write("		<li><a href=\"/software/software.html\"         id=\"mainmenu3\" accesskey=\"5\" title=\"Software\"><b>Software</b></a></li>");
document.write("		<li><a href=\"/applications/applications.html\" id=\"mainmenu4\" accesskey=\"6\" title=\"Applications\"><b>Applications</b></a></li>");
document.write("		<li><a href=\"http://www.rtds.com/clientarea\"  id=\"mainmenu5\" accesskey=\"7\" title=\"Client Log-In\" target=\"_new\"><b>Client Log-In</b></a></li>");
document.write("	</ul>");
document.write("</div>");
}

function dumpFooter()
{

	//var dateInfo = "";

	//var i = 0;
	//var datafile = "file:\\\\rtds-s4/SharedDocs/website/page/includes/updated.txt";
	//var url = new java.net.URL(datafile);
	//var connect = url.openConnection();
	//input = new java.io.BufferedReader(new java.io.InputStreamReader(connect.getInputStream()));
	//var aLine = "";
	//while((aLine = input.readLine()) != null)
	//{
    	//dateInfo += aLine;
	//}


document.write("<br style=\"clear: both;\"/><br><br>");
document.write("<div id=\"footer\">");
//document.write("	<p id=\"links\" class=\"style_footer\">Read our <a href=\"#\">Legal policy</a> and <a href=\"#\">Privacy policy</a>.</p>");
document.write("	<p id=\"footer_bottom\" class=\"style_footer\" align=\"center\">");


document.write("<a href=\"/index/index.html\" class=\"style_footer\">Home</a> | ");
document.write("<a href=\"/clients-rep/reps.html\"          accesskey=\"1\" class=\"style_footer\">Contact Us</a> | ");
document.write("<a href=\"/about-us/about-us.html\"         accesskey=\"3\" class=\"style_footer\">About Us</a> | ");
document.write("<a href=\"/hardware/hardware.html\"         accesskey=\"4\" class=\"style_footer\">Hardware</a> | ");
document.write("<a href=\"/software/software.html\"         accesskey=\"5\" class=\"style_footer\">Software</a> | ");
document.write("<a href=\"/applications/applications.html\" accesskey=\"6\" class=\"style_footer\">Applications</a> | ");
document.write("<a href=\"http://www.rtds.com/clientarea\"  accesskey=\"7\" class=\"style_footer\" target=\"_new\">Client Log-In</a>");

document.write("</p>");
document.write("	<p id=\"footer_left\"   class=\"style_footer\">" + lastUpdated + "</p>");
document.write("	<p id=\"footer_right\"  class=\"style_footer\">&copy; 2010 RTDS Technologies. All rights reserved.</p>");
document.write("	<p id=\"footer_center\" class=\"style_footer\" align=\"center\">Real Time Digital Simulation For The Power Industry</p>");
//document.write("	<div id=\"links\" class=\"style1\">" + lastUpdated + "</div>");
//document.write("	<div id=\"copyright\" class=\"style1\">&copy; 2009 RTDS Technologies. All rights reserved.</div>");
document.write("</div>");
document.write("<br style=\"clear: both;\"/>");
}

function dumpSidebar(listName)
{
	var activeDir = "";
	
	var locationStart = location.host.length + 7;
	var activeLink = location.href.substring(locationStart);
	var last = activeLink.lastIndexOf("/")+1;
	
	if (activeLink.length>0)
	{
		//var last = activeLink.lastIndexOf("/")+1;

		//var locationStart = location.host.length + 7;
		
		//document.write(activeLink);
		//document.write();
		//document.write(location.href.substring(locationStart));

		activeDir = activeLink.substring(0,last);
		//document.write("ad:" + activeDir);
	}
	
	for (var x=0;x<sidebars.length;x++)
	{
		var currsb = sidebars[x];
		if (currsb[0] == listName)
		{
			//alert("asdf");
			document.write("<ul class=\"sidebar\">");
			
			var entries = currsb[1];
			for (var y=0;y<entries.length;y++)
			{
				var entry = entries[y];
				var eLink = entry[0];
				
				var eDesc = entry[1];
				if (eLink == activeLink)
				    eDesc = "<b>" + eDesc + "</b>";
				    
				var eTitle = entry[1];
				
				var allowEntry = true;
				    
				if (entry.length>=3)
				{
					var spaces = entry[2];
					for (var x=0;x<spaces;x++)
					{
						eDesc = "&nbsp;" + eDesc;
					}
				}
				
				if (entry.length>=4)
				{
					var requireDir = entry[3];
					allowEntry = (activeDir.indexOf(requireDir)==0);
				}

				if (allowEntry)
					document.write("<li><a href=\"" + eLink + "\" class=\"sidebar\" title=\"" + eTitle + "\">" + eDesc + "</a></li>");
			}
			 //<li><a href="text" class="sidebar">GPC</a></li>
			 //<li><a href="text" class="sidebar">GT I/O</a></li>
			 //<li><a href="text" class="sidebar">GTNET</a></li>
			 //<li><a href="text" class="sidebar">Digital Patch Panel</a></li>
			 //<li><a href="text" class="sidebar">High Voltage Digital Interface</a></li>
			document.write("</ul>");
		}
	}
}