function TDim(pX, pY)
{
  this.X = pX;
  this.Y = pY;
}

function getWindowDims()
{
  var dims = new TDim(0, 0);
  if (self.innerHeight) // all except Explorer
  {
	  dims.X = self.innerWidth;
  	dims.Y = self.innerHeight;
  }
  else if (document.documentElement && document.documentElement.clientHeight)
	  // Explorer 6 Strict Mode
  {
	  dims.X = document.documentElement.clientWidth;
  		dims.Y = document.documentElement.clientHeight;
		
  }
  else if (document.body) // other Explorers
  {
    dims.X = document.body.clientWidth;
    dims.Y = document.body.clientHeight;
	
  }
  return dims;
}


function schliessen() {
 slideUp();
}

function showWerbung() {
 document.getElementById("werbung").style.visibility = 'visible';
 document.getElementById("cover").style.visibility = 'visible';
 //document.getElementById("cover").style.height = parseInt(dims2.y) + "px";
}

function WerbungOn() {
	showWerbung();
	init();
	slideDown();
	//TimeoutClose = setTimeout("schliessen()",5000);
}

function WerbungOff() {
	//showWerbung();
	//init();
	//slideDown();
	TimeoutClose = setTimeout("schliessen()",1000);
	//slideUp();
}

function moveTo(obj, x, y) {
        if (document.getElementById) {
        document.getElementById('menuDiv').style.left = x;
        document.getElementById('menuDiv').style.top = y;
        }
}

function init(){
        if(document.getElementById){
        obj = document.getElementById("werbung");
       	obj.style.top = -600 + "px";
        }
}

function slideDown(){
		dims = getWindowDims();
		document.getElementById("cover").style.height = dims.Y + "px";
        if(document.getElementById){
                if(parseInt(obj.style.top) < 100){
                        //obj.style.top = parseInt(obj.style.top) + 15 + "px";
                        //aktiv = window.setTimeout("slideDown()",10);
						ch = dims.Y/2 - 100;						
						obj.style.top = ch + "px";
						cw = document.body.clientWidth/2 - 362;
						obj.style.left = cw + "px";
                }
        }
}

function slideUp(){
        if(document.getElementById){
                if(parseInt(obj.style.top) > -600){
                       obj.style.top = parseInt(obj.style.top) - 20 + "px";
						//alert(obj.style.opacity);//: 1
						//obj.style.-moz-opacity: 1;
						//obj.style.filter="alpha(opacity="+ 100 + ")";
						
                      TimeoutSlideUp = setTimeout("slideUp()",10);
                } else {
				 	document.getElementById("werbung").style.visibility = 'hidden';
					 document.getElementById("cover").style.visibility = 'hidden';
					 clearTimeout(TimeoutSlideUp);
				}
        }
}

function moveTo(obj, x, y) {
        if (document.getElementById) {
        document.getElementById('menuDiv').style.left = x;
        document.getElementById('menuDiv').style.top = y;
        }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
