var howmanymenus = 4; // 0=1 1=2 2=3 etc
var menunames = new Array(howmanymenus);
menunames[0] = "menu";
menunames[1] = "menu2";
menunames[2] = "menu3";
menunames[3] = "menu4";
menunames[4] = "menu5";


//widths of navbar menu headers
var navwidth = new Array(howmanymenus);
navwidth[0] = 130;
navwidth[1] = 140;
navwidth[2] = 180;
navwidth[3] = 140;
navwidth[4] = 150;


var cellpad=0;
var effectopen = -1; //set to -1 for no effects
var effectclose = -1; //set to -1 for no effects
var buttonwidth = 120; //how wide is each menu Item
var buttonheight = 22; //how high is each menu Item
var menudir ="hor"; //horizontal or vert   use "hor" or "ver"
var path_to_stylesheet = "style/style.css";
//these are for news only
var newstimer=5; //in seconds
var newseffect=12;//open and close effect
var newswide=500;
var newshigh=100;

var yoffset=0;



var togggleswitch=0;
var Mac  =  (navigator.userAgent.indexOf("mac")!=-1)  || (navigator.userAgent.indexOf("Mac")!=-1);
var opnew = (navigator.userAgent.indexOf('Opera')!=-1);
var opold = (navigator.userAgent.indexOf('Opera')!=-1);
var msie  =  (navigator.userAgent.indexOf('MSIE')!=-1);
var moz  =  (navigator.userAgent.indexOf('Gecko')!=-1);
var NS6  =  (navigator.userAgent.indexOf('Netscape')!=-1 && navigator.userAgent.indexOf('Gecko')!=-1);
var Nav4  = (document.layers); 
var konq = (navigator.userAgent.indexOf('Konqueror')!=-1); 
if (opold && msie || opold){var opold=1; msie=0;} 
if (msie && !opold){msie=1;}
if(opnew && opold){opold=0;}
if(msie || moz || opnew){var dom = 1;}
var stopshow=0;
var noway=0;



if(konq){
//noway=1;
moz=1;
}

var timerID=null;
var timerID2=null;
var stopclose=1;
var whatsopen="none";
var newsonoff=0;
var operaload=0;
var isform="no";
var menutop=0;
var menuleft=0;
var nsmenutop=0;
var nsmenuleft=0;
	
		

if (Nav4) {
    window.captureEvents(Event.MOUSEMOVE);
    window.onmousemove=move;

}
function move(e) {
nsmenuleft=e.pageX;
nsmenutop=e.pageY;
nsmenuleft1-=0;
nsmenutop-=0;
}

if(noway==0){
//document.write("<link rel=\"stylesheet\" href=\""+path_to_stylesheet+"\">");
}
//###################################################
function startup(){
if(noway){return;}

if (msie && !Mac)
        {       
for(var i = 0 ; i <= howmanymenus ; i++){
togggle2(menunames[i]);}
        }
 else
       {return false;}

}
//End Startup function
//###################################################


//###################################################
function togggle(whatmenu,isMain){
if(noway){return;}

getpositions(); 
if(newsonoff==1){return false;}
if (isMain==1){

	if(timerID){clearTimeout(timerID);}
	
	if (whatsopen == "none"){
	
	togggle2(whatmenu);
	
	isMain=0;
	}

	if(whatsopen == whatmenu){
	isMain=0;
	}

	if(whatsopen != whatmenu && whatsopen != "none"){
	togggle2(whatsopen);
	togggle2(whatmenu);
	isMain=0;
	}
if(timerID2){clearTimeout(timerID2)}
timerID2=setTimeout("togggle2('"+whatmenu+"');",5000);
return;
}
if(isMain==0){
	if(whatsopen != "none" && isMain!=1){
	togggle2(whatmenu);
	}
}
}
//###################################################


//###################################################

function togggle2(whatmenu)
{
if(noway){return;}

//================================================

		
        if (msie)
		//alert(navigator.appVersion);
        {       
		eval(whatmenu+".style.top='"+(document.body.scrollTop+yoffset) +"'");
			//alert(document.body.scrollTop);
                if(effectopen != -1 && effectclose != -1){      
              //  eval(whatmenu+".filters(0).Apply();");
                }
				
                if (eval(whatmenu+".style.visibility") == 'hidden')
                {
			   if(isform=="yes"){document.getElementById('formhide').style.visibility='hidden';}
         	               eval(whatmenu+".style.visibility='visible';");                        
						
                  
                //        eval(whatmenu+".filters[0].transition=effectopen");        
									
                        whatsopen=whatmenu;                     
                }
                else
                {
				
				if(isform=="yes"){document.getElementById('formhide').style.visibility='visible';}
                        eval(whatmenu+".style.visibility = 'hidden';");
                     
                  //      eval(whatmenu+".filters[0].transition=effectclose");
           
                        whatsopen="none";
                }       
            if(effectopen != -1 && effectclose != -1){    
  //         eval(whatmenu+".filters(0).Play();");
       		 }
        }
		
//================================================


//================================================      
if (opold)
{
if(newsonoff !=1){   
	menuheight = buttonheight;
	winx = event.x;
	menuleft=winx;
	x1=buttonwidth/2;
		if(operaload==0 && menudir=="hor"){
		operatop = event.y+buttonheight;;
		operaload=1;
		}	
		if(operaload!=0 && menudir=="hor"){
		menutop=operatop;
		}	
	widtot = winx + x1;
		if (widtot > docwidth && menudir=="hor"){       
		menuleft = winx - buttonwidth;
		}
		else
		{
		var menuleft = winx -x1;
		}	 
		if (menudir=="ver"){
		menuleft = winx+30;
		menutop = event.y;
		}		  
	eval("document.getElementById('"+whatmenu+"').style.left="+menuleft);
	eval("document.getElementById('"+whatmenu+"').style.top="+(window.pageYOffset+yoffset)  ); 
}                 
			    if (togggleswitch==0)
                {
				if(isform=="yes"){document.getElementById('formhide').style.visibility='hidden';}
                        eval(whatmenu+".style.visibility='visible';");
                        togggleswitch=1;
                        whatsopen=whatmenu;
                        return;
                }
                if (togggleswitch==1)
                {
				if(isform=="yes"){document.getElementById('formhide').style.visibility='visible';}
                        eval(whatmenu+".style.visibility = 'hidden';");
                togggleswitch=0;
                whatsopen="none";
                return;
                }               
        
}
//================================================


//================================================
if(Nav4){

if (togggleswitch==0 && isform=='yes'){document.layers["formhide"].visibility = 'hidden';}
if (togggleswitch==1 && isform=='yes'){document.layers["formhide"].visibility = 'visible';}
if (togggleswitch==0 && whatmenu=="newsitem"){document['newsitem'].visibility='visible';togggleswitch=1;return; }
if (togggleswitch==1 && whatmenu=="newsitem"){document['newsitem'].visibility='hidden';togggleswitch=0;return; }
if (togggleswitch==0){
		if(menudir =="hor"){
 		x1=buttonwidth/2;		
 		nsmenuleft-=x1; 		
		eval("document['"+whatmenu+"'].top="+nsmenutop+"+"+buttonheight);
		eval("document['"+whatmenu+"'].left="+nsmenuleft+"+10");
		}
		if(menudir =="ver"){
		eval("document['"+whatmenu+"'].top="+nsmenutop+(window.pageYOffset+yoffset));
		eval("document['"+whatmenu+"'].left="+nsmenuleft+"+20");
		}
document.all[whatmenu].visibility='visible';           
togggleswitch=1;
whatsopen=whatmenu;
return;
}
		if (togggleswitch==1){
		document.all[whatmenu].style.visibility='hidden';              
		togggleswitch=0;
		whatsopen="none";
		return;
		}
}
//================================================


//================================================
if (moz || opnew)
        {
		eval("document.getElementById('"+whatmenu+"').style.top="+(window.pageYOffset+yoffset) );
        if(togggleswitch == 0){
		if(isform=="yes"){document.getElementById('formhide').style.visibility='hidden';}
        eval("document.getElementById('"+whatmenu+"').style.visibility = 'visible';");
togggleswitch=1;
whatsopen=whatmenu;
;return;}
    if(togggleswitch == 1){
	if(isform=="yes"){document.getElementById('formhide').style.visibility='visible';}
	eval("document.getElementById('"+whatmenu+"').style.visibility = 'hidden';");togggleswitch=0;whatsopen="none";return;}
        }


//================================================
}



//###################################################
function goSub(where,what,tgt)
{
stopshow=-1;
clearTimeout(timerID);
clearTimeout(timerID2);
if(tgt==''){var wintgt="self";}
else
{var wintgt=tgt;}    
if(effectopen!=-1 || effectclose!=-1){togggle2(what);}
  
        if(tgt == ''){whereto= "location.href='/d/"+where+"'";}    
        if(tgt == 'new'){whereto= "window.open('"+where+"','"+tgt+"');";}       
        if (tgt == 'url'){whereto= "location.href='"+where+"'";}    
        else if(tgt != 'new' && tgt != ''){whereto= "parent."+tgt+".location.href='/d/"+where+"'";}
        setTimeout("eval(whereto)",550);
}
//###################################################



//###################################################
function getpositions(){
if(noway){return;}
if (Nav4 || NS6){
docwidth = window.innerWidth;docwidth-=0; }
if(msie || (moz && !NS6) || konq || opold || opnew ){
docwidth = document.body.clientWidth;
docwidth-=0;
}

//================================================      
if (dom){
var menutop = document.getElementById('navbar').offsetTop;
var menuleft = document.getElementById('navbar').offsetLeft;

var menuheight = document.getElementById('navbar').offsetHeight;

if(menudir=="hor"){menutop += menuheight+2;}
if(menudir=="ver"){ menuleft += navwidth[0]+5;menutop += cellpad;}
         
for(var i = 0 ; i <= howmanymenus ; i++){
if(menudir == "hor"){menuleft+=cellpad;}
eval("document.getElementById('"+menunames[i]+"').style.left="+menuleft);
eval("document.getElementById('"+menunames[i]+"').style.top="+(document.body.scrollTop+yoffset));  
              
	if(menudir=="hor"){
	tot=menuleft+navwidth[i]+buttonwidth;
		if( tot >= docwidth ){
		menuleft += navwidth[i]+navwidth[i+1];
		menuleft -= buttonwidth;  
		}
		else
		{                        
		menuleft += navwidth[i]+cellpad;
		if(NS6){menuleft += cellpad;}
		}
}

	if(menudir=="ver"){
	menutop += buttonheight+cellpad+cellpad;
		if(moz){menutop += cellpad;}
	}
}
//================================================

//###################################################
}
}


function killMenu(whatwait){
if(noway){return;}
if(stopshow==-1){return;}
if(timerID){clearTimeout(timerID)}
if(timerID2){clearTimeout(timerID2)}
timerID=setTimeout("togggle2('"+whatwait+"');",500);
}
function checkMenu(){
if(noway){return;}
if(stopshow==-1){return;}
if(timerID){clearTimeout(timerID)}
if(timerID2){clearTimeout(timerID2)}
}

function Go(x) {
 if(x == "nothing") {
   document.forms[0].reset();
   document.forms[0].elements[0].blur();
   return;
 }
 else if(x == "end")
   top.location.href = parent.frames[1].location;
 else {
   document.location.href = x;
   document.forms[0].reset();
   document.forms[0].elements[0].blur();
 }
}

function Go2(x) {
   newWindow = window.open(x,"subWind","HEIGHT=250,WIDTH= 400,LEFT=160,TOP=200");
newWindow.focus();   

}

function Bild(x) {

   newbild = window.open("about:blank","subWind","resizeable,HEIGHT=250,WIDTH= 400,LEFT=160,TOP=80");
    newbild.document.clear();
   newbild.document.open();
  
   newbild.document.write('<html><script language="JavaScript" type="text/javascript">function fit() {window.resizeTo(parseInt(document.getElementById("bild1").width+40),parseInt(document.getElementById("bild1").height)+120);}</script><body bgcolor="#f7f7fe" align="center" onload="fit();"><table align="center" border="0" bgcolor="#cc3333"><tr><td>');
   newbild.document.write('<img id="bild1" src="'+x+'">');
   
   newbild.document.write('</td></tr></table><table width="95%" border="0"><tr height="40"><td align="right" valign="middle"><a href="javascript:window.close();"  style="white; font: 12px Verdana;"><font color="#cc3333"><strong>Fenster schliessen</strong></font></a></td></tr></table>');
   newbild.document.write('</body></html>');
   newbild.document.close();
	newbild.focus();   
 //newbild.innerWidth = parseInt(newbild.document.getElementById("bild1").width+40);
// newbild.innerHeight = parseInt(newbild.document.getElementById("bild1").height+120);

}

function changeCSS(whatitem,whatstyle){
eval("document.getElementById('"+whatitem+"').className = '"+whatstyle+"';");

}

function schreibmenu() {
document.write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><img src=\"/img/spacer.gif\" height=\"1\" width=\"30\"></td><td><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" id=\"navbar\"><tr> <td><a href=\"#1\"></a></td><td><a href=\"#2\"></a></td><td><a href=\"#3\"></a></td><td><a href=\"#4\"></a></td><td><a href=\"#5\"></a></td></tr></table></td></tr></table>");
document.write("<a name=\"1\"></a>");
document.write("<table id=\"menu\" width=\"130\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"onmouseout=\"killMenu('menu')\" onmouseover=\"checkMenu();\"><tr><td>	<a class=menulink1 href=\"vergleich.htm\" onclick=\"goSub('vergleich.htm','menu','');return false;\"> Modell&uuml;bersicht </a>	<a class=menulink1 href=\"k1_content_0.htm\" onclick=\"goSub('k1_content_0.htm','menu','');return false;\"> Topcat K1 </a>    <a class=menulink1 href=\"k2_content_0.htm\" onclick=\"goSub('k2_content_0.htm','menu','');return false;\"> Topcat K2 </a>	<a class=menulink1 href=\"k3_content_0.htm\" onclick=\"goSub('k3_content_0.htm','menu','');return false;\"> Topcat K3 </a>	<a class=menulink1 href=\"45_content.htm\" onclick=\"goSub('45_content_0.htm','menu','');return false;\"> Topcat 4.5 </a>	<a class=menulink1 href=\"chico_content_0.htm\" onclick=\"goSub('chico_content_0.htm','menu','');return false;\"> Kindercat Chico </a></td></tr></table>");

document.write("<a name=\"2\"></a>");
document.write("<table id=\"menu2\" onmouseout=\"killMenu('menu2')\" onmouseover=\"checkMenu();\" width=\"140\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td valign=\"top\">	<a class=menulink1 href=\"schulen.htm\" onclick=\"goSub('schulen.htm','menu2','');return false;\"> Segelschulen </a><a class=menulink1 href=\"regatta.htm\" onclick=\"goSub('regatta.htm','menu2','');return false;\"> Regatten </a>	<a class=menulink1 href=\"itca.htm\" onclick=\"goSub('itca.htm','menu2','');return false;\"> Klassenvereinigung </a>	<a class=menulink1 href=\"galerie.htm\" onclick=\"goSub('galerie.htm','menu2','');return false;\"> Galerie </a>	</td></tr></table>");

document.write("<a name=\"3\"></a>");
document.write("<table id=\"menu3\" onmouseout=\"killMenu('menu3')\" onmouseover=\"checkMenu();\"  width=\"180\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td valign=\"top\"><a class=menulink1 href=\"/shop\" target=\"_blank\"> Ersatzteile &amp; Zubeh&ouml;r</a>	<a class=menulink1 href=\"doku.htm\" onclick=\"goSub('doku.htm','menu3','');return false;\"> Ersatzteilzeichnungen </a>	</td></tr></table>");

document.write("<a name=\"4\"></a>");
document.write("<table id=\"menu4\" onmouseout=\"killMenu('menu4')\" onmouseover=\"checkMenu();\"  width=\"140\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td valign=\"top\"><a class=menulink1 href=\"anfrage.htm\" onclick=\"goSub('anfrage.htm','menu4','');return false;\"> Online-Anfrage </a> <a class=menulink1 href=\"haendler.htm\" onclick=\"goSub('haendler.htm','menu4','');return false;\"> H&auml;ndler </a>	<a class=menulink1 href=\"http://cgi.topcat.at/cgi-bin/gebrauchtboote.pl\" onclick=\"goSub('http://cgi.topcat.at/cgi-bin/gebrauchtboote.pl','menu4','url');return false;\"> Gebrauchtboote </a><a class=menulink1 href=\"doku.htm\" onclick=\"goSub('doku.htm','menu4','');return false;\"> Dokumentation </a>	</td>	</td></tr></table>");

document.write("<a name=\"5\"></a>");
document.write("<table id=\"menu5\" onmouseout=\"killMenu('menu5')\" onmouseover=\"checkMenu();\"  width=\"150\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td valign=\"top\"><a class=menulink1 href=\"kontakt.htm\" onclick=\"goSub('kontakt.htm','menu5','');return false;\"> Kontakt </a>	<a class=menulink1 href=\"agb.htm\" onclick=\"goSub('agb.htm','menu5','');return false;\"> AGB </a>	<a class=menulink1 href=\"history.htm\" onclick=\"goSub('history.htm','menu5','');return false;\"> Geschichte </a>	<a class=menulink1 href=\"presse.php\" onclick=\"goSub('presse.php','menu5','');return false;\"> Presse </a>		</td></tr></table>");
}

function s_schule(s1,s2) {
document.write('<a href="'+s2+'" target="_blank">'+s1+'</a><br>');

}

function breakup(str) {
var neu; 
neu = str.replace(/,+/,", ");
document.write(neu);
}

