// Page Navigator pnPart3 (26-June-2006)
// by Vic Phillips http://www.vicsJavaScripts.org.uk

var pnMaxHeight=600;      // the maximum height of the KeyWord Search Panel           (digits)
var pnParth='';

// Functional Code KeyWord Search

// NO NEED to Change


var pnTO,pnSP,pnSPS,pnSel,pnSR,pnSRS,pnIP,pnBdy;
var pnDelayScroll=false;
var pnSLoc=self.location.toString();
pnSLoc=pnSLoc.substring(pnSLoc.lastIndexOf('/')+1,pnSLoc.length);

var pnSearchAry=new Array();
var pnFoundAry=new Array();
var pnDAry=new Array();

var pnCursor='pointer';

if (document.all){ pnCursor='hand'; }

for (pn0=0;pn0<pnNavAry.length;pn0++){
 pnSearchAry[pn0]=new Array();
 pnwds=pnNavAry[pn0][0].split(' ');
 for (pn1=0;pn1<pnwds.length;pn1++){
  pnSearchAry[pn0][pn1]=pnwds[pn1];
 }
// adds words from the message
 if (pnNavAry[pn0][3]){
  pnwms=pnNavAry[pn0][3].split(' ');
  for (pn2=0;pn2<pnwms.length;pn2++){
   pnSearchAry[pn0][pnSearchAry[pn0].length]=pnwms[pn2];
  }
 }
}

function pnInitSearchPanel(){
 pnBdy=document.getElementsByTagName('BODY')[0];
 pnSP=document.createElement('DIV');
 pnSP.onmouseout=function(){ pnTO=setTimeout('pnSRS.visibility=\'hidden\';pnSPS.height=\'50px\';pnIP.value=\'\';',200); }
 pnSP.onmouseover=function(){ clearTimeout(pnTO); }
 pnBdy.appendChild(pnSP);
 pnSPS=pnSP.style;
 pnSPS.position='absolute';
 pnSPS.zIndex=pnZIndex;
 pnSPS.top=pnTop+'px';
 pnSPS.left=pnLeft+'px';
 pnSPS.width=(pnWidth+20)+'px';
 pnSPS.height=(pnTxtSize*2+25)+'px';
 pnSPS.backgroundColor=pnBGColor2;
 pnSPS.color=pnTxtColor2;
 pnSPS.textAlign='center';
 pnSPS.fontSize=pnTxtSize+'px';
 pnSPS.border='solid black 1px';
 if (document.getElementById(pnSLoc.split('#')[1])){
  pnSPS.top=(pnFTop(document.getElementById(pnSLoc.split('#')[1]))+pnTop)+'px';
 }

 pnSel=document.createElement('SELECT');
 pnSP.appendChild(pnSel);
 pnSel.onchange=function(){ pnPageNavigation(this.selectedIndex); }
 for (pn0=0;pn0<pnNavAry.length;pn0++){
  pnSel.options[pn0]=new Option(pnNavAry[pn0][0],pnNavAry[pn0][1],true,true);
 }
 pnSel.selectedIndex=0;
 pnsels=pnSel.style;
 pnsels.position='absolute';
 pnsels.width=(pnWidth)+'px';
 pnsels.left='10px';
 pnsels.top='5px';
 pnsels.backgroundColor=pnBGColor1;
 pnsels.color=pnTxtColor1;
 pnsels.fontSize=pnTxtSize+'px';

 pnt=document.createElement('DIV');
 pnSP.appendChild(pnt);
 pnt.appendChild(document.createTextNode('Keyword Search'));
 pnts=pnt.style;
 pnts.position='absolute';
 pnts.left='10px';
 pnts.top=(pnSel.offsetHeight+pnSel.offsetTop+4)+'px';
 pnts.textAlign='left';
 pnts.fontSize=pnTxtSize+'px';
 pnIP=document.createElement('INPUT');
 pnSP.appendChild(pnIP);
 pnIP.value='Keyword Search';
 pnIP.onclick=function(){ this.value=''; pnIP.onkeyup=function() { pnFind(this); } }
 pnips=pnIP.style;
 pnips.position='absolute';
 pnips.width='80px';
 pnips.left=(pnSel.offsetWidth-pnIP.offsetWidth+10)+'px';
 pnips.top=(pnSel.offsetHeight+pnSel.offsetTop+2)+'px';
 pnips.backgroundColor=pnBGColor1;
 pnips.color=pnTxtColor1;
 pnips.fontSize='12px';

 pnSR=document.createElement('DIV');
 pnSP.appendChild(pnSR);
 pnSRS=pnSR.style;
 pnSRS.position='absolute';
 pnSRS.width=pnWidth+'px';
 pnSRS.left='10px';
 pnSRS.top=(pnIP.offsetHeight+pnIP.offsetTop+2)+'px';
 pnSRS.textAlign='left';
 pnSRS.fontSize='12px';

 if (pnMessWidth){ pnInitMessage(); }
}

function pnFind(obj){
 pnFoundAry=new Array();
 pnfc=obj.value.split(' ');
 for (pnA=0;pnA<pnfc.length;pnA++){
  for (pn0=0;pn0<pnSearchAry.length;pn0++){
   for (pn1=0;pn1<pnSearchAry[pn0].length;pn1++){
    if (pnfc[pnA].toLowerCase()==pnSearchAry[pn0][pn1].substring(0,pnfc[pnA].length).toLowerCase()){
     pnNavAry[pn0][4]=pn0;
     pnFoundAry[pnFoundAry.length]=pnNavAry[pn0];
    }
   }
  }
 }
 if (pnFoundAry.length>1){
  pnFoundAry=pnFoundAry.noduplicates(pnFoundAry);
 }
 pnds=pnSR.getElementsByTagName('DIV');
 pnSP.style.height=(pnTxtSize*2+25)+'px';
 for (pn5=0;pn5<pnDAry.length;pn5++){
  pnSR.removeChild(pnDAry[pn5]);
 }
 pnDAry.length=0;
 if (pnFoundAry.length<1){ return; }
 for (pn6=0;pn6<pnFoundAry.length;pn6++){
  pnDAry[pn6]=document.createElement('DIV');
  pnd=pnDAry[pn6];
  pntxt=document.createElement('DIV');
  pntxt.appendChild(document.createTextNode(pnFoundAry[pn6][0]));
  pntxt.style.position='relative';
  pntxt.style.left='10px';
  pntxt.style.fontSize='12px';
  pnd.appendChild(pntxt);
  pnd.link=pnFoundAry[pn6][2];
  pnd.scroll=pnFoundAry[pn6][4];
  pnd.mess=pnFoundAry[pn6][3];
  pnd.onmouseover=function(){ pnSPMseOver(this); }
  pnd.onmouseout=function(){ pnSPMseOut(this); }
  pnd.onclick=function(){
   if (this.link){
    window.top.location=pnParth+this.link;
   }
   else {
    pnPageNavigation(this.scroll);
   }
  }
  pnSR.appendChild(pnd);
  pnds=pnd.style;
  pnds.position='absolute';
  pnds.height='15px';
  pnds.width=pnWidth+'px';
  pnds.left='0px';
  pnds.top=(pn6*15)+'px';
  pnds.backgroundColor='#FFFFCC';
  pnds.cursor=pnCursor;
 }
 pnSR.style.overflowX='hidden';
 pnSR.style.overflowY='hidden';
 if (pnDAry.length>0){
  pnSR.style.visibility='visible';
  pnSR.style.height=(pnDAry[pnDAry.length-1].offsetTop+20)+'px';
  pnSP.style.height=(pnSR.offsetHeight+70)+'px';
 }
 if (pnSP.offsetHeight>pnMaxHeight){
  pnSR.style.height=(pnMaxHeight-55)+'px';
  pnSR.style.overflowY='scroll';
  pnSP.style.height=(pnMaxHeight)+'px';
 }
}

function pnSPMseOver(pnobj){
 clearTimeout(pnTO);
 pnobj.style.backgroundColor='#CCFFFF';
 if (pnM){ pnMessage(pnobj); }
}

function pnSPMseOut(pnobj){
 pnobj.style.backgroundColor='#FFFFCC';
 if (pnM){ pnM.style.visibility='hidden'; }
}

Array.prototype.noduplicates=function(zxca){
 if (zxca.length<2){ return zxca; }
 zxctemp=[zxca[0]];
 for (zxc1=0;zxc1<zxca.length;zxc1++){
  zxcck=true;
  for (zxc2=0;zxc2<zxctemp.length;zxc2++){ if (zxctemp[zxc2]==zxca[zxc1]){ zxcck=false; } }
  if (zxcck){ zxctemp[zxctemp.length]=zxca[zxc1]; }
 }
 return zxctemp;
}
