function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function addMenu(ParentDiv,ActiveMenu,Name,Link,Path,Colour)
{
	var NewDiv=document.createElement("DIV");
	var IsSelected;
	
	if(ActiveMenu==Name)
		IsSelected="-over";
	else
		IsSelected="";

	newImage("images/menu/" + Name + "-over.gif");

	NewDiv.innerHTML=	"<div style='float: left'>" +
						"<a href=\"" + Path + Link + "\"" +
						
						"onmouseover=\"changeImages('" + Name +"', 'images/menu/" + Name + "-over.gif'); return true;\"" + 
						"onmouseout=\"changeImages('" + Name +"', 'images/menu/" + Name + ".gif'); return true;\"" + 
						"onmousedown=\"changeImages('" + Name +"', 'images/menu/" + Name + "-over.gif'); return true;\"" + 
						"onmouseup=\"changeImages('" + Name +"', 'images/menu/" + Name + "-over.gif'); return true;\">" + 						
						"<img name='" + Name +"' src='images/menu/" + Name + IsSelected +".gif' border='0' alt='" + Name + "' title='" + Name + "'>" +
						"</a></div>";

	ParentDiv.appendChild(NewDiv); 
}

function addHeaderAndFooter(Path,ActiveMenu)
{
	var HeaderDiv,NewDiv,MenuDiv,LeftSpaceDiv,RightSpaceDiv,FooterDiv,BR;
	
	HeaderDiv=document.getElementById("HeaderDiv");

	HeaderDiv.innerHTML="<div style='background-color: #0E3C61;height:66px;'>" +
						"<div style='padding-left: 6px; padding-top: 13px'>" +
						"<a href='" + Path + "index.html'><img src='http://www.idruna.com/images/home_logo.gif' width=112 height=40 border=0 alt='Idruna Software'></a>" +
						"</div>" +
						"</div>";

	MenuDiv=document.createElement("DIV");
	MenuDiv.innerHTML="<div style='background-color: #135283; width: 100%'>";
	MenuDiv=MenuDiv.firstChild;

	LeftSpaceDiv=document.createElement("DIV");
	LeftSpaceDiv.innerHTML="<div class='bluemenu' style='width: 10px; padding: 1px'>&nbsp</div>";
	MenuDiv.appendChild(LeftSpaceDiv); 

	addMenu(MenuDiv,ActiveMenu,"Products","products.html",Path,"#135283");
	addMenu(MenuDiv,ActiveMenu,"Forums","forums.html",Path,"#236293");
	addMenu(MenuDiv,ActiveMenu,"Support","support.html",Path,"#135283");
	addMenu(MenuDiv,ActiveMenu,"Resources","resources.html",Path,"#135283");
	addMenu(MenuDiv,ActiveMenu,"Downloads","downloads.html",Path,"#135283");
	addMenu(MenuDiv,ActiveMenu,"Store","http://www.idruna.com/cgi-bin/estore.pl","","#A89430");
	addMenu(MenuDiv,ActiveMenu,"Company","company.html",Path,"#135283");
	addMenu(MenuDiv,ActiveMenu,"Home","index.html",Path,"#135283");

	RightSpaceDiv=document.createElement("DIV");
	RightSpaceDiv.innerHTML="<div class='spacer'></div>";
	MenuDiv.appendChild(RightSpaceDiv); 

	HeaderDiv.appendChild(MenuDiv);

	BR=document.createElement("BR");
	HeaderDiv.appendChild(BR); 

	//Footer

	FooterDiv=document.getElementById("FooterDiv");
	FooterDiv.innerHTML="<br><br><div class='pagebase' >" +
						"<div align=right style='width: 160px; float: left;padding: 4px'>&copy;2006 Idruna Software<br> All rights reserved</div>"+
						"<div style='float: left; padding: 4px'>" + 
						"<a href='" + Path + "products.html'>Products</a> | " +  
						"<a href='" + Path + "forums.html'>Forums</a> | " +  
						"<a href='" + Path + "support.html'>Support</a> | " +
						"<a href='" + Path + "resources.html'>Resources</a> | " +
						"<a href='" + Path + "downloads.html'>Downloads</a> | " +
						"<a href='http://www.idruna.com/cgi-bin/estore.pl'>Store</a> | " +
						"<a href='" + Path + "company.html'>Company Info</a> | " +
						"<a href='" + Path + "index.html'>Home</a>" +
						"<br><img src='" + Path + "images/spacer.gif' width=4 height=4><br>" +
						"For questions and comments email <a href='mailto:info@idruna.com'>info@idruna.com</a>"+
						"<br>Idruna, Photogenics, and Pocket Phojo are our trademarks." + 
						"</div></div>";

	// Create javascript element for google counter and insert into document

	_uacct = "UA-97813-1";
	urchinTracker();

}