var g_WebNav = new Array();

function NP_webnav_Init(id)
{
	if(this.className && this.className.indexOf("Component")>=0) id = this.idcd;
	//var fram = window.frames["webnav"+id];
	var fram = document.getElementById("webnav"+id);
	g_WebNav[id] = new WebNav(fram,document.forms["address"+id],fram.src);
}

function webnavvalid(id){g_WebNav[id].goToUrl();}
function webnavhome(id){g_WebNav[id].home();}
function webvarefresh(id){g_WebNav[id].refresh();}
function webnavforw(id){g_WebNav[id].forward();}
function webnavback(id){g_WebNav[id].back();}

function WebNav(fram,frm,home)
{
	this.location = new Array();
	this.location[0] = home;
	this.current = 0;
	this.fram = fram;
	this.elm = frm.elements[0];
}

WebNav.prototype.goToUrl = function()
{
	var url = this.elm.value;
	if(url.search("http://") < 0) url = "http://" + url;
	this.location[this.current+1] = url;
	this.current++;
	this.fram.src=url;
}

WebNav.prototype.home = function()
{
	this.elm.value = this.location[0];
	this.goToUrl();
}

WebNav.prototype.refresh = function()
{
	this.fram.src=this.location[this.current];
}

WebNav.prototype.back = function()
{
	if(this.current>0)
	{
		this.current--;
		this.fram.src=this.location[this.current];
		this.elm.value = this.location[this.current];
	}
}

WebNav.prototype.forward = function()
{
	if(this.current<this.location.size()-1)
	{
		this.current++;
		this.fram.src=this.location[this.current];
		this.elm.value = this.location[this.current];
	}
}
