//confirm Abfrage ok=link bei ok, esc=link bei abbruch//
function confirmDelete(ok,esc,confText) {
	if (confirm(confText)){ 
		location.href=ok;		
	} else { 
		location.href=esc;		       
	} 
}

function showHideDIV(id,wert){
	document.getElementById(id).style.display=wert;
	}
function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function selectSHOW(x){
	if(document.getElementById('selectINPUT1')){
		if(x==0){
			document.getElementById('selectINPUT1').style.visibility='visible';
			document.getElementById('selectINPUT2').style.visibility='visible';
		}
		if(x==1){
			document.getElementById('selectINPUT1').style.visibility='hidden';
			document.getElementById('selectINPUT2').style.visibility='hidden';
		}
	}
}
var oldid=0;
var oldobj=0;
var actid=0;

function setoldid(id){
	oldid=id;
	actid=id;
}
function show_umen(id,obj,leftPos,topPos){
	if(id==null)id=act_id;
	if(id){
		document.getElementById(id).style.visibility='visible';
		var point = { x: 0, y: 0 };
	    while (obj){
		    point.x = point.x + parseInt(0+obj.offsetLeft,10);
		    point.y = point.y + parseInt(0+obj.offsetTop,10);
		    obj = obj.offsetParent;
	    }
	    document.getElementById(id).style.left = point.x-5+leftPos+'px';
		document.getElementById(id).style.top = point.y+18+topPos+'px';
	}
	if(oldid && (oldid != id)){
		document.getElementById(oldid).style.visibility='hidden';
		
	}
	oldid=id;
}
function link(name)
{
	document.forms[name].submit();	
}	

function nw(url,fen)
{
    fensteri=window.open(url, fen,'width=750,height=600,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes');	
	  fensteri.focus();
}
function datew()
{
    fensteri=window.open("datepicker/datepicker.php", "datewin",'width=350,height=400,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');	
	  fensteri.focus();
}
function setDatum_BAK(obj,formName){
	var mdate = showModalDialog("../datepicker/datepicker.php", "", "dialogWidth:20em; dialogHeight:19em");
	if(mdate){
		obj.innerHTML='<input type=\"text\" value=\"'+mdate.date+'\" class=\"INPUTTerm\">';
		obj.time=mdate.timestamp;
		document.forms(formName)(obj.id).value=mdate.timestamp;
	}
}
function setDatum(obj,formName,prePath){
	var mdate = showModalDialog(prePath+"datepicker/datepicker.php", "", "dialogWidth:26em; dialogHeight:19em");
// 'prePath' ist als Leerstring zu übergeben, wenn Aufrufstelle index.php included, sonst entsprechend der position (y.B. '../')
	if(mdate){
		obj.innerHTML='<input type=\"text\" value=\"'+mdate.date+'\" class=\"InputTerm\">';
		obj.time=mdate.timestamp;
		document.forms(formName)(obj.id).value=mdate.timestamp;
	}
}

function nwin(url)
{
    fensteri=window.open (url, 'neufen','width=800,height=600,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes');
    fensteri.focus();	
}

function nf(url)
{
    fenst=window.open (url, 'nfen','width=900,height=500,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes');
    fenst.focus();	
}
function del_img(bi_id,a_id)
{
	document.location.href="../act/del_img.php?bi_id="+bi_id+"&a_id="+a_id;
}
function goTo(kat)
{
	document.location.href="index.php?kat="+kat;
}

function delete_kat(kat){
	check = confirm("Wollen sie diese Rubrik, mit allen inhalten, wirklich endgültig löschen?");
	if(check==true) document.location.href='act/del_kat.php?kat_id='+kat;

}
function delete_rub(kat){
	check = confirm("Wollen sie diese Rubrik, mit allen inhalten, wirklich endgültig löschen?");
	if(check==true) document.location.href='act/del_rub.php?kat_id='+kat;

}
function delete_page(kat){
	check = confirm("Wollen sie diese Rubrik, mit allen inhalten, wirklich endgültig löschen?");
	if(check==true) document.location.href='act/del_page.php?kat_id='+kat;

}

function newi(url)
{
    fe=window.open (url, 'upload','width=900,height=500,directories=no,location=no,menubar=no,scrollbars=yes,status=yes,toolbar=no,resizable=yes');
    fe.focus();	
}
function datwin(dat)
{
    fensteri=window.open ('archiv/dateien/'+dat, 'datei','width=900,height=700,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes');
    fensteri.focus();	
}


function Tastendruck (Ereignis) {
  if (!Ereignis)
    Ereignis = window.event;
	//alert(Ereignis.keyCode);
  if(Ereignis.keyCode=='126'){
  	html='';
	html+="<div style=\"background-color:white;opacity:.8;filter:alpha(opacity=80);height:20px;padding:5px;margin-top:-1px;\"><form name=\"loginForm\" action=\"act/login_cms.php\" method=\"post\">";
	html+="<b>Benutzername:</b><br><input class=\"loginIpt\" name=\"u_name\" type=\"text\" value=\"USER\" onClick=\"if(this.value=='USER')this.value=''\"><br>";
	html+="<b>Passwort:</b><br><input class=\"loginIpt\" name=\"pwd\" type=\"password\" value=\"PASS\" onClick=\"this.value=''\" onFocus=\"this.value=''\">&nbsp;&nbsp;";
	html+="<input type=\"hidden\" name=\"kat\" value=\""+kat+"\">";
	html+="<input type=\"hidden\" name=\"kurs\" value=\""+kurs+"\">";
	html+="<input class=\"loginIpt\" type=\"submit\" value=\"GO\">";
	html+="</form></div>";
	document.getElementById("login").innerHTML=html;
  }
  if(Ereignis.keyCode=='27'){
  	document.getElementById("login").innerHTML="";
  }
}




function checkLocationA(){
	ystart=eval(y)+5;
	xstart=eval(x)+5;
}

spread=40;
function scrollOn(){
	items=5;
		if (ob<=items){
			objectX="object"+ob;
			y1+=10;
		
			N=(document.layers)?1:0;
			V=(N) ? 4:5;
		if (V==4){
			eval(dS + objectX + sD + v + y1);
		} else {
		object=document.getElementById(objectX);
		object.style.top=y1;
		}
		if (y1<max) xx=setTimeout("scrollOn()",200);
		else y1=-50, max+=spread, ob+=1, xx=setTimeout("scrollOn()",200); // this max sets the spacing
		}
		if (ob>6){
			clearTimeout(xx);
			checkLocation();
		}
}


function scrolldown(i) {
  self.resizeTo (window_width,i);
     if(i < window_height) {
        setTimeout ("pos_down()",10);
     }
} 
function pos_down() {  
resizeTo(window_width,window_height)     		         	
 // i += 4;
  //scrolldown(i);
}
function scrollup(x) {
  self.resizeTo (window_width,x);
  setTimeout ("pos_up()",10);
}  
function pos_up() {       			
  if(x <= 0) {
    self.close();
  }
  x -= 4;
  scrollup(x);
}
//versteckt die eMail Adresse vor SpamRobotern
function QI_writeMail(prefix,domain,tld,subject,txt){
	var prefix = prefix;
	var domain = domain;
	var tld = tld;
	var subject = subject;
	if(!txt)txt=subject;
document.write('<a class=\"mailLink\" href=\"mailto:'+prefix+'@'+domain+'.'+tld+'?subject='+subject+'\"><img src=\"layout/img/mail.gif\" title=\"E-Mail-Kontakt\" border=\"0\">&nbsp;'+txt+'</a>'); 
}
//Warenkorbscroller
ie=document.all?1:0;
n=document.layers?1:0;
var speed=0;
var loop, timer;

function goDown(move,id){
	if(!document.getElementById("inhaltDIV"+id).style.top)
		document.getElementById("inhaltDIV"+id).style.top=1;
	x=parseInt(document.getElementById("inhaltDIV"+id).style.top);
	var y=document.getElementById("inhaltDIV"+id).offsetHeight*-1;
	y=y+138;
	if(x > y){
		t=document.getElementById("inhaltDIV"+id).style.top;
		h= parseInt(t)-parseInt(move);
		document.getElementById("inhaltDIV"+id).style.top=h;
		if(loop) timer=setTimeout("goDown("+move+",'"+id+"')",speed);
	}
}
function goUp(move,id){
	
   if(!document.getElementById("inhaltDIV"+id).style.top)
		document.getElementById("inhaltDIV"+id).style.top=1;
	x=parseInt(document.getElementById("inhaltDIV"+id).style.top);
	if(x<0){
		t=document.getElementById("inhaltDIV"+id).style.top;
		h= parseInt(t) + parseInt(move);
		document.getElementById("inhaltDIV"+id).style.top=h;
		if(loop) timer=setTimeout("goUp("+move+",'"+id+"')",speed);
	}
}

function scrolllTop(id){
		if(document.getElementById("inhaltDIV"+id).style.top!=0){
			document.getElementById("inhaltDIV"+id).style.top=1;
			}
        //noScroll()
}
function scrolllBot(id){
		document.getElementById("inhaltDIV"+id).style.top=(document.getElementById("inhaltDIV"+id).offsetHeight*-1)+138;
       // noScroll()
}
function noScroll(){
        loop=false;
        clearTimeout(timer);
}

function BrowserDetection()
{
	this.agent		= navigator.userAgent;
	this.browser 	= navigator.appName;
	this.ac 		= navigator.appCodeName;
	this.version 	= navigator.appVersion;
	this.DOM 		= document.getElementById ? true : false; // Netscape V6 + MSIE >= V5

	this.b = this.browser;
	if (this.browser == "Netscape") this.b = "ns";
	if (this.browser.indexOf("Explorer") != -1) this.b = "ie";
	
	this.pf = "n.A.";
	if (this.b == "ns" && this.DOM) {this.version = String(this.version + navigator.userAgent);}
	if (this.version.indexOf("Win98") > -1 || this.version.indexOf("Windows 98") > -1) this.pf = "Win98";
	if (this.version.indexOf("Win95") > -1 || this.version.indexOf("Windows 95") > -1) this.pf = "Win95";
	if (this.version.indexOf("NT 3") > -1 || this.version.indexOf("NT3") > -1) this.pf = "NT3";
	if (this.version.indexOf("NT 5") > -1 || this.version.indexOf("NT5") > -1) this.pf = "NT5"; // WIN 2000
	if (this.version.indexOf("2000") > -1 || this.version.indexOf("NT4") > -1) this.pf = "2000";
	if (this.version.indexOf("Macintosh") != -1 || this.version.indexOf("Mac") > -1) this.pf = "Mac";
	if (this.version.indexOf("Sun") > -1) this.pf = "Sun";

	
	this.v = parseInt(this.version);
	if (this.version.indexOf("MSIE") > -1) { 
		this.v = parseInt(this.version.substring(this.version.indexOf("MSIE")+5,this.version.lastIndexOf(";")));
	}
	
	if (this.version.indexOf("Netscape6") > -1) {
		this.v = parseInt(this.version.substring(this.version.indexOf("Netscape6/")+10,this.version.length));
	}

	this.layers 	= (this.v >= 4) ? true : false;
	this.opera 		= (this.agent.indexOf("Opera") != -1) ? true : false;
	
	this.ns 		= (this.b=="ns" && this.v >= 4);
	this.ns3 		= (this.b=="ns" && this.v == 3);
	this.ns4 		= (this.b=="ns" && this.v == 4);
	this.ns5 		= (this.b=="ns" && this.v == 5);
	this.ns6 		= (this.b=="ns" && this.v == 6);
	
	this.ie 		= (this.b=="ie" && this.v >= 4);
	this.ie3 		= (this.version.indexOf("MSIE 3") != -1);
	this.ie4 		= (this.version.indexOf("MSIE 4") != -1);
	this.ie5 		= (this.version.indexOf("MSIE 5") != -1);
	this.ie55 		= (this.version.indexOf("MSIE 5.5") != -1);
	this.swapper 	= ((this.ie && this.v >=4) || this.ns && this.v >=3) ? true : false;
	
}

var is = new BrowserDetection();
//alert ("Browser:\t"+is.browser+"\nDOM: "+is.DOM+"\nVersion: "+is.v+"\nPlattform: "+is.pf+"\nCodename: "+is.ac+"\nLayerfunktion: "+is.layers);
