// (c) 2007 KystAtlas AS (Hans Martin Mohn)

function gtNavigateStack()
{this.m_pos=-1;this.m_stack=new Array();this.clear=function()
{this.m_pos=-1;this.m_stack.length=0;};this.nextOk=function()
{return(this.m_stack.length-this.m_pos>1);};this.prevOk=function()
{return(this.m_pos>0);};this.getSize=function()
{return this.m_stack.length;};this.getHistoryPos=function()
{return this.m_pos;};this.getHistoryURL=function(pos)
{if(pos<0||pos>=this.m_stack.length)
return null;else
return this.m_stack[pos];};this.getPrev=function()
{if(this.prevOk())
{gtTrace("Stack: getPrev returning "+this.m_stack[this.m_pos-1]+"\n");--this.m_pos;return this.m_stack[this.m_pos];}
else
{gtTrace("Stack: getPrev returning null (empty)\n");return null;}};this.getNext=function()
{if(this.nextOk())
{gtTrace("Stack: getNext returning "+this.m_stack[this.m_pos+1]+"\n");++this.m_pos;return this.m_stack[this.m_pos];}
else
{gtTrace("Stack: getNext returning null (empty)\n");return null;}};this.addUrl=function(url)
{this.m_stack.length=this.m_pos+1;this.m_stack.push(url);this.m_pos++;};this.replaceUrl=function(url)
{if(this.m_pos>=0)
this.m_stack[this.m_pos]=url;else
this.addURL(url);};}