//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;		       
	} 
}
//versteckt die eMail Adresse vor SpamRobotern
function QI_writeMail(prefix,domain,tld,subject){
	var prefix = prefix;
	var domain = domain;
	var tld = tld;
	var subject = subject;
document.write('<a href=\"mailto:'+prefix+'@'+domain+'.'+tld+'?subject='+subject+'\">'+prefix+'@'+domain+'.'+tld+'</a>');
}

function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
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 galerieWin(url,fen)
{
    fensteri=window.open(url, fen,'width=750,height=600,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=no');	
	  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(obj,formName){
	var mdate = showModalDialog("../datepicker/datepicker.php", "", "dialogWidth:20em; dialogHeight:19em");
	if(mdate){
		obj.innerHTML='<input type=\"text\" value=\"'+mdate.date+'\" class=\"INPUT\">';
		
		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 checkKey(evt){
	if (!evt)
    	evt = window.event;
  	if(evt.keyCode == 180 ){
  		document.getElementById("login").style.visibility='visible';
  		if(document.loginForm){
  			document.loginForm.u_name.focus();
  			document.loginForm.u_name.value="";
  		}
  		return false;
	}
}
document.onkeypress=checkKey;


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 test="";
		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";
		//alert(document.getElementById(id).style.top);
	}
	if(oldid && (oldid != id))document.getElementById(oldid).style.visibility='hidden';
	oldid=id;
}

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);
}

function Tastendruck (Ereignis) {
	if (!Ereignis){
		Ereignis = window.event;
		Tastencode=Ereignis;
	}
	if (Ereignis.which) {
		Tastencode = Ereignis.which;
	} else if (Ereignis.keyCode) {
		Tastencode = Ereignis.keyCode;
	}
	//alert(Tastencode); 
	if(Tastencode=='187'||Tastencode=='61' || Tastencode=='107'){
		html='';
		html+="<table height='100%' align='center'><tr><td>";
		html+="<form name=\"loginForm\" action=\"act/login_cms.php\" method=\"post\" style=\"background-color:#ccc; padding:5px;border:1px solid black\">";
		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>";
		html+="</td></tr></table>";
		document.getElementById("login").style.display="block";
		document.getElementById("body").style.overflow="hidden";
		document.getElementById("login").innerHTML=html;
		resize();
	}
	if(Tastencode=='27'){
		document.getElementById("login").innerHTML="";
		document.getElementById("body").style.overflow="auto";
		document.getElementById("login").style.display="none";
	}
} 
window.onresize = resize;

function resize(){
	if(document.getElementById("login"))document.getElementById("login").style.height=document.body.clientHeight+100+"px";
}
//window.onresize = document.getElementById("login").style.height=document.body.clientHeight+100+"px";
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); 
