// configure pageVariables

	var sectionList = new Array("company", "solutions", "products", "services", "showcase", "international");
	var sectionName;


// roll over functions used under licence from MACROMEDIA

	function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}

	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}

	function MM_findObj(n, d) { //v3.0
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
	}

	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}

// function to build the page header

	function buildHeader ()
	{
	
		//alert(pageName);	
	
		document.write("<a name='top'></a>");
		document.write("<table cellpadding='0' cellspacing='0' border='0' width='670px' bgcolor='#0b1966'>");
		document.write("<tr>");
		
		//document.write("<td width='1%'><img src='img/decor" + pageName + "Sm.gif'></td>");
		document.write("<td width='1%' bgcolor='#909090'><img src='img/spi.gif' width='20px' height='1px'></td>");
		document.write("<td><a href='index.htm'><img src='img/headertier02.gif' border='0'></a></td>");
		document.write("<td>&nbsp;</td>");
		document.write("<td align='right'><img src='img/decor" + pageName + "lg.gif'></td>");

		document.write("</tr>");
		document.write("</table>");
		document.write("<table cellpadding='0' cellspacing='0' border='0' width='670px' bgcolor='#cccccc'>");
		document.write("<tr>");
		document.write("<td align='right'>");
		
			var sectionName;

			for ( var i = 0; i < sectionList.length; i++ )
			{
				sectionName = sectionList[i];
				
			//	if (sectionName != pageName)
			//	{
					document.write("<a href='index" + sectionName + ".htm'>");
					document.write("<img src='img/nav" + sectionName + ".gif' border='0'>");
					document.write("</a>");
			//	}
			}
		
		document.write("<img src='img/spi.gif' width='10px' height='1px'>");		
		document.write("</td>");		

		document.write("</tr>");		
		document.write("</table>");		
		
		document.write("<table cellpadding='0' cellspacing='0' border='0' width='670px' bgcolor='#909090'>");
		document.write("<tr>");
		document.write("<td colspan='3' align='right' width='670px'>");
		document.write("&nbsp;");		
		document.write("</td>");		
		document.write("</tr>");		
		document.write("</table>");		


	}


function buildFooter()
{

		document.write("<a name='bottom'></a>");
		document.write("<table bgcolor='#909090' cellpadding='0' cellspacing='0' border='0' width='670px'>");
		document.write("<tr>");
		document.write("<td width='1%' bgcolor='#909090'><img src='img/spi.gif' width='20px' height='1px'></td>");
		document.write("<td align='center'>[ <a href='indexcompany.htm'>Company</a>] [<a href='indexsolutions.htm'>Solutions</a>] [<a href='indexproducts.htm'>Products</a>] [<a href='indexservices.htm'>Services</a>] [<a href='indexshowcase.htm'>Showcase</a>] [<a href='indexinternational.htm'>International</a>] [<a href='indexcontact.htm'>Contact</a>] [<a href='indexdisclaimer.htm'>Disclaimer</a>]</td>");
		document.write("</tr>");
		document.write("</table>");
}



function buildNavMenu()
{
	
	switch (pageName) 
	{ 
	   case "company" : 
	      var subSectionList = new Array ("company","contact","clients", "philosophy", "careers","news")
	      break; 

	   case "solutions" : 
	      
	      var subSectionList = new Array ("truepermit","webmaps")
	      break; 

 	   case "integration" : 
	      
	      var subSectionList = new Array ("company","solutions","integration","clients", "philosophy", "careers")
	      break;

	   case "services" : 
	      
	      var subSectionList = new Array ("dataIntegration", "dataanalysis", "customsoftware")
	      break; 
	      
	   case "clients" : 
	      
	      var subSectionList = new Array ("company","contact","clients", "philosophy", "careers","news")
	      break;	      

	   case "philosophy" : 
	      
	      var subSectionList = new Array ("company","contact","clients", "philosophy", "careers","news")
	      break;

	   case "carrers" : 
	      
	      var subSectionList = new Array ("company","contact","clients", "philosophy", "careers","news")
	      break;

	   case "products" : 
	      
	      var subSectionList = new Array ("eprom")
	      break; 
	   
	   case "showcase" : 
	      
	      var subSectionList = new Array ("slideshows", "infosheets")
	      break; 

	   case "contact" : 
	      var subSectionList = new Array ("company","contact","clients", "philosophy", "careers","news")
	      break; 

	   case "international" :
	      var subSectionList = new Array ("spanish")
	      break;
	      
	  case "webmaps" :
	      var subSectionList = new Array ("truepermit","webmaps")
	      break;
	      
	  case "implementations" :
	      var subSectionList = new Array ("truepermit","webmaps")
	      break;
	      
	   case "eprom" :
	      var subSectionList = new Array ("eprom")
	      break;	      
	   
	   case "truepermit" :
	      var subSectionList = new Array ("truepermit","webmaps")
	      break;	
 
 	  case "news" :
	      var subSectionList = new Array ("company","contact","clients", "philosophy", "careers","news")
	      break;	      
	      
	  case "applications" :
	      var subSectionList = new Array ("truepermit","webmaps")
	      break;	  
	   default : 
	   
	      var subSectionList = new Array("error")
	      break; 

	} 

	var subSectionName;
	
	//alert(subSectionList.length);
	
	//document.write("<img src='img/tabHeader.gif'><br>");
	
	//document.write("<a href='#overview'>");
	//document.write("<img src='img/tabOverview.gif' border='0' alt='overview'><br>");
	//document.write("</a>");
	
	for ( var i = 0; i < subSectionList.length; i++ )
	{
		subSectionName = subSectionList[i];

		document.write("<a href='index" + subSectionName + ".htm'>");
		document.write("<img src='img/tab" + subSectionName + ".gif' border='0' alt='" + subSectionName + "'><br>");
		document.write("</a>");
	
	}

	document.write("");

}

function openSlideshow(showname)
{
	var windowName = "popUp"
	var pageAddress = "slideshow" + showname + ".htm"

	window.open (pageAddress,windowName,'width=500,height=460,scrollbars=no,status=no,location=no'); 
	return false;
}

function openshp2()
{
	var windowName = "shp2gml"
	var pageAddress = "http://www.e-maps.ca/shp2gml/uploadFile.jsp"
	window.open (pageAddress,windowName,'width=780,height=600,scrollbars=yes,status=no,location=no, resizable=yes');
	return false;

}

function openEprom()
{
	var windowName = "ePROM"
	var pageAddress = "http://www.e-maps.ca/EPROMDEMO/default.asp"
	window.open (pageAddress,windowName,'width=800,height=600,scrollbars=no,status=no,location=no');
	return false;

}


function getto(form, i) 
{
    // get the URL from options
    var site = form.elements[i].selectedIndex;
    // if it's not the first (null) option, go there
    if ( site >= 1 ) {
      top.location = form.elements[i].options[site].value;
      }
    // and then reselect the null (it functions as a label)
    form.elements[i].selectedIndex = 0;
}

TreeParams = {
  
       // You will probably have to change these.

  /** TreeParams:
   *  OPEN_MULTIPLE_MENUS     --  boolean
   *                         if true, more than one menu can 
   *                         be open at a time. Otherwise, 
   *                         opening a new menu closes any 
   *                         open menu.
   *
   *  OPEN_MULTIPLE_SUBMENUS  --  boolean
   *                         Same as OPEN_MULTIPLE_MENUS but                          
   *                         applies to the submenus of each menu.
   *
   *  OPEN_WHILE_CLOSING      --  boolean
   *                         If either OPEN_MULTIPLE_MENUS or
   *                         OPEN_MULTIPLE_SUBMENUS are true,
   *                         OPEN_WHILE_CLOSING will simultaneously
   *                         open a new menu while closing the 
   *                         currently open menu.
   *                       
   *  TIME_DELAY              --  int
   *                         How slowly a menuNode collapses
   *                         in milliseconds. (0 to 100).
   */
      
      OPEN_MULTIPLE_MENUS    : false,
      OPEN_MULTIPLE_SUBMENUS : false,
      
      OPEN_WHILE_CLOSING     : true,
      TIME_DELAY             : 5,
      
      OPEN_MENU_ICON         : "img/open-menu-blue.gif",
      CLOSED_MENU_ICON       : "img/closed-menu-blue.gif" // don't add a comma after last property!
  
  };
  
  /** Animated TreeMenu script by Garrett Smith.
  *
  *  URL:http://dhtmlkitchen.com/
  *  email:admin@dhtmlkitchen.com
  *
  *  Usage:see url below (subject to change)
  *  http://dhtmlkitchen.com/dhtml/ui/menutree/
  *
  */
  TreeGlobals={browser:new function()
  {	  var ua=navigator.userAgent;
	  this.OPERA=ua.indexOf("Opera")>0;
	  this.NS4=typeof document.layers!="undefined";
	  this.ICAB=ua.toLowerCase().indexOf("icab")>0;
	  this.IE5=ua.indexOf("MSIE 5")>0&&!this.OPERA;
	  this.MAC=navigator.platform.indexOf("PPC")>0;
	  this.MAC_IE5=this.MAC>0&&this.IE5;},
	  inited:false
  };
  
 
 
 
 
 function toggleMenu(el){
  if(TreeGlobals.browser.OPERA||TreeGlobals.browser.NS4)return;
	  var l=TreeFn.getL(el);
	  if(l.m.bk)return;
	  if(l.m.cnt.mto!=null)return;
	  if(l.isDp){
	  if(TreeParams.OPEN_MULTIPLE_MENUS||l.m.cnt.am==l.m){TreeFn.c(l.m);l.m.cnt.am=null;}}
	  //alert("HOLA");
	  else{if(l.i!=null)l.i.src=TreeParams.OPEN_MENU_ICON;
	  l.m.cnt.mto=l.m;
	  if(TreeParams.OPEN_MULTIPLE_MENUS||l.m.cnt.am==null){TreeFn.o(l.m);}
	  else{TreeFn.c(l.m.cnt.am);
	  if(TreeParams.OPEN_WHILE_CLOSING)TreeFn.o(l.m);
	  else
	  l.m.cnt.am.mic=l.m;
	  }
	  l.m.cnt.am=l.m;}
  }
  
  
  function activateMenu(id) {
  	  if(!window.toggleMenu)return;
	  var b=document.getElementById(id);
	  if(!b)return;
	  toggleMenu(b.getElementsByTagName("span")[0]);
  }
  
  
  function buttonOver(el){window.status=el.parentNode.id;
	  l=TreeFn.getL(el);
	  if(new RegExp("labelHover").test(l.el.className))return;
	  l.el.className+=" labelHover";
  }
  
  
  function buttonOff(l){
  	window.status=window.defaultStatus;TreeUt.rc(l,"labelHover");
  }
  
  if(typeof document.getElementsByTagName!="function"||TreeGlobals.browser.OPERA)buttonOver=buttonOff=function(){};
  Button=function(el,ct){this.el=el;this.ct=ct;this.m=new Menu(document.getElementById(this.ct+"Menu"),this);
  var ics=el.getElementsByTagName("img");
  this.i=(ics.length>0)?ics[0]:null;this.isi=false;
  if(el.tagName=="IMG"){this.isi=true;this.i=el;
  }
  this.isDp=false;};Menu=function(el,l){this.ob=l;this.id=l.ct;this.el=el;this.it=TreeUt.gcwc(this.el,"div","menuNode");this.all=TreeUt.gewc(this.el,"div","menuNode");this.cur=0;this.bk=false;this._r=null;this.cnt=this.getCnt();this.mto=null;this.am=null;this.mic=null;};
  Menu.prototype={o:function(){this.ito[this.cur].style.display="block";if(++this.cur==this.ito.length)this.end("block");},c:function(){this.itc[this.cur].style.display="none";if(++this.cur==this.itc.length)this.end("none");},end:function(disp){this.el.style.display=disp;this.tmr=clearInterval(this.tmr);if(disp=='block')this.cnt.mto=null;else{TreeFn.sdl(this.ob);if(!TreeGlobals.OPEN_WHILE_CLOSING&&this.mic!=null)TreeFn.o(this.mic);this.mic=null;}
  setTimeout("TreeUt.rpnt(Trees[\""+this._r.id+"\"])",50);this.bk=false;},rt:function(){if(this._r==null){var rt=TreeUt.fawc(this.el,"AnimTree");if(rt==null)rt=document.body;if(!rt.id)rt.id="AnimTree_"+Math.round(Math.random()* 100);if(Trees[rt.id]!=null){this._r=Trees[rt.id];this._r.ms[this.id]=this;}
  else
  this._r=new Tree(rt,this);}
  return this._r;},getCnt:function(){var rt=this.rt();var pm=TreeUt.fawc(this.el,"menu");if(pm!=null)return rt.ms[pm.id.replace(/Menu$/,"")];return rt;}
  };Tree=function(el,m){this.el=el;this.am=null;this.ms[m.id]=m;this.mto=null;this.id=el.id;Trees[this.id]=this;};Tree.prototype.ms=new Object();Trees={};TreeFn={getL:function(el){var mId=TreeUt.fawc(el,"button").id;var b;for(var tr in Trees)if(Trees[tr].ms[mId]!=null)return Trees[tr].ms[mId].ob;return new Button(el,mId);},init:function(){if(document.getElementById&&!TreeGlobals.browser.OPERA&&!TreeGlobals.inited){document.writeln("<style type='text/css'>\n/*<![CDATA[ */\n.menu,.menuNode{display:none;}\n/* ]]>*/\n<"+"/style>");TreeGlobals.inited=true;}
  },o:function(m){m.bk=true;
  m.cur=0;
  m.ito=new Array();
  m.el.style.display="block";
  if(m.itc&&m.itc.length>m.it.length)m.ito=m.itc.reverse();
  else
  m.ito=m.it;
  if(!m.ob.isi)m.ob.el.className+=" labelDown";
  m.tmr=setInterval("Trees."+m.rt().id+".ms."+m.id+".o()",TreeParams.TIME_DELAY);m.ob.isDp=true;},
  c:function(m){
  m.bk=true;
  m.cur=0;
  m.itc=new Array();
  for(var i=m.all.length-1,ctr=0;i>0;i--)
  if(m.all[i].style.display=="block")
  m.itc[ctr++]=m.all[i];
  m.itc[m.itc.length]=m.el;
  m.tmr=setInterval("Trees."+m.rt().id+".ms."+m.id+".c()",TreeParams.TIME_DELAY);
  m.ob.isDp=false;
  },
  sdl:function(b)
  {
  if(b.isi)return void(b.i.src=TreeParams.CLOSED_MENU_ICON);
  TreeUt.rc(b.el,"labelHover");
  TreeUt.rc(b.el,"labelDown");
  if(b.i!=null)b.i.src=TreeParams.CLOSED_MENU_ICON;
  }
  };
  TreeFn.init();
  TreeUt={gcwc:function(p,tn,cl){var col;var rCol=[];
  var col=p.childNodes;
  for(var i=0,ctr=0;i<col.length;i++){
  if(!col[i].className||col[i].tagName.toUpperCase()!=tn.toUpperCase())continue;
  if(col[i].className.test(cl," "))rCol[ctr++]=col[i];
  }
  return rCol;
  },gewc:function(p,tn,cl)
  {var col;var rCol=[];
  if(p.all&&tn=="*")col=p.all;
  else col=p.getElementsByTagName(tn);
  for(var i=0,ctr=0;i<col.length;i++){
  if(col[i].className!=null&&col[i].className.test(cl," "))rCol[ctr++]=col[i];
  }
  return rCol;
  },fawc:function(el,cl)
  {for(var p=el.parentNode;p!=null;)
	  {if(p.className!=null&&p.className.test(cl," "))return p;p=p.parentNode;
	  }
  	  return null;
  },rc:function(el,cl)
  {var newClass="";
  var lst=el.className.split(" ");
  for(var i=0;i<lst.length;i++)if(lst[i]!=cl)newClass+=lst[i]+" ";el.className=newClass.normalize();
  },rpnt:function(tr)
  {if(!tr.am)return;
  tr.am.el.style.visibility="hidden";
  tr.am.el.style.visibility="visible";
  }
  };String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"");};
  String.prototype.normalize=function(){return this.trim().replace(/\s\s+/g," ");};
  String.prototype.test=function(i,d){var exps=getTokenizedExps(i,d);
  return(exps.global.test(this)||exps.ends.test(this));};


function getTokenizedExps(i,d){return{global:new RegExp(d+i+d,"\g"),ends:new RegExp("^"+i+d+"|^"+i+"$|"+d+i+"$","\g")};}
