
// JavaScript Document
window.addEvent('load', function() {overlay();});	
window.addEvent('resize', function() {overlay();});

function overlay() {
	var size = window.getScrollSize();
	if($('overlay')) {
		$('overlay').setStyles({
			height: size.y+'px',
			width: size.x+'px'
		});
	}
}


function statusbar(num,speed,timeleft,lokal_kb,on_kb) {
	x = 400 - ( num * 4);
	document.getElementById('statusbar').style.width = x + "px";;
	text = '<div align="right" style="float:right;"><strong>' + num + ' % </strong></div>';
	if(num < 100) {
		 text += lokal_kb + " von " + on_kb + " bei " + speed + " KB/sek; <strong>" + timeleft + " sek verbleibend</strong>";
	}else {
		text += "<strong><span class='grey'>Status: </span>fertig</strong>";
	}
	
	document.getElementById("text").innerHTML = text;
}
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_showHideLayers() { //v6.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	var d = "block";
	for (i=0; i<(args.length-2); i+=3) {
		if ((obj=MM_findObj(args[i]))!=null) {
			v=args[i+2];
			var t = true;
		}else if((obj = parent.window.document.getElementById(args[i])) != null) {
			v=args[i+2];
			var t = true;
		}else { var t = false;}
		if(t == true) {
			if (obj.style) { 
				obj=obj.style; 
				if(obj.id!="Infoshadow") {d=(v=='show')?'block':(v=='hide')?'none':d; }
				v=(v=='show')?'visible':(v=='hide')?'hidden':v;
				
			}
			obj.visibility=v; 
			obj.display=d;
		}
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/* Layer f�r den Hover effect */
var globalReload = false;
var InfoActive = "";
var pos = Array();
var docEl = (
             typeof document.compatMode != "undefined" && 
             document.compatMode        != "BackCompat"
            )? "documentElement" : "body";


function HideInfo_sec() {
    var dd = MM_findObj("Infoshadow");
    if(dd == null) {
		dd = parent.window.document.getElementById("Infoshadow");
	}
	
	if(typeof globalReload == 'string')
		window.location.href = globalReload;
	else if(globalReload == true) 
	   	window.location.reload();
	
    
    var ob = $('my_chart');
	if(ob) {
		ob.setStyle('visibility', 'visible');
	}
	
	if(dd.style.visibility == "visible" && active != 1) {
        MM_showHideLayers("Infoshadow","","hide");
		if(MM_findObj("InfoText") != null) {
			document.getElementById("InfoText").src="/img/spacer.gif";
		}else {
			parent.window.document.getElementById("InfoText").src="/img/spacer.gif";
		}
		if($('overlay')) {
			$('overlay').setStyle('display', 'none');
		}
        return;
    }
    
}

function HideInfo() {
    //window.setTimeout("HideInfo_sec()",5000);
	 active="";
	 HideInfo_sec();
   
}

function ShowInfo(ue,file,width,height, reload) {
   if(typeof reload == 'string') {
    	globalReload = reload;
   }else if(reload == true)  {
    	globalReload = true;
   }
    	
	var ob = $('my_chart');
	if(ob) {
		ob.setStyle('visibility', 'hidden');
	}
    hide_all();
    if($('overlay')) {
   	 	$('overlay').setStyle('display', 'block');
	}
	// schreiben des Textes
	if(!width) { width = 350;}
	if(!height) { height = 250;}
	lwidth = width - 15;
	lheight = height - 45;
	iwidth = Number(width) - 6;
	iheight = Number(height) - 6;
	
    if(document.layers) {
		document.layers["InfoText"].src=file;
		document.layers["InfoText"].width = lwidth;
		document.layers["InfoText"].height = lheight;
		document.layers["Infoshadow"].style.width = width+"px";
		document.layers["Infoshadow"].style.height = height+"px";
		document.layers["Info"].style.width = iwidth+"px";
		document.layers["Info"].style.height = iheight+"px";
		//document.layers["schatten"].style.width = (isIe() == true) ? "100%" : "100%";
		//document.layers["schatten"].style.height = (isIe() == true) ? "95%" : "100%";
		with(document.layers["InfoUe"].document)
			{open();write(ue);close();}
		
		
	}else if(document.getElementById) {
		document.getElementById("InfoText").src = file;
		document.getElementById("InfoText").width = lwidth;
		document.getElementById("InfoText").height = lheight;
		document.getElementById("Infoshadow").style.width = width+"px";
		document.getElementById("Infoshadow").style.height = height+"px";
		document.getElementById("Info").style.width = iwidth+"px";
		document.getElementById("Info").style.height = iheight+"px";
		//document.getElementById("schatten").style.width = (isIe() == true) ? "1%" : "1%";
		//document.getElementById("schatten").style.height = (isIe() == true) ? "1%" : "1%";
		document.getElementById("InfoUe").innerHTML=ue;
	}
	else if (document.all) {
		document.all["InfoText"].src=file;
		document.all["InfoText"].width = lwidth;
		document.all["InfoText"].height = lheight;
		document.all["Infoshadow"].style.width = width+"px";
		document.all["Infoshadow"].style.height = height+"px";
		document.all["Info"].style.width = iwidth+"px";
		document.all["Info"].style.height = iheight+"px";
		//document.all["schatten"].style.width = (isIe() == true) ? "100%" : "100%";
		//document.all["schatten"].style.height = (isIe() == true) ? "95%" : "100%";
		document.all["InfoUe"].innerHTML=ue;
	}
	
    var dd = MM_findObj("Infoshadow");
    //P7_Snap("UInfo_img["+id+"]","UserInfo",-3,20);
	var xx = document.getElementById("Infoshadow").style;
	//xx.left = pos["x"]+"px";
	//xx.top = pos["y"]+"px";
	xx.left = "30%";
	xx.top = "23%";
	
    if(dd.style.visibility == "visible") {
        return;
    }else {
        MM_showHideLayers("Infoshadow","","show");
    }
    return;
}
function hide_all() {
	MM_showHideLayers("Infoshadow","","hide");
	
}
function init_mousemove() {
    if(document.layers) document.captureEvents(Event.MOUSEMOVE);
    
	document.onmousemove = dpl_mouse_pos;
}

function dpl_mouse_pos(e) {

    // position where mousemove fired
    //
    var xPos    =  e? e.pageX : window.event.x;
	var yPos    =  e? e.pageY : window.event.y;

	
	// for ie add scroll position
	//
	if (document.all && !document.captureEvents) {
	   // xPos    += document[docEl].scrollTop;
	    yPos    += document[docEl].scrollTop;
    }
    
    // display position
    //
   // document.feld.ausg.value    =  "Left = " + xPos + " : Top = " + yPos;
    
    // for the dino pass event
    //

    if (document.layers) routeEvent(e);
	pos = Array;
	pos["x"] = xPos;
	pos["y"] = yPos;
	

}
init_mousemove();

function del() {
	return confirm("Wollen Sie den Eintrag wirklich löschen?");
}

function isIe() {
	var identstring = navigator.userAgent;
	
	if (identstring.indexOf("Opera",0) != -1) { return false; }
	else if (identstring.indexOf("MSIE 5.",0) != -1) { return true; }
	else if (identstring.indexOf("MSIE 6.",0) != -1) {return true;}
	else if (identstring.indexOf("MSIE 5.",0) == -1 && identstring.indexOf("Mozilla/4.",0) != -1) { return false; }
	else if (identstring.indexOf("Gecko/",0) != -1) { return false; }
	else if (identstring.indexOf("Konqueror/",0) != -1) { return false; }
	else {return false;}
}

function drucksubmit(form,kid) {
	//var d = document.forms[form];
	//var druckart = d.druckart.value;
	var druckart = "web";
	var li = "http://www.guv-web.de/img/druck.php?kid="+kid+"&druckart="+druckart;
	//alert(li);
	window.open(li,"Druckausgabe","scrollbars=yes,resizable=yes,width=800,height=600");
	return false;
}
	
