var detailWindow;
var detailWindowWidth=400;
var detailWindowHeight=300;
var detailWindowY=0;
var scrollContent=true;
var scrollOffset=0;
var scroller;
var scrollspeed=1.0;

// Schnellauswahl ...

var fly_left=0;
var fly_top=0;
var fly_mode=0; // 0: away, 1: to cursor 2,3: at cursor 4,5: from cursor

window.defaultStatus=" +++ press 'f' for speed calling +++ wählen Sie 'f' für Schnellauswahl +++ pritisni 'f' za ekspres +++";


function ironman_open( link )
    {
        gs_win = window.open(link,'IronWOMan', "width=500,height=600,dependent=yes,menubar=no,locationbar=no,resizable=yes,scrollbars");
        gs_win.focus();
    }


function set_fly(val) 
{    
    fly_mode = val;
}

function move_fly()
{
//window.defaultStatus = fly_mode;
    
if ( fly_mode == 0 ) {
    setTimeout("move_fly()", 10);
    return;
    }

meet = 0;
if (fly_mode < 4) {   
    if ( fly_left+5 < currentMouseX )
        fly_left = fly_left+(5+Math.random()*5);
        else
    if ( fly_left-5 > currentMouseX )
        fly_left -= (5+Math.random()*5);
        else
        meet=1;
    if ( fly_top+5 < currentMouseY )
        fly_top += (5+Math.random()*5);
        else
    if ( fly_top-5 > currentMouseY )
        fly_top -= (5+Math.random()*5);
        else
        if (meet==1)
            meet=2;
    } else {
        if (fly_mode == 4 )
            fly_left += Math.random()*10;
            else
            fly_left -= Math.random()*10;
        fly_top -= Math.random()*10;
        if (fly_top<-50) {
            fly_mode = 0;
            fly_left=Math.random()*800;
            }
    }
    
if ( meet == 2 ) //angekommen ...
    if ( fly_mode==2) {
    fly_mode = 3;
    selectItem('quick');
    } else
    if ( fly_mode==1) {
    fly_mode = 2;
    }

    
if ((NS4) || (IE5))
	{
	flypopup.visibility = "visible";	
    flypopup.left = fly_left;
    flypopup.top = fly_top;
    } else {

	flypopup.style.visibility = "visible";
    flypopup.style.left = fly_left;
    flypopup.style.top = fly_top;
    }
    setTimeout("move_fly()", 10);
    
}

move_fly();

function showTafel(lang)
{
rand=Math.round(Math.random()*30);

if ( ortstafelclick == "false" ) {
    content="<table border=0 bgcolor=#ffffff><tr><td>";
    content+="<a href=\"javascript:escape('zbor/ZborFrameset2.html', 720,520);setOrtstafelclick( 'true' );\">";
    content+="<img src=\"pictures/dvojezicnetable/sign"+rand+".gif\" alt=\"koroska/kaernten\" border=0>";
    content+="</a></td></tr></table>";
    } else {
    content="<table border=\"0\" bgcolor=\"#ffffff\" cellpadding=\"5\"><tr>";
    content+="<td style=\"background-color:#ffffff\"><a href=\"javascript:showDetailXY_special( 'news/ksssdnews.list.php?mode=presentation', 50,100,400,230 );\"><img src=\"pictures/shortcut/kalender.gif\" border=\"0\"/></a></td>";
    content+="<td style=\"background-color:#ffffff\"><a href=\"javascript:goTo('library');\"><img src=\"pictures/shortcut/book.gif\" border=\"0\"/></a></td>";
    content+="<td style=\"background-color:#ffffff\"><a href=\"javascript:extlink('/mp1/ksssd-org/eforum/index.php?nyc=1');\"><img src=\"pictures/shortcut/forum.gif\" border=\"0\"/></a></td>";
    if (language=="sl") {
        content+="</tr><tr><td style=\"background-color:#ffffff;font-size:8pt;color:#BBBBBB\">prireditve</td>";
        content+="<td style=\"background-color:#ffffff;font-size:8pt;color:#BBBBBB\">knjižnica</td>";
        content+="<td style=\"background-color:#ffffff;font-size:8pt;color:#BBBBBB\">&#269;vekalnica</td>";
        } else
    if (language=="de") {
        content+="</tr><tr><td style=\"background-color:#ffffff;font-size:8pt;color:#BBBBBB\">termine</td>";
        content+="<td style=\"background-color:#ffffff;font-size:8pt;color:#BBBBBB\">bibliothek</td>";
        content+="<td style=\"background-color:#ffffff;font-size:8pt;color:#BBBBBB\">forum</td>";
        } else {
        content+="</tr><tr><td style=\"background-color:#ffffff;font-size:8pt;color:#BBBBBB\">events</td>";
        content+="<td style=\"background-color:#ffffff;font-size:8pt;color:#BBBBBB\">library</td>";
        content+="<td style=\"background-color:#ffffff;font-size:8pt;color:#BBBBBB\">forum</td>";
        }    
    content+="</tr></table>";
    }

xx = 720;
yy = 500;
if(NS4)
	{
	ortstafelpopup.document.write(content);
	ortstafelpopup.document.close();
	ortstafelpopup.visibility = "visible";
    ortstafelpopup.left = xx;
    ortstafelpopup.top  = yy;
	} else if (IE5)	{
	document.all('ortstafeldeck').innerHTML=content;
	ortstafelpopup.visibility = "visible";
    ortstafelpopup.left = xx;
    ortstafelpopup.top  = yy;
    } else {
	ortstafelpopup.innerHTML=content;
	ortstafelpopup.style.visibility = "visible";
    ortstafelpopup.style.left = xx;
    ortstafelpopup.style.top  = yy;
    }

    setTimeout("hideTafel()", 15000);
}


function hideTafel()
{
	    if ( NS6 || MOZ ) {
		    ortstafelpopup.style.visibility = "hidden";
		    } else {
		    ortstafelpopup.visibility = "hidden";
		    }
}


function showTorte()
{
if(NS4)
	{
	tortepopup.visibility = "visible";	
    tortepopup.left = Math.random() * 500;
    tortepopup.top  = Math.random() * 500;
	} else if (IE5)	{
	tortepopup.visibility = "visible";
    tortepopup.left = Math.random() * 500;
    tortepopup.top  = Math.random() * 500;
    } else {
	tortepopup.style.visibility = "visible";
    tortepopup.style.left = Math.random() * 500;
    tortepopup.style.top  = Math.random() * 500;
    }

    setTimeout("moveTorte()", Math.random()*800);
}

function moveTorte()
{
if ((NS4) || (IE5))
	{
    tortepopup.left = Math.random() * 500;
    tortepopup.top  = Math.random() * 500;
    } else {
    tortepopup.style.left = Math.random() * 500;
    tortepopup.style.top  = Math.random() * 500;
    }
    setTimeout("moveTorte()", Math.random()*800);
    if ( Math.random() < 0.1 )
        hideTorte();
}


function hideTorte()
{
    	    if ( NS6 || MOZ ) {
    		    tortepopup.style.visibility = "hidden";
    		    } else {
    		    tortepopup.visibility = "hidden";
    		    }
}


// show details
function showDetailXY(name, detail, lang, xx, yy, ww, hh)
{

	bgcolor="#FF000";

	content="<table border=0 bgcolor=#ffffff><tr>";
	if (NS4 || NS6 || MOZ)
		content+="<td bgcolor="+bgcolor+" width="+ww+" height=300>"; //cell height describes maximum layer height
		else
		content+="<td>";
	if (IE5 || MOZ) {
	    content+="<iframe src=\"content/"+name+detail+"_"+lang+".html\" style=\"display:visible\" height="+detailWindowHeight+" scrolling=auto>";
	    content+="</iframe>";
	    }
	content+="<span id=\"file\">";
	content+="</span>";
	if (NS4) {
	    content+="<layer src=\"content/"+name+detail+"_"+lang+".html\" bgcolor=\"#FFFFEE\" width=300 id='content' style=\"border: 0.1cm groove #000000; padding:0cm;\">";
	    content+="</layer>";
	    }
	content+="</td><td align=right valign=\"bottom\" style=\"background-color:#ffffff\">";
	if (NS4) {
		content+="<a href=\"javascript:escape('content/"+name+detail+"_"+lang+".html', 400,400)\"><img src=\""+projectRoot+"/symbols/escape.gif\" alt=\"escape\" border=0></a><br>";
		content+="<br><img src=\""+projectRoot+"/symbols/1x1.gif\" alt=\"\" border=0>";
		content+="<a onMouseover=\"startScrollContentLayer(1)\" onMouseout=\"stopScrollContentLayer()\" href=\"#\"><img src=\""+projectRoot+"/symbols/up.gif\" alt=\"up\" border=0></a><br>";
		content+="<br><img src=\""+projectRoot+"/symbols/1x1.gif\" alt=\"\" border=0>";
		content+="<font size=1><a href=\"javascript:deselectItem('info', '"+name+"');\"><img src=\""+projectRoot+"/symbols/cancel.gif\" alt=\"close\" border=0></a></font><br>";
		content+="<br><img src=\""+projectRoot+"/symbols/1x1.gif\" alt=\"\" border=0>";
		content+="<a onMouseover=\"startScrollContentLayer(-1)\"  onMouseout=\"stopScrollContentLayer()\" href=\"#\"><img src=\""+projectRoot+"/symbols/down.gif\" alt=\"down\" border=0></a><br>";
		}
		else
		{
		content+="<font size=1><a href=\"javascript:deselectItem('info', '"+name+"');\"><img src=\"symbols/cancel.gif\" alt=\"close\" border=0></a></font>";
		}
	content+="</td></tr></table>";


	if(NS4)
		{
		infopopup.document.write(content);
		infopopup.document.close();
		infopopup.visibility = "visible";
		infopopup.layers['content'].clip.right=300;
		detailWindowY=0;
        scrollspeed=1.0;
		scrollIt=false;
    	infopopup.left = xx;
      	infopopup.top  = yy;
		} else if(IE5) {
		document.all('infodeck').innerHTML=content;
		infopopup.visibility = "visible";
    	infopopup.left = xx;
      	infopopup.top  = yy;
	    } else {
		infopopup.innerHTML=content;
		infopopup.style.visibility = "visible";
    	infopopup.style.left = xx;
      	infopopup.style.top  = yy;
	    }

}



// show details
function showDetailXY_special(name, xx, yy, ww, hh)
{

	bgcolor="#FF000";

	content="<table border=0 bgcolor=#ffffff><tr>";
	if (NS4 || NS6 || MOZ)
		content+="<td bgcolor="+bgcolor+" width="+ww+" height="+hh+">"; //cell height describes maximum layer height
		else
		content+="<td>";
	if (IE5 || MOZ) {
	    content+="<iframe src=\""+name+"\" style=\"display:visible\" width="+ww+" height="+hh+" scrolling=auto>";
	    content+="</iframe>";
	    }
	content+="<span id=\"file\">";
	content+="</span>";
	if (NS4) {
	    content+="<layer src=\"content/"+name+"\" bgcolor=\"#FFFFEE\" width=300 id='content' style=\"border: 0.1cm groove #000000; padding:0cm;\">";
	    content+="</layer>";
	    }
	content+="</td><td align=right valign=\"bottom\" style=\"background-color:#ffffff\">";
	if (NS4) {
		content+="<br><img src=\""+projectRoot+"/symbols/1x1.gif\" alt=\"\" border=0>";
		content+="<a onMouseover=\"startScrollContentLayer(1)\" onMouseout=\"stopScrollContentLayer()\" href=\"#\"><img src=\""+projectRoot+"/symbols/up.gif\" alt=\"up\" border=0></a><br>";
		content+="<br><img src=\""+projectRoot+"/symbols/1x1.gif\" alt=\"\" border=0>";
		content+="<a onMouseover=\"startScrollContentLayer(-1)\"  onMouseout=\"stopScrollContentLayer()\" href=\"#\"><img src=\""+projectRoot+"/symbols/down.gif\" alt=\"down\" border=0></a><br>";
		}

    content+="<font size=1><a href=\"javascript:deselectItem('info', '"+name+"');\"><img src=\"symbols/cancel.gif\" alt=\"close\" border=0></a></font>";
	content+="</td></tr></table>";


	if(NS4)
		{
		infopopup.document.write(content);
		infopopup.document.close();
		infopopup.visibility = "visible";
		infopopup.layers['content'].clip.right=ww;
		detailWindowY=0;
        scrollspeed=1.0;
		scrollIt=false;
    	infopopup.left = xx;
      	infopopup.top  = yy;
		} else if(IE5) {
		document.all('infodeck').innerHTML=content;
		infopopup.visibility = "visible";
    	infopopup.left = xx;
      	infopopup.top  = yy;
	    } else {
		infopopup.innerHTML=content;
		infopopup.style.visibility = "visible";
    	infopopup.style.left = xx;
      	infopopup.style.top  = yy;
	    }

}


function stopScrollContentLayer() {
    //alert('stop');
    scrollContent=false;
    scrollOffset=0;
    clearInterval(scroller);
    scrollspeed=0.0;
    }

function startScrollContentLayer(offset) {
    //alert('start');
    scrollContent=true;
    if (offset != scrollOffset) {
        scrollOffset=offset;
        clearInterval(scroller);
        scrollspeed=1.0;
        scroller=setInterval("scrollContentLayer("+offset+")", 100);
        }
    }

function scrollContentLayer(offset)
{
    if (scrollspeed < 20.0)
        scrollspeed=scrollspeed*1.1;
    var name='content';
    if (document.layers) {
        detailWindowY+=offset*scrollspeed;
        if (detailWindowY<-20000) detailWindowY=-20000;
        if (detailWindowY>-1) detailWindowY=-1;
        //infopopup.layers[name].clip = '0,'+detailWindowY+',300,'+(detailWindowY+500);
        if (infopopup) {
            if (infopopup.layers[name]) {
                infopopup.layers[name].top = detailWindowY;
                } else
                alert(name+' - '+offset);
            } else {
            if (this.layers[name]) {
                this.layers[name].top = detailWindowY;
                } else
                alert(name+' - '+offset);
            }
        window.defaultStatus=name+' - '+detailWindowY+' / '+scrollspeed;
        //if (scrollContent)
            //setTimeout(scrollContentLayer(), 500);
       }

}

function showDetail(name, detail)
{
    showDetailXY(name, detail, language, 20, 50, 300, 400);
}

function showDetail2(name, detail, lang)
{
    showDetailXY(name, detail, lang, 20, 50, 300, 400);
}

function extlink(target)
{
    newWindow=window.open(target,'details', "width=600,height=400,dependent=yes,menubar=no,locationbar=no,resizable=yes,scrollbars");
    newWindow.focus();
}


function contentlink(target, w)
{
    if (NS4 || NS6 || MOZ)
        newWindow=window.open(target,'details', "width="+w+",height=400,dependent=yes,menubar=no,locationbar=no,resizable=yes,scrollbars");
        else
        newWindow=window.open(target,'details', "width="+w+",height=400,dependent=yes,menubar=no,locationbar=no,resizable=yes,scrollbars");
    newWindow.focus();
}

function link(target, lang)
{
    if (NS4) {
    deselectItem('info', '');
    showDetail2(target,'', lang);
    //extlink('content/'+target+'_'+language+'.html')
    } else
    {
    //parent.showDetail(target,'');
    this.document.location.href=target+"_"+lang+".html";
    }
}

function escape(doc, w, h)
{
    newWindow=window.open(doc,'details', "width="+w+",height="+h+",dependent=yes,menubar=no,locationbar=no,resizable=yes,scrollbars");
    newWindow.focus();
}

/*
function showDetail(name, detail) {

	dest="content/"+name+detail+language+".html";
	winname="Fenster_"+name;

	detailWindow=window.open(dest, winname, "width="+detailWindowWidth+", height="+detailWindowHeight+", resizable=yes");
	detailWindow.focus();

}
*/
