// --- Popup --- //

var _client = 'old';
var browser=navigator.appName;
var ver=parseInt(navigator.appVersion);
if (ver >= 3) _client="ok";
if (browser == "Microsoft Internet Explorer") _client='ie';

function dynpopup(url,w,h) {
	usrwidth = screen.width / 2;
	usrheight = screen.height / 2;
	var topf = usrheight - h/2;
	var links =  usrwidth - w/2;
        urllength = url.length;
        winame = url.substring((urllength-9),(urllength-5))
        title = winame
        if (_client == "ok") {
                winparams = 'toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,scrollbars=1,top='+topf+',left='+links+',width=' + w + ',height=' + h  ;
                winame = open(url,winame,winparams);
                history.go(url);
                document.close()
                winame.focus();
        }

        if (_client == "ie") {
                baseurl = location.href;
                winparams = 'toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,scrollbars=1,top='+topf+',left='+links+',width=' + w + ',height=' + h ;
                winame = open(url,winame,winparams);
                document.close();
                if  (ver > 3) winame.focus();
        }
        if (_client == "old") {
                baseurl = location.href;
                winparams = 'toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,scrollbars=1,top='+topf+',left='+links+',width=' + w + ',height=' + h ;
                winame = open(url,winame,winparams);
                document.close();
        }       
}

// --- Page Top --- //
function goPageTop() { 
	window.scrollTo(0,0);
}
if (document.layers) document.captureEvents(Event.ONDBLCLICK);
document.ondblclick=goPageTop;

// --- Resize --- //
function doResize() {
	location.reload();
    return false;
}
if (document.layers) window.captureEvents(Event.RESIZE);
window.onresize=doResize;

// --- Deadlinks --- //
function deadLink(txt) {
	str = (txt) ? txt : 
	"\n Achtung Fehler, bitte schicken Sie eine kurze eMail an den Webmeister! Danke ;o)";
	alert(str);
}

// --- Bookmark --- //
function bookmark() {
         window.external.addFavorite('http://www.ds-webtools.de','[Die Seite für alle Webmaster und Webworker]')
}

// --- Zeit anzeigen --- //

Wochentagname =
   new Array("Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag");
  function ZeitAnzeigen() 
  { 
   var Jetzt = new Date();
   var Tag = Jetzt.getDate();
   var Monat = Jetzt.getMonth() + 1;
   var Jahr = Jetzt.getYear();
   var Stunden = Jetzt.getHours();
   var Minuten = Jetzt.getMinutes();
   var Sekunden = Jetzt.getSeconds();
   var WoTag = Jetzt.getDay();
   var Vortag  = ((Tag < 10) ? "0" : "");
   var Vormon  = ((Monat < 10) ? ".0" : ".");
   var Vorstd  = ((Stunden < 10) ? "0" : "");
   var Vormin  = ((Minuten < 10) ? ":0" : ":");
   var Vorsek  = ((Sekunden < 10) ? ":0" : ":");
   var Datum = Vortag + Tag + Vormon + Monat  + "." + Jahr;
   var Uhrzeit = Vorstd + Stunden + Vormin + Minuten + Vorsek + Sekunden;
   var Gesamt = Uhrzeit;

  if(document.all)
     document.all.MicrosoftUhr.innerHTML = Gesamt;
   else if(document.layers)
    {
     document.NetscapeUhr.document.open();
     Gesamt = '<span class="small")>' + Gesamt + '</span>';
     document.NetscapeUhr.document.write(Gesamt);
     document.NetscapeUhr.document.close();
    }

   window.setTimeout("ZeitAnzeigen()",1000);
  }


// --- Gimmick Erdbeben --- //
function GimmickDummyStart()
{
        return
}

function GimmickVerschub()
{
        this.start        = GimmickDummyStart
}

function GimmickErdbeben()
{
        this.start        = GimmickDummyStart
}

function GimmickErdbebenStart()
{
        if(this.running)
                return
        this.running        = true
        this.counter        = 0
        if(document[this.id])
        {
                this.pos        = parseInt(document[this.id].top)
                setTimeout(this.name + ".end()", this.duration_effect)
        }
        else
        {
                this.pos        = parseInt(window[this.id].style.posTop)
                setTimeout(this.name + ".end()", this.duration_effect)
        }
}

function GimmickErdbebenEnde(akt_pos)
{
        var        welle        = this.hoehe * Math.sin(Math.PI * this.increment * this.counter) * ((this.max_counter - this.counter) / this.max_counter)
        if(document[this.id])
                document[this.id].top        = this.pos + welle
        else
                window[this.id].style.posTop        = this.pos + welle
        this.counter++
        if(this.counter        == this.max_counter)
        {
                if(document[this.id])
                        document[this.id].top        = this.pos
                else
                        window[this.id].style.posTop        = this.pos
                setTimeout(this.name + ".running        = false", this.duration_wait)
        }
        else
                setTimeout(this.name + ".end()", this.duration_effect)
}


function GimmickErdbeben(id, name)
{
        this.hoehe                = 20
        this.duration_effect        = 5
        this.duration_wait        = 1000
        this.running                = false
        this.id                        = id
        this.name                = name
        this.increment                = .1
        this.pos                = 0
        this.counter                = 0
        this.max_counter        = 100
        this.start                = GimmickErdbebenStart
        this.end                = GimmickErdbebenEnde
}

var        Gimmick3 = new GimmickErdbeben("T3", "Gimmick3")
