//Aufruf eines Modalen Fenster --STYLES--

function modWin(url) {
 // var mdat = showModalDialog(url, "", "font-family:Verdana; font-size:12; dialogWidth:700px; dialogHeight:500px");
 // return mdat;
  
     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();
}

//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 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 QI_divText(){
	document.getElementById("text").style.visibility="hidden";
	document.getElementById("text").style.overflow="hidden"; 
}
function nixFrame() { 
	if (self.parent.frames.length == 0){
		self.parent.location = "index.html?kat=<?=$kat ?>";
	}
}
// function to set a pic in a box
function setPic(id,pic){
	window.onerror = handleError;
	document.getElementById("reBox"+id).style.backgroundImage="url(img/editor/"+pic+")";
	document.getElementById("reBox"+id).style.backgroundRepeat="no-repeat";
	//alert(document.getElementByName.Name);


}
function handleError() {
	return false;
}
