// ************************************************************
//  JavaScript-Code by Phyrum Tea at http://tea.ch/
//
//  If you copy or modify this piece of code, please tell me
//  where you placed it and don't change my comments.
// 
//  Questions are answered int my forum:
//  http://tea.ch/forum/
//
//  Sie können diesen JavaScript-Code übernehmen wenn Sie eine
//  Meldung über den Ursprung in Ihrem Source-Code integrieren
//  und meine Kommentare unveraendert belassen.
//  Bitte teilen Sie mir mit wo Sie ihn integriert haben.
//
//  E-mail: me@tea.ch
//  Stellen Sie Fragen zum Script in meinem Forum
//  http://tea.ch/forum/
//

// ************************************************************
// Variablen, die Sie selber aendern koennen
// ************************************************************
var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all
var tid = 0

var subMenus = [["0news","portal"],["0hilfe","hilfe"],["0software","software"],["0kreuzwort","kreuzwort"],["0download","download"],
["0sitemap","sitemap"],["0impressum","impressum"]]

function init() {
}

function gX(e) {if (!e) return 0; return e.offsetLeft + gIX(e.offsetParent)}
function gY(e) {if (!e) return 0; return e.offsetTop + gIY(e.offsetParent)}
function gIX(e) {if (!e) return 0; return gX(e)}
function gIY(e) {if (!e) return 0; return gY(e)}

function mouseIn(obj) {
  showMenu(obj)
  return true;
}

function mouseOut(obj) {
  hideMenuLater(obj)
  return true;
}

function mouseClick(toUrl) {
	window.location=toUrl
}

function hideAll(mid) {
  for (i = 0; i < subMenus.length; i++) if(subMenus[i][1] != mid) { hideMenu(subMenus[i][1]) }
}

function getSubMenuID(mid) {
  for (i = 0; i < subMenus.length; i++) if (subMenus[i][0] == mid) return subMenus[i][1]
  return false
}

function hideMenuLater(obj) {
  var mid = getSubMenuID(obj.id)
  if (mid) tid = setTimeout("hideMenu(\""+mid+"\")",500)
}

function hideMenu(mid) { hide(document.getElementById(mid)) }
function hide(e){ e.style.visibility='hidden' }
function show(e){ e.style.visibility='visible' }

function showMenu(obj) {
  if (tid) clearTimeout(tid)
  var mid = getSubMenuID(obj.id)
  if (mid) {
  me = document.getElementById(mid)
  me.style.top = gY(obj)+22
  me.style.left = gX(obj)
  show(me)
  }
  if (obj.id.indexOf('1') != 0) hideAll(mid)
}

//Popup Box- By Jim Silver @ jimsilver47@yahoo.com
//Exlusive permission granted to Dynamic Drive (http://dynamicdrive.com) to include this script in their DHTML archive.
//For full source code, terms of use, and 100's more scripts, visit http://www.dynamicdrive.com
//drag drop function for NS 4////
/////////////////////////////////

var dragswitch=0
var nsx
var nsy
var nstemp

function drag_dropns(name){
if (!ns4)
return
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}

function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}

function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}

//drag drop function for ie4+ and NS6////
/////////////////////////////////


function drag_drop(e){
if (ie4&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx
crossobj.style.top=tempy+event.clientY-offsety
return false
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx
crossobj.style.top=tempy+e.clientY-offsety
return false
}
}

function initializedrag(e){
crossobj=ns6? document.getElementById("showimage") : document.all.showimage

var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "HTML" : "BODY"

while (firedobj.tagName!=topelement&&firedobj.id!="dragbar"){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}

if (firedobj.id=="dragbar"){
offsetx=ie4? event.clientX : e.clientX
offsety=ie4? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}
document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")

////drag drop functions end here//////

function hidebox(){
if (ie4||ns6)
crossobj.style.visibility="hidden"
else if (ns4)
document.showimage.visibility="hide"
}
