var surl = window.location.host.split(".");
surl = surl[surl.length-1];

picdir='http://klf-communications.'+surl+'/DATA/s/';
targeturl='http://www.klf-communications.'+surl+'/';
temptext='';
temptext2='show all';

function replaceIt(string,suchen,ersetzen)
{
	ausgabe = "" + string;
	while (ausgabe.indexOf(suchen)>-1)
	{
    	pos= ausgabe.indexOf(suchen);
    	ausgabe = "" + (ausgabe.substring(0, pos) + ersetzen +
		ausgabe.substring((pos + suchen.length), ausgabe.length));
  	}
  	return ausgabe;
}

if((searchresult.length>1)&&(searchresult[0]!='…'))
{
	temptext='search result for';
	temptext2=temptext;

	for(xi=0;xi<searchresult.length-1;xi++)
	{
		if(searchresult[xi]!='*')
		{
			temptext=temptext+' <a href="http://search.klf-communications.'+surl+'/'+replaceIt(escape(searchresult[xi+1]),'+','%2B')+'"><font class='+searchresult[xi]+'>'+searchresult[xi+1]+'</font></a>';
		}
		else
		{
			temptext=temptext+' '+searchresult[xi+1]+' ';
		}
		
		temptext2=temptext2+' '+searchresult[xi+1]+' ';
		xi++;
	}
	
	if(SC)temptext=temptext+' , single characters are ignored !';
}

preline=0;

function r()
{
	temptext=replaceIt(replaceIt(replaceIt(document.getElementsByTagName("pre")[preline].innerHTML,"&amp;","&"),'\r',''),'\n\t','<br>').split("\n^\n");

	values=temptext[0].split("\t");

	for(xi=0;xi<searchresult.length-1;xi++)
	{
		if(searchresult[xi]!='*')
		{
			currentsearchword=replaceIt(searchresult[xi+1],'"','');

			lastfound=0;

			while(lastfound>=0)
			{
				lastfound=temptext[1].toLowerCase().indexOf(currentsearchword.toLowerCase(),lastfound);
				if(lastfound>=0)
				{
					temptext[1]=
					temptext[1].substring(0,lastfound)+'¼'+searchresult[xi]+'½'+
					temptext[1].substring(lastfound,currentsearchword.length+lastfound)+'¾'+
					temptext[1].substring(currentsearchword.length+lastfound,temptext[1].length+lastfound);
		
					lastfound=lastfound+5;
				}
			}
		}
		xi++;
	}

	temptext[1]=replaceIt(replaceIt(replaceIt(temptext[1],'¼','<font class='),'½','>'),"¾","</font>");

	temptextlines=temptext[1].split("\n");

	temptext[1]='';

	for(xi=0;xi<temptextlines.length;xi++)
	{
		if(temptextlines[xi].substr(0,1)=='#')
		{
			tempcols=temptextlines[xi].substr(2,temptextlines[xi].length).split("\t");
			
			if(tempcols.length==4)
			{
				temptext[1]=temptext[1]+'<tr class=z>'+
				'<td align=center valign=top>'+tempcols[0]+'</td>'+
				'<td align=center valign=top>'+tempcols[1]+'</td>'+
				'<td align=center valign=top>'+tempcols[2]+'</td>'+
				'<td Style="width:2000" valign=top>'+tempcols[3]+'</td></tr>';
			}
			else
			{
				temptext[1]=temptext[1]+'<tr class=z>'+
				'<td colspan=4>'+temptextlines[xi].substr(2,temptextlines[xi].length)+'</td></tr>';
			}
		}
  		else
  		{
			tempcols=temptextlines[xi].split("\t");
			
			if(tempcols.length==4)
			{
				temptext[1]=temptext[1]+'<tr>'+
				'<td align=center valign=top>'+tempcols[0]+'</td>'+
				'<td align=center valign=top>'+tempcols[1]+'</td>'+
				'<td align=center valign=top>'+tempcols[2]+'</td>'+
				'<td Style="width:2000" valign=top>'+tempcols[3]+'</td></tr>';
			}
			else
			{
				temptext[1]=temptext[1]+'<tr>'+
				'<td colspan=4>'+temptextlines[xi]+'</td></tr>';
			}
		}
	}

	document.getElementsByTagName("pre")[preline].innerHTML='<table CELLSPACING=2 CELLPADDING=2 class=b1 onmouseout="this.className=\'b1\'" onmouseover="this.className=\'b2\'"  onclick="opensub(\''+values[0]+'\')">'+
	'<tr><td class=c><hr></td><td><nobr>file '+values[0]+' / '+values[1]+' '+values[2]+' / '+values[3]+' bytes</td><td class=c><hr></td></tr>'+
	'<tr><td colspan=3 class=tableinner><table class=b1 CELLSPACING=0 CELLPADDING=0 Style="width:100%;border-collapse:collapse;">'+temptext[1]+'</table></td></tr>'+
	'</table>';

	preline++;
}

function opensub(value)
{
	if (top.location != self.location)
	{
		window.open(targeturl+'info2.php'+'?'+'dbf='+value,'newinfoframe');
	}
	else
	{
		window.open('http://database.klf-communications.'+surl+'/'+value,'_tab');
	}
}

if (typeof document.addEventListener != 'function' && window.XMLHttpRequest)
{
	font='klf,Impact,Arial';
	fontwieght='';
}
else
{
	font='Arial';
	fontwieght='bold';
}

if (top.location != self.location)
{	
	piclink='#';
}
else
{
	piclink='http://klf-communications.'+surl;
}

content=
'<style>'+
'@font-face {'+
    'font-family: klf;'+
    'font-style:  normal;'+
    'font-weight: normal;'+
    'src: url(\''+picdir+'klf.eot\');'+
'}'+
'*'+
'{'+
	'TEXT-DECORATION: none;'+
	'FONT-FAMILY: '+font+';'+
	'FONT-SIZE: 14px;'+	
	'FONT-WEIGHT: '+fontwieght+';'+
'}'+
'td.tableinner'+
'{'+	
	'BACKGROUND-COLOR: #000;'+
	'padding:5;'+
'}'+
'td'+
'{'+
	'padding-left:1;'+
	'padding-right:1;'+
'}'+
'A'+
'{'+
	'PADDING-RIGHT: 2px;'+
	'PADDING-LEFT: 2px;'+
	'PADDING-BOTTOM: 2px;'+
	'PADDING-TOP: 2px;'+
	'CURSOR: url(\''+picdir+'klf.ani\');'+
'}'+
'table.b2'+
'{'+
	'COLOR: #000;'+
	'BACKGROUND-COLOR: #fff'+
'}'+
'table.b1'+
'{'+
	'COLOR: #fff;'+
	'BACKGROUND-COLOR: #000'+
'}'+
'td.c'+
'{'+
	'WIDTH: 50%;'+
'}'+
'A.c'+
'{'+
	'text-align: center;'+
	'DISPLAY: block;'+
'}'+
'A:link'+
'{'+
	'COLOR: #fff;'+
	'BACKGROUND-COLOR: #000'+
'}'+
'A:visited'+
'{'+
	'COLOR: #fff;'+
	'BACKGROUND-COLOR: #000'+
'}'+
'A:hover'+
'{'+
	'COLOR: #000;'+
	'BACKGROUND-COLOR: #fff'+
'}'+
'A:active'+
'{'+
	'COLOR: #000;'+
	'BACKGROUND-COLOR: #fff'+
'}'+
'IMG'+
'{'+
	'CURSOR: url(\''+picdir+'klf.ani\');'+
	'Border: 0px;'+
'}'+
'BODY'+
'{'+
	'SCROLLBAR-ARROW-COLOR: #000;'+
	'SCROLLBAR-TRACK-COLOR: #000;'+
	'SCROLLBAR-BASE-COLOR: #000;'+
	'BACKGROUND-COLOR: #000;'+
	'scrollbar-3d-light-color: #000;'+
	'scrollbar-dark-shadow-color: #000;'+
	'CURSOR: url(\''+picdir+'klf.cur\')'+
'}'+
'font.a{COLOR:#f00;}'+
'font.b{COLOR:#0f0;}'+
'font.c{COLOR:#00f;}'+
'font.d{COLOR:#0ff;}'+
'font.e{COLOR:#f0f;}'+
'font.f{COLOR:#ff0;}'+
'font.g{COLOR:#f90;}'+
'font.h{COLOR:#0f9;}'+
'font.i{COLOR:#90f;}'+
'font.j{COLOR:#f09;}'+
'font.k{COLOR:#9f0;}'+
'font.l{COLOR:#09f;}'+
'font.m{COLOR:#f99;}'+
'font.n{COLOR:#9f9;}'+
'font.o{COLOR:#99f;}'+
'font.p{COLOR:#ff9;}'+
'font.q{COLOR:#9ff;}'+
'font.r{COLOR:#f9f;}'+
'*.z{COLOR:#aaa;}'+
'INPUT'+
'{'+
	'CURSOR: url(\''+picdir+'klf.ani\')'+
'}'+
'INPUT.b2'+
'{'+
	'COLOR: #000;'+
	'BACKGROUND-COLOR: #fff'+
'}'+
'INPUT.b1'+
'{'+
	'COLOR: #fff;'+
	'BACKGROUND-COLOR: #000'+
'}'+
'hr'+
'{'+
	'COLOR: #fff;'+
	'background-color: #fff;'+
	'border: #fff;'+
	'height: 2'+
'}'+
'</style>'+
'<iframe ID=newinfoframe name=newinfoframe style="display:none;" scrolling=no></iframe>'+
'<form id=kform name=kform action="http://search.klf-communications.'+surl+'" onsubmit=opensearch(); method=post>'+
	'<table WIDTH=100%>'+
		'<tr>'+
			'<td WIDTH=1>'+
				'<a class=c href='+piclink+'>'+
					'<img src='+picdir+'klfcommunications.gif '+
						'alt=www.klf-communications.'+surl+' '+
						'onmouseover="this.src=\''+picdir+'klfcommunications2.gif\';" '+
						'onmouseout="this.src=\''+picdir+'klfcommunications.gif\';" >'+
				'</a>'+
				'</td>'+
			'<td align=center>'+
				'<table>'+
					'<tr>'+
						'<td align=center><nobr>'+
							'<input type=text ID=qxxx name=qxxx size=40 maxlength=255 class=b1 onmouseout="this.className=\'b1\'" '+
								'onmouseover="this.className=\'b2\'" value="'+searchwords+'" > '+
							'<input type=submit class=b1 onmouseout="this.className=\'b1\'" '+
								'onmouseover="this.className=\'b2\'" value=search>'+
						'</td>'+
					'</tr>'+
					'<tr>'+
						'<td align=center style="COLOR: #fff;">'+
							temptext+
						'</td>'+
					'</tr>'+
				'</table>'+
			'</td>'+
			'<td WIDTH=1>'+
				'<a class=c href='+piclink+'>'+
					'<img src='+picdir+'klfcommunications.gif '+
						'alt=www.klf-communications.'+surl+' '+
						'onmouseover="this.src=\''+picdir+'klfcommunications2.gif\';"'+
						'onmouseout="this.src=\''+picdir+'klfcommunications.gif\';">'+
				'</a>'+
			'</td>'+
		'</tr>'+
	'</table>'+
'</form>';

document.write(content);

function opensearch()
{
	openit=true;

	if(document.kform.qxxx.value=='')
	{
		openit=confirm('Do you really want to search without a query ?');
	}

	if(openit)
	{	
		tempsvar=document.kform.qxxx.value;

		if(tempsvar!='…')tempsvar=replaceIt(escape(tempsvar),'+','%2B');

		if(tempsvar=='')
		{
			tempsvar='…';
		}

		window.open('http://search.klf-communications.'+surl+'/'+tempsvar,'_self');
	}

	return false;
}

document.kform.onsubmit = opensearch;

if (top.location != self.location)
{	
	window.open(targeturl+'info2.php'+'?'+'target='+this.name+'&url='+escape(self.location)+'&text='+escape(temptext2),'newinfoframe');
}