﻿var isID = 0;
var isAll = 0;
var isLayers = 0;
var isTrans = 0;
var isFp = 0;
var lb = 0;

// browser identification
if (document.getElementById){isID=1;}
if (document.layers){isLayers=1;}
if (document.all){isAll=1;}


////////////////////////////////////////////////////////////////////
// Menu object constructors and methods
////////////////////////////////////////////////////////////////////

function menuCollection(descStr){		// menuCollection object constructor

		this.description = descStr;		// description string, not currently used
		this.menuCount = 0;				// counter to aid iteration through menus
		this.addMenu = addMenuFunc;		// method linked to additional function

}

function menuObj(shortTextStr,textStr,menuHref){		// menu object constructor

		this.ref = shortTextStr;			// shorten version of text (without spaces) to be used as reference
		this.text = textStr;			// text shown at top of menu
		this.href = menuHref;			// href for text
		this.itemCount = 0;				// counter to aid iteration through menu items
		this.addItem = addMenuItemFunc;	// method linked to additional function

}

function menuItemObj(textStr,itemHref,needsNewWin){	// menuItem object constructor

		this.text = textStr;			// text shown in menu
		this.href = itemHref;			// href for text
		this.newWin = needsNewWin;			// if href needs to be in new window
		this.subMenuExists = 0;			// does menu item have a submenu
		this.addSubMenu = addSubMenuFunc;	// method linked to additional function
		this.subRef = "";				// reference name for sub menu

}


function addMenuFunc(shortTextStr,textStr,menuHref){			// constructor method

		this.menuCount++;				// increase menuCount
		this["menu" + this.menuCount] = new menuObj(shortTextStr,textStr,menuHref);	// create menu object using menuCount to create iterative name
		
}

function addMenuItemFunc(textStr,itemHref,isHr){	// constructor method

		this.itemCount++;				// increase itemCount
		this["menuItem" + this.itemCount] = new menuItemObj(textStr,itemHref,isHr);	// create menuitem object using itemCount to create iterative name

}

function addSubMenuFunc(subRef){				// constructor method

		this.subMenuExists = 1;			// set that there is a sub menu for a particular menuItem
		this.subRef = subRef;
		this.subMenu = new menuObj("",""); // create menu object below a particular menuItem
		
}




////////////////////////////////////////////////////////////////////
// Functions to draw menus dynamically from configuration file
////////////////////////////////////////////////////////////////////

function drawMainMenu(){		// function iterates through menu Collection


	htmlStr = "";
	
	htmlStr += "<div id=\"menu\">\n";
	htmlStr += "<table cellspacing=\"0\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n";
	htmlStr += "<tr>\n";
	htmlStr += "<td width=\"10\" align=\"center\">&nbsp;</td>\n";
	
		for (i=1; i <= topMenu.menuCount; i++){
		
			thisMenu = topMenu['menu' + i];
		
			htmlStr += "<td id=\"" + thisMenu.ref + "MenuTitle\" ";
			htmlStr += "onmouseover=\"showMenu('" + thisMenu.ref + "Menu','main')\" ";
			htmlStr += "onmouseout=\"menuTimer()\"><span style=\"cursor:default;\" class=\"menuTitle\">&nbsp;" + thisMenu.text + "&nbsp;</span></td>\n";
			//htmlStr += "<a class=\"menuTitle\" href=\"" + thisMenu.href + "\" ";
			//htmlStr += "<a class=\"menuTitle\" href=\"\" ";
			
			
			if (i < topMenu.menuCount){
				htmlStr += "<td width=\"20\" align=center>|</td>\n";
			}
		
		}
			
	//htmlStr += "<td width=\"25\" align=center>&nbsp;</td>\n"
	htmlStr += "</tr></table></div>";
	
	document.write (htmlStr);

}


function drawDropDowns(){		// function iterates through menu and then menu items

	var htmlStr = "";
	var subHtmlStr = "";
	
	for (i=1; i <= topMenu.menuCount; i++){
	
		thisMenu = topMenu['menu' + i];
	
		htmlStr += "\n<div id=\"" + thisMenu.ref + "Menu\">\n";
		htmlStr += "<table border=\"0\" bgcolor=\"#ffffff\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td bgcolor=\"#9999cc\" ></td><td>\n";
		htmlStr += "<table border=\"0\" bgcolor=\"#9999cc\" cellpadding=\"4\" cellspacing=\"0\">\n<tr>";
		
		for (j=1; j <= thisMenu.itemCount; j++){
		
			thisItem = thisMenu['menuItem' +j];
		
			//htmlStr += "<tr>\n";
			

				
				if (thisItem.subMenuExists){
					htmlStr += "<td style='padding-top:0px;' onmouseout=\"menuOut();subTimer()";
				}
				else{
					htmlStr += "<td style='padding-top:0px;' colspan=\"2\" onmouseout=\"menuOut();";
				}
				
				
				htmlStr += "\" onmouseover=\"menuOver();";
				
				if (thisItem.subMenuExists){
					htmlStr += "showMenu('" + thisItem.subRef + "','sub')";
				}
				
				htmlStr += "\"><a class=\"menuItem\" href=\"" + thisItem.href + "\"";
				if (thisItem.newWin){
				 htmlStr += " target=\"_blank\"";
				}
				htmlStr += " >&nbsp;" + thisItem.text + "</a> ";
				if (thisItem.subMenuExists){
					htmlStr += "<img src=\"/images/structure/bullet-tri-menu2.gif\">";
				}
				htmlStr += "</td>\n";
				
				
					
				if (j < thisMenu.itemCount){
					htmlStr += "<td class=\"menuItem\">&nbsp;-&nbsp;</td>";
				}
				
			
			//htmlStr += "</tr>\n";
		
			
			if(thisItem.subMenuExists){		// if menuItem has submenu call function and return code to temp string
			
				subHtmlStr += drawSubMenu(thisItem);
			
			}
		
		}
		
		htmlStr += "<td style='padding:0px;' bgcolor='#9999cc' valign='bottom'><img src='/images/structure/menu_curve.gif'></td>";
		htmlStr += "</tr></table>\n";
		htmlStr += "</td></tr></table>\n";
		htmlStr += "</div>\n\n";
	}
	
	document.write(htmlStr);		// output the menu html
	document.write(subHtmlStr);	// output the submenu html
	
}



function drawSubMenu(menuItemObj){	// iterates through submenu items

	var tempStr = "";

	tempStr += "<div id=\"" + menuItemObj.subRef + "\">\n";
	tempStr += "<table border=\"0\" bgcolor=\"#000000\" cellpadding=\"1\" cellspacing=\"0\"><tr><td>\n";
	tempStr += "<table border=\"0\" bgcolor=\"#dedeff\" cellpadding=\"2\" cellspacing=\"0\">\n";

	subMenu = menuItemObj.subMenu;

	for (k=1; k <= subMenu.itemCount; k++){
	
		subItem = subMenu['menuItem' + k];
	
		tempStr += "<tr>\n";
		
		tempStr += "<td  onmouseout=\"subOut()\" onmouseover=\"subOver()\">";
		tempStr += "<a class=\"subMenuItem\" href=\"" + subItem.href + "\">&nbsp;";
		tempStr += subItem.text + "&nbsp;</a>";
		if (subItem.hrFollows){ 
			tempStr += "<hr>";
		}
		tempStr += "</td>\n";

		
		tempStr += "</tr>\n";
		
	}

	tempStr += "</table>\n";
	tempStr += "</td></tr></table>\n";
	tempStr += "</div>\n\n";

return tempStr;
	
}


function drawTopCorner(){	// draw the topCorner2 i.e. curve, picture and small menu
	
	document.write ("<div id=\"topCorner\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">");
	document.write ("<tr><td rowspan=\"2\">");
	document.write ("<img src=\"/images/structure/topcorner1.gif\" alt=\"\" width=\"116\" height=\"115\" border=\"0\">");
	document.write ("</td>");
	document.write ("<td>");
	document.write ("<img src=\"/images/structure/topcorner2.gif\" alt=\"\" width=\"64\" height=\"89\" border=\"0\">");
	document.write ("</td>");
	document.write ("<td>");
	document.write ("<img src=\"/images/structure/topcorner3.jpg\" alt=\"\" width=\"180\" height=\"89\" border=\"0\">");
	document.write ("</td>");
	document.write ("</tr>");
	
	document.write ("<tr>");
	document.write ("<td height=\"26\" colspan=\"2\" align=\"left\">");
	document.write ("<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\"><tr>");
	
	//if (lb == 1 || lb == 4){
	//	document.write ("<td><a href=\"javascript:showLogin();\">" + logoutName + "</a></td>");
	//	document.write ("<td>|</td>");
	//	document.write ("<td><a href=\"" + profileUrl + "\">" + profileName + "</a></td>");
	//}
	//else {
	//	document.write ("<td><a href=\"javascript:showLogin();\">" + loginName + "</a></td>");
	//	document.write ("<td>|</td>");
	//	document.write ("<td><a href=\"" + registerUrl + "\">" + registerName + "</a></td>");
	//}

	
	//document.write ("<td>|</td>");
	document.write ("<td><img src=\"/images/structure/transparent.gif\" width=\"60\" height=\"1\"/></td>");
	document.write ("<td><a href=\""+ contactUrl + "\">" + contactName + "</a></td>");
	//document.write ("<td>|</td>");
	//document.write ("<td><a href=\""+ searchUrl + "\">" + searchName + "</a></td>");
	document.write ("</tr>");
	document.write ("</table></td></tr>");
	document.write ("</tr>");
	document.write ("</table></div>");

}



function drawTopBar(hasBackground){		// master function to draw topbar, calling other functions to draw key parts
	
	document.write ("<div id=\"topBar\"><table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">");
	document.write ("<tr>");
	document.write ("<td bgcolor=\"#133878\">");
	document.write ("<a href=\"/\">");
	document.write ("<img src=\"/images/structure/logo.gif\" alt=\"Wallingford Software\" width=\"336\" height=\"81\" border=\"0\">");
	document.write ("</a></td>");
	document.write ("<td rowspan=\"2\" width=\"360\" bgcolor=\"#133878\">");
			drawTopCorner();
	document.write ("</td></tr>");
	document.write ("<tr>");
	
		if (isAll || isLayers){
			document.write ("<td valign=\"bottom\" bgcolor=\"#314c8e\" height=\"24\">");
		} else {
			document.write ("<td valign=\"bottom\" bgcolor=\"#314c8e\" height=\"26\">");
		}
	
		drawMainMenu();
	document.write ("</td></tr>");
	document.write ("<tr><td bgcolor=\"#9999cc\" colspan=\"2\">");
	document.write ("<img src=\"/images/structure/transparent.gif\" alt=\"\" width=\"1\" height=\"2\" border=\"0\">");
	document.write ("</td>");
	document.write ("</tr>");
	document.write ("</table>");
		
	document.write ("</div>");
	
	
		drawDropDowns();
		//drawRegion();
		
		if (hasBackground){
			drawBackgroundLine();
		}

		switch (lb) {
			case 1:
				drawLogin("logout","");
				break;
			case 2:
				drawLogin("login","none");
				break;
			case 3:
				drawLogin("login","many");
				break;
			case 4:
				drawLogin("logout","");
				break;
			default:
				drawLogin("login","");
				break;
		}	
		
		
		if (lb == 2 || lb == 3){
			setVisibility('loginBox','visible');
		}
		
		var queryString = location.search.substring(1);		// QueryString section of URL
		if (queryString.indexOf('prt=1') != -1){			// if print window then 
			printStyle();									// call printStyle function
		}
}


function drawBackgroundLine(){

	document.write("<style type=\"text/css\">");
	document.write("body {background-image: url(/images/structure/background3.gif);}");
	document.write("#main {width:1000px;margin: 10px;}");
	document.write("</style>");

}

function footer(){
	
		if (window.name != "printWindow"){
			document.write("<div id=\"footer\" style=\"width:965px;clear:both;margin-left:25px;margin-top:25px;border-top:solid 2px #DEE9F5;text-align:center;padding:5px 0px;\">");
				var today = new Date();
			document.write("<span class=\"smallText\">Copyright &copy; " + today.getFullYear() + " Wallingford Software Ltd. All rights reserved.</span> ");
			document.write("<br /><a href=\"/info/terms\"><span class=\"smallText\">Terms and Conditions</span></a>");
			document.write("</div>");
		} else
		{
			document.write("<div id=\"footer\" style=\"width:90%;clear:both;margin-left:25px;margin-top:10px;border-top:solid 2px #DEE9F5;text-align:center;padding:5px 0px;\">");
			document.write("<p align=\"center\" class=\"normalTitle\" style=\"margin-top:0px;\">Contact: <a href=\"mailto:sales@wallingfordsoftware.com\">sales@wallingfordsoftware.com</a></p><br/>");
			document.write("</div>");
		}

}

////////////////////////////////////////////////////////////////////
// Functions to control dynamic menus
////////////////////////////////////////////////////////////////////


var menuActive = 0;
var subActive = 0;
var onMenu;
var onSub;
var timeOn = null;
var timeSub = null;



// SHOW MENU
function showMenu(menuName,menuType){

	// Reset menu timeouts
	if (menuType=="sub"){
		if (timeSub != null) {
			clearTimeout(timeSub);
			hideSub(onSub);
		}
			
	}
	else{
		if (timeOn != null) {
			clearTimeout(timeOn);
			hideMenu(onMenu);
		}
	}

	// Change menu style to visible
	setVisibility(menuName,'visible');
	if (menuType!="sub"){
		setBackground(menuName+'Title','#9999cc');
	}
	if (isFp){
		if ((menuName=='trainingMenu')||(menuName=='newsMenu')||(menuName=='infoMenu')){
			//setVisibility('fp_banner','hidden');
		}
	}
	// Change current menu string	
	if (menuType=="sub"){
		onSub = menuName;
	} else {
		onMenu = menuName;
	}
}


// TIMER FOR BUTTON MOUSE OUT
function menuTimer() {
 timeOn = setTimeout("btnOut()",600);
}

// BUTTON MOUSE OUT
function btnOut() {
	if (menuActive == 0) {
		hideMenu(onMenu);
	}
}

// SET MENU VISIBILITY STATE
function setVisibility(menuName,state){

	if (isID){
		document.getElementById(menuName).style.visibility = state;
	}
	else if (isLayers){
		document.layers[menuName].visibility = state;
	}
	else {
		document.all[menuName].style.visibility = state;
	}
}


 // HIDE MENU
function hideMenu(menuName){
 	if (menuActive == 0) {
		setVisibility(menuName,'hidden');
		setBackground(menuName+'Title','#314c8e');
		if (isFp){
			//setVisibility('fp_banner','visible');
		}
		if (onSub){
			hideSub(onSub);
		}
 	}
}


// HIDE SUB MENU
function hideSub(menuName){
 	if (subActive == 0) {
		setVisibility(menuName,'hidden');
 	}
}


// MENU MOUSE OVER 
function menuOver() {
		if (timeSub != null) {
			clearTimeout(timeSub);
			hideSub(onSub);
		}
		clearTimeout(timeOn);
		menuActive = 1;
}

// SUB MOUSE OVER 
function subOver() {
		subActive = 1;
		clearTimeout(timeSub);
		clearTimeout(timeOn);
		menuActive = 0;
}

// MENU MOUSE OUT 
function menuOut() {
		menuActive = 0;
		timeOn = setTimeout("hideMenu(onMenu)", 600);
}

// SUB MOUSE OUT 
function subOut() {
		subActive = 0;
		timeSub = setTimeout("hideSub(onSub)", 400);
		timeOn = setTimeout("hideMenu(onMenu)", 400);
}

// TIMER FOR SUB MENU OUT
function subTimer(){
	timeSub = setTimeout("menuItemOut()",400);
}


// MENU ITEM OUT
function menuItemOut(){
	if (subActive == 0) {
		hideSub(onSub);
	}
}

// returns dom.style object
function domStyle(objName){

	if (isID){
		return document.getElementById(objName).style;
	}
	else if (isLayers){
		return document.layers[objName];
	}
	else {
		return document.all[objName].style;
	}

}

function setBackground(thePageObj,theColor){
	if (isID){
		document.getElementById(thePageObj).style.backgroundColor = theColor;
	}
	else if (isLayers){
		document.layers[thePageObj].backgroundColor = theColor;
	}
	else {
		document.all[thePageObj].style.backgroundColor = theColor;
	}
}

function menuHoverOut(theObj){

	theObj.style.backgroundColor = "#314c8e";
}

// Shows or hides login box
function showLogin(){
	dom = domStyle('loginBox');
	
	
	if (dom.visibility == 'hidden' || dom.visibility == 'hide' || dom.visibility == ''){
	
		setVisibility('loginBox','visible');
		if (!isLayers && lb != 1){
				document.loginForm.email.focus();
		}
	
	} else {
	
		setVisibility('loginBox','hidden');
		
		if (isID && navigator.appName.indexOf('Microsoft') != -1){	// IE5+ doesn't return focus to window
			window.blur();
			window.focus();
		}
	
	}
	
}


// Draws hidden login box for login/logout and for error messages
function drawLogin(contentType,errorType) {

	// Removed from Chinese Version
}


function sideBarTitle(theText){
	
	document.write ("<table cellpadding=\"10\" cellspacing=\"0\" border=\"0\" width=\"200\">");
	document.write ("<tr><th colspan=\"3\">");
	document.write (theText);
	document.write ("</th></tr>");
	document.write ("</table>");

}	
			

function sideBarContentStart(){

	document.write ("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"200\">");
	document.write ("<tr>");
	document.write ("<td width=\"2\" bgcolor=\"#dee9f5\"><img src=\"/images/structure/transparent.gif\" width=\"2\" height=\"1\" border=\"0\"></td>");
	document.write ("<td>");
	document.write ("<table cellpadding=\"10\" cellspacing=\"0\" border=\"0\">");
	document.write ("<tr><td>");

}			
	

function sideBarContentFinish(){

	document.write ("</td></tr></table>");
	document.write ("</td>");
	document.write ("<td width=\"2\" bgcolor=\"#dee9f5\"><img src=\"/images/structure/transparent.gif\" width=\"2\" height=\"1\" border=\"0\"></td>");
	document.write ("</tr>");
	document.write ("<tr>");
	document.write ("<td colspan=\"3\" bgcolor=\"#dee9f5\"><img src=\"/images/structure/transparent.gif\" width=\"2\" height=\"2\" border=\"0\"></td>");
	document.write ("</tr></table>");

}	

function printStyle(){

	document.write ("<style type=\"text/css\">");
	document.write ("body {background-image:none;}");
	document.write ("#sideBar {display:none;}");
	document.write ("#topCorner {display:none;}");
	document.write ("#topBar {display:none;}");
	document.write ("#menu {display:none;}");
	//document.write ("#footer {display:none;}");
	document.write ("#main {width:100%;}");
	document.write ("#content {position:absolute;left:0px;top:10px;width:100%;}");
	document.write ("#maintext {position:relative;left:10px;top:0px;}");
	document.write ("</style>");

}

function printWin(){
	var printWindow;
	var pageUrl = window.location.href;
	
	if (pageUrl.indexOf("?") == -1){
		pageUrl = pageUrl + "?prt=1";
	} 
	else {
		pageUrl = pageUrl + "&prt=1";
	}
	
		 printWindow =  window.open(pageUrl,"printWindow","resizable,width=795,height=500,top=100,left=100,scrollbars,toolbar,menubar");
		printWindow.focus();
	
}

function printOption(){

	if (window.name != "printWindow"){
		document.write("<a href=\"javascript:printWin();\"><img src=\"/images/icons/print_16.gif\" alt=\"Printer Friendly Version\" width=\"16\" height=\"16\" border=\"0\" align=\"absmiddle\"> <span class=\"smallText\">Printer Friendly Version</span></a>");
	}
	else {
	
	document.write("<img src=\"/images/structure/print_logo.gif\" alt=\"Wallingford Software\" width=\"300\" height=\"68\" border=\"0\"><hr>");
	
	}
	
}				

function customerList(){
	var customerWin;
	customerWin =  window.open("/products/infoworks/customers.html","printWindow","resizable,width=400,height=198,top=200,left=200");
	customerWin.focus();
}			
		
function infonetList(){
	var customerWin;
	customerWin =  window.open("/products/infonet/customers.html","printWindow","resizable,width=400,height=198,top=200,left=200");
	customerWin.focus();
}		
	

		
		
function screenshot(imageRef){
	var customerWin;
	screenWin =  window.open("/images/products2/"+imageRef,"screen_shot","resizable,width=625,height=475,top=100,left=100");
	screenWin.focus();
}				
				
function pp(imageRef){
	var popWin;
	popWin =  window.open("/products/enlarge.asp?ref="+imageRef,"screen_shot","scrollbars=no,resizable,width=625,height=525,top=100,left=100");
	popWin.focus();
}				
			
			
function imgBox(imageRef){

	refArray = imageRef.split(",");
	
	document.write ("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"80%\"><tr><td align=\"center\">");
	
	document.write ("<div align=\"center\" class=\"imgBox\">");
	document.write ("<a href=\"javascript:pp('" + refArray[0] + "')\"><img src=\"/images/products/thumbs/" + refArray[0] + ".jpg\" border=\"0\" alt=\"Enlarge\"></a> ");
	document.write ("<span class=\"smallText\"><a href=\"javascript:pp('" + refArray[0] + "')\">Enlarge</a></span> ");
	document.write ("<a href=\"javascript:pp('" + refArray[0] + "')\"><img src=\"/images/icons/magnify.gif\" alt=\"Enlarge\" align=\"middle\" border=\"0\"></a>");
	document.write ("</div>");
	
	// handle a possible second image at this point
	if (refArray.length > 1){
	
		document.write ("</td><td>");
		document.write ("<div align=\"center\" class=\"imgBox\">");
		document.write ("<a href=\"javascript:pp('" + refArray[1] + "')\"><img src=\"/images/products/thumbs/" + refArray[1] + ".jpg\" border=\"0\" alt=\"Enlarge\"></a> ");
		document.write ("<span class=\"smallText\"><a href=\"javascript:pp('" + refArray[1] + "')\">Enlarge</a></span> ");
		document.write ("<a href=\"javascript:pp('" + refArray[1] + "')\"><img src=\"/images/icons/magnify.gif\" alt=\"Enlarge\" align=\"middle\" border=\"0\"></a>");
		document.write ("</div>");
	
	}
	
	document.write ("</td></tr></table>");

}

////////////////////////////////////////////////////////////////////
// sideMenu object constructors and methods
////////////////////////////////////////////////////////////////////

function sideMenuCollection(descStr){		// menuCollection object constructor

		this.description = descStr;		// description string, not currently used
		this.menuCount = 0;				// counter to aid iteration through menus
		this.addSideMenu = addSideMenuFunc;		// method linked to additional function

}

function sideMenuObj(shortTextStr,textStr,menuHref){		// menu object constructor

		this.ref = shortTextStr;		// shorten version of text (without spaces) to be used as reference
		this.text = textStr;			// text shown at top of menu
		this.href = menuHref;			// href for text
		this.linkCount = 0;				// counter to aid iteration through menu items
		this.addItem = addSideMenuLink;	// method linked to additional function

}

function sideMenuLink(textStr,itemHref,newWin){	// menuItem object constructor

		this.text = textStr;			// text shown in menu
		this.href = itemHref;			// href for text
		this.tarWin = newWin;			//is the link launched in new window

}

function addSideMenuFunc(shortTextStr,textStr,menuHref){			// constructor method

		this.menuCount++;				// increase menuCount
		this[shortTextStr] = new sideMenuObj(shortTextStr,textStr,menuHref);	// create menu object using menuCount to create iterative name
		
}

function addSideMenuLink(textStr,itemHref,newWin){	// constructor method

		this.linkCount++;				// increase itemCount
		this["link" + this.linkCount] = new sideMenuLink(textStr,itemHref,newWin);	// create menuitem object using itemCount to create iterative name

}
			
////////////////////////////////////////////////////////////////////
// Function to draw language specific product side menus
////////////////////////////////////////////////////////////////////

function drawSideMenuLinks(sectionName) {

	htmlStr = "";
	var thePattern = /http:\/\/[\w\.]+\/{1}/i;
	var theServer = document.location.href.match(thePattern)[0];
	thisSideMenu = sideMenus[sectionName];
	
	for (i=1; i <= thisSideMenu.linkCount; i++){
		thisPage = theServer.substr(0,(theServer.length-1))+thisSideMenu['link'+i].href;
		
		htmlStr = htmlStr + "<img src=\"/images/structure/bullet-tri.gif\" width=\"15\" height=\"12\" border=\"0\">\n";
		
		if (thisPage == document.location.href){
			htmlStr = htmlStr + "<strong>" + thisSideMenu['link'+i].text + "</strong><br /><br />\n\n";
		} else {
			htmlStr = htmlStr + "<a href=\"" + thisSideMenu['link'+i].href + "\"";;
			if (thisSideMenu['link'+i].tarWin==1){
				htmlStr = htmlStr + " target=\"_blank\" ";
			}
			htmlStr = htmlStr + ">";
			htmlStr = htmlStr + thisSideMenu['link'+i].text + "</a><br /><br />\n\n";
		}
		
	}
	document.write (htmlStr);

}		

function languageBar(){

	// Removed from Chinese version
	
}
	
function displaySection(theObjectStr){

	if (isID){
		if (document.getElementById(theObjectStr).style.display == 'block'){
			document.getElementById(theObjectStr).style.display = 'none';
		}
		else{
			document.getElementById(theObjectStr).style.display = 'block';
		}
	}
	else if (isLayers){
		if (document.layers[theObjectStr].display == 'block'){
			document.layers[theObjectStr].display = 'none';
		}
		else{
			document.layers[theObjectStr].display = 'block';
		}
	}
	else {
		if (document.all[theObjectStr].style.display == 'block'){
			document.all[theObjectStr].style.display = 'none';
		}
		else{
			document.all[theObjectStr].style.display = 'block';
		}
	}
}		

function langSet(newLang){
	if (isTrans){
		document.forms.langForm.pgTrans.value = isTrans;
	}
	document.forms.langForm.lg.value = newLang;
	document.forms.langForm.submit();
}

function langDisplay(langStr){
	langStr = langStr.toUpperCase();
	if (langStr == "EN"){
		returnStr = "EN (US)";
	} 
	else if (langStr == "UK"){
		returnStr = "EN (UK)";
	}
	else {
		returnStr = langStr;
	}
	
	return returnStr;
}		
			
function checkTrans(){
		languageDir = "/" + lang + "/";
		if ((isTrans) && (document.location.href.indexOf(languageDir) == -1) && (lang != "en") && (window.location.search.substring(1).search(/tx/)==-1)){
			//alert("switch");
			targetStr = "/language.asp?tr=1&ref=" + window.location.href.replace(/&/g,"%26");
			window.location.href = targetStr;
		}
}			


function openEnlargeWin(theForm){

	var popWin;
	popWin =  window.open("about:blank","enlargeWin","scrollbars=no,resizable,width=625,height=525,top=100,left=100");
	document.forms[theForm].submit();
	popWin.focus();
}

function enlargeImage(theName,smUrl,lrgUrl,theDesc,theFloat){

	document.write("<div class=\"imgBox\" style=\"width:auto;float:" + theFloat + ";\">");
	document.write("<form action=\"/misc/enlarge_img.asp\" target=\"enlargeWin\" method=\"post\" name=\"" + theName + "\" style=\"margin:5px;\">");
	document.write("<input type=\"Hidden\" name=\"lrgUrl\" value=\"/images/articles/" + lrgUrl + "\">");
	document.write("<input type=\"Hidden\" name=\"comment\" value=\"" + theDesc + "\">");
	document.write("<a href=\"javascript:openEnlargeWin('" + theName + "')\"><img src=\"/images/articles/" + smUrl + "\" style=\"border:1px #000000 solid;\"></a></form>");
	document.write("<span class=\"smallText\"><a href=\"javascript:openEnlargeWin('" + theName + "')\">Enlarge</a></span>");
	document.write("<a href=\"javascript:openEnlargeWin('" + theName + "')\"><img src=\"/images/icons/magnify.gif\" alt=\"Enlarge\" align=\"middle\" border=\"0\"></a></div>");
	
}			
			
function footerHeight(){
	if (isID){
		if (document.getElementById('sideBar')){
			sidebarLength = document.getElementById('sideBar').offsetHeight;}
		else {sidebarLength = 0;}
		if (document.getElementById('content')){
			contentLength = document.getElementById('content').offsetHeight;}
		else {contentLength = 0;}
		if (document.getElementById('rightBar')){
			rightbarLength = document.getElementById('rightBar').offsetHeight;}
		else {rightbarLength = 0;}
		
		if (contentLength != 0){		
			if (contentLength > sidebarLength){ footerHeight = contentLength +135;} 
			else {footerHeight = sidebarLength +135;}
		}
			
		if (document.getElementById('footer')){
			document.getElementById('footer').style.top = footerHeight;
			document.getElementById('footer').style.visibility = 'visible';
		}
	}
}


/////////////////////////////
// Chinese website functions
//////////////////////////////

function productBar(){
	for (i=1; i <= topMenu.menuCount; i++){
		thisMenu = topMenu['menu' + i];
		if (thisMenu.ref=="products"){
			for (j=1; j <= thisMenu.itemCount; j++){
				thisItem = thisMenu['menuItem' +j];
				if (thisItem.text=="By Name"){
					thisSubMenu = thisItem.subMenu;
					for (k=1; k <= thisSubMenu.itemCount; k++){
						thisSubItem = thisSubMenu['menuItem' +k];
						document.write("<img src=\"/images/structure/bullet-tri.gif\" width=\"15\" height=\"12\" border=\"0\">\n");
						document.write("<a href='" + thisSubItem.href + "'>" + thisSubItem.text + "</a><br /><br/>");
					}
				}
			}
		}
	}
}
			
function addNews(titleText,titleID){
	document.getElementById("newsHolder").innerHTML += "<p><a href=\"http://www.wallingfordsoftware.com/news/fullarticle.asp?id=" + titleID + "\">" + titleText  + "</a></p>";
}

function newsFlash(){

	document.write("<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" WIDTH=\"1\" HEIGHT=\"1\" id=\"news_summary\" ><PARAM NAME=movie VALUE=\"/config/news_summary.swf\"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF><PARAM NAME=wmode VALUE=transparent> <EMBED src=\"/config/news_summary.swf\" quality=high wmode=transparent bgcolor=#FFFFFF  WIDTH=\"1\" HEIGHT=\"1\" NAME=\"news_summary\" TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\"></EMBED></OBJECT>");

}

