//--! Drag and Drop Funktion
var ie=document.all;
var nn6=document.getElementById&&!document.all;

var isdrag=false;
var x,y;
var dobj;

function movemouse(e)
{
  if (isdrag)
  {
    dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x;
    dobj.style.top  = nn6 ? ty + e.clientY - y : ty + event.clientY - y;
    return false;
  }
}

function selectmouse(e) 
{
  var fobj       = nn6 ? e.target : event.srcElement;
  var topelement = nn6 ? "HTML" : "BODY";

  while (fobj.tagName != topelement && fobj.className != "dragme")
  {
    fobj = nn6 ? fobj.parentNode : fobj.parentElement;
  }

  if (fobj.className=="dragme")
  {
    isdrag = true;
    dobj = fobj;
    tx = parseInt(dobj.style.left+0);
    ty = parseInt(dobj.style.top+0);
    x = nn6 ? e.clientX : event.clientX;
    y = nn6 ? e.clientY : event.clientY;
    document.onmousemove=movemouse;
    return false;
  }
}

document.onmousedown=selectmouse;
document.onmouseup=new Function("isdrag=false");

//--! Scroller für Div Elemente
var px = 10;//mehr=schneller
var timer;
function scroll(val){
clearTimeout(timer);
d=document.getElementById('inhalt')
y=d.scrollTop;
if(val==1)y-=px;
if(val==2)y+=px;
if(y<=d.scrollHeight-d.offsetHeight+px&&y>=0-px){
d.scrollTop=y;
timer=setTimeout('scroll('+val+')',50);
}
if(y<0||y>d.scrollHeight-d.offsetHeight){
clearTimeout(timer);
}
}


//--! Fenster schliessen
function closedrag(){
		document.getElementById("box").style.visibility="hidden";
}
function closeflyer0(){
		document.getElementById("flyer0").style.visibility="hidden";
}


//--! Ajax XMLHTTPREQUEST erzeugung 
var rq=null;
function erzXMLHTTpRequestObject(){
var rq=null;
try{
	rq=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(Error){
	try{
		rq=new ActiveXObject("MSXML2.XMLHTTP");
	}
	catch(Error){
		try{
			rq=new XMLHttpRequest();
		}
		catch(Error){
			alert("Erzeugung des XMLHTTpRequest-Objekts ist fehlgeschlagen");
			}
		}
	}
	return rq;
}
//--! Senden
function sendRq(site){
	rq.open("GET", site, true);
	rq.onreadystatechange=antwort;
	rq.send(null);
	document.getElementById("box").style.visibility="visible";
	px=10000;
	scroll(1);
	px=10;
}
//--! Ladebild
function nachladen(){
	if(rq.readyState==4){
		document.getElementById("lade").style.visibility="hidden";
		document.getElementById("inhalt").style.cursor="move";
		nachladen();
	}
	document.getElementById("lade").style.visibility="visible";
	document.getElementById("inhalt").style.cursor="wait";
	antwort();
}
//--! Antwort
function antwort(){
	if(rq.readyState==4){
		document.getElementById("inhalt").innerHTML=rq.responseText;
	}
}
rq=erzXMLHTTpRequestObject();

function formtest() {
	var name, vorname, adresse, plz, ort; 
	name=document.form1.name.value;
	vorname=document.form1.vorname.value;
	adresse=document.form1.adresse.value;
	plz=document.form1.plz.value;
	ort=document.form1.ort.value;
	
if (name=="" || vorname=="" || adresse=="" || plz=="" || ort=="") {
	window.alert("Bitte alle Felder ausfüllen!")
	return false;
	}
}
//--! Gästebuch schliessen
function closegb(){
		document.getElementById("eingabe").style.visibility="hidden";
}
//--! Gästebuch öffnen
function opengb(){
		document.getElementById("eingabe").style.visibility="visible";
}






