<?php

// normal toc() function, has always to be active, if one of the li() functions is being used ////////////////////
function xtoc($start,$end){global $hc,$hl,$s,$l;$ts_ta=array();if(isset($start)&&!isset($end))$end=$start;if(!isset($end))$end=3;if(!isset($start))$start=1;for($ts_i=0;$ts_i<$hl;$ts_i++){if($l[$hc[$ts_i]]==1){if($start==1)$ts_ta[]=$hc[$ts_i];$ts_r1=$ts_r2=$ts_i;}if($s==$hc[$ts_i]){$ts_s3=true;for($ts_j=$ts_r1+1;$ts_j<$hl;$ts_j++){if($l[$hc[$ts_j]]==1)break;if($l[$hc[$ts_j]]==2){if($start<3&&$end>1)$ts_ta[]=$hc[$ts_j];$ts_r2=$ts_j;$ts_s3=false;}if($s==$hc[$ts_j]){for($k=$ts_r2+1;$k<$hl;$k++){if($l[$hc[$k]]==3){if($end>2)$ts_ta[]=$hc[$k];}else{$ts_s3=false;break;}}}if($l[$hc[$ts_j]]==3&&$l[$s]==1&&$ts_s3)if($end>2)$ts_ta[]=$hc[$ts_j];}}}return xli($ts_ta,$start);}

// ( 3 ) li() function: clicked button remains clickable ////////////////////
function xli($ts_ta,$ts_st){global $s,$c,$l,$h,$hc,$hl;if(count($ts_ta)==0)return;$ts_t='';if($ts_st=='submenu'||$ts_st=='search')$ts_t.='<ul class="'.$ts_st.'">';$b=0;if($ts_st==1||$ts_st==2||$ts_st==3){$b=$ts_st-1;$ts_st='menulevel';}$ts_j=0;$le=0;$lf[0]=$lf[1]=$lf[2]=$lf[3]=false;for($ts_i=0;$ts_i<$hl;$ts_i++){if(!isset($ts_ta[$ts_j]))break;if($hc[$ts_i]!=$ts_ta[$ts_j])continue;$ts_tf=($s!=$ts_ta[$ts_j]);if($ts_st=='menulevel'||$ts_st=='sitemaplevel'){for($k=(isset($ts_ta[$ts_j-1])?$l[$ts_ta[$ts_j-1]]:$b);$k<$l[$ts_ta[$ts_j]];$k++)$ts_t.='<ul class="'.$ts_st.($k+1).'">';}$ts_t.='<li class="';if(!$ts_tf)$ts_t.='s';$ts_t.='doc';if(isset($hc[$ts_i+1]))if($l[$hc[$ts_i+1]]>$l[$ts_ta[$ts_j]])$ts_t.='s';$ts_t.='">';/*if($ts_tf)*/$ts_t.=a($ts_ta[$ts_j],'');$ts_t.=$h[$ts_ta[$ts_j]];/*if($ts_tf)*/$ts_t.='</a>';if($ts_st=='menulevel'||$ts_st=='sitemaplevel'){if((isset($ts_ta[$ts_j+1])?$l[$ts_ta[$ts_j+1]]:$b)>$l[$ts_ta[$ts_j]])$lf[$l[$ts_ta[$ts_j]]]=true;else{$ts_t.='</li>';$lf[$l[$ts_ta[$ts_j]]]=false;}for($k=$l[$ts_ta[$ts_j]];$k>(isset($ts_ta[$ts_j+1])?$l[$ts_ta[$ts_j+1]]:$b);$k--){$ts_t.='</ul>';if($lf[$k-1]){$ts_t.='</li>';$lf[$k-1]=false;}};}else $ts_t.='</li>';$ts_j++;}if($ts_st=='submenu'||$ts_st=='search')$ts_t.='</ul>';return $ts_t;}

// ( 6 ) xsearchbox() function: removes "Search" Text from search button and inserts button text in input field ///
function xsearchbox(){global $sn,$tx;return "<div id=\"searchbox\"><form action=\"".$sn."\" method=\"post\">".tag("input type=\"text\" class=\"text\" name=\"search\" size=\"12\" value=\"".$tx['search']['button']."\" onfocus=\"if(this.value=='".$tx['search']['button']."'){this.value='';}\" onblur=\"if(this.value==''){this.value='".$tx['search']['button']."';}\"").tag("input type=\"hidden\" name=\"function\" value=\"search\"")." ".tag("input type=\"submit\" class=\"submit\" value=\"\"")."</form></div>";}

?>