/*************************************************************************************************
function:       fncPrintIt
description:    Crossbrowser drucken (IE4,NS4,IE5,IE5.5)
require:        
date:           2001-05-28 (TH)
***************************************************************************************************/
function fncPrintIt()
{	if(window.print) 
	{	window.print();
	}  
	else if(document.all)
	{	window.onerror=function(){return true};
		if(!document.WebBrowser1)
		{ var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
	 		document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
		}
	  WebBrowser1.ExecWB(6, 1);// 1=dialogbox 2 keine dialogbox  
		window.onerror=null;
	}
	else
	{ alert("Ihr Browser unterstützt diese Funktion nicht.");
	}
}

/*************************************************************************************************
function:       fncOpenDlgWnd
description:    öffnet ein Dialogfenster
								fncOpenDlgWnd(event,string url,string name,string height,string width,
								int top,int left,[string position])
								event->Systemvariable (nicht aendern!)
								Position->'relative' für relative (x,y)-Koordinaten abhängig vom eventObjekt
date:           2001-05-11 (c) webconsulting-hoppe
Browser:				IE4,IE5,IE5.5,NS4
***************************************************************************************************/
function fncOpenDlgWnd(event,url,name,height,width,y,x,pos,scrollbars)
{	if(pos=="relative")
	{	x=(event.screenX)+x;
		y=(event.screenY)+y;
	}
	return window.open(url,name,
	"top="+y+
	",screenY="+y+
	",left="+x+
	",screenX="+x+
	",width="+width+
	",height="+height+
	",toolbar=0,location=0,directories=0,status=0,menuBar=0"+
	",scrollBars="+scrollbars+
	",resizable=0");
}

/*************************************************************************************************
function:       fncWndClose
description:    schliesst ein Fenster
								fncWndClose(string Objektname des Fensters)
date:           2001-05-11 (TH)
Browser:				IE4,IE5,IE5.5,NS4
***************************************************************************************************/
var wnd;
function fncWndClose(wndobj_name)
{	window.onerror=function(){return true};
	w=eval(wndobj_name);
	w.close();
	window.onerror=null;
}

/************************************************************************************************
function:       fncCmbSelItem
description:    gibt alle Angaben eines ausgewählten Eintrags aus einer Combobox als Array zurück
								Array fncCmbSelItem(form as STRING,feld as STRING)
								form->Formularname
								feld->Feldname
								Array["text"]=Text des selektierten Eintrags in der Combobox
								Array["value"]= Wert des selektierten Eintrags in der Combobox
								Array["index"]= Index des selektierten Eintrags in der Combobox
require:        none
date:           2000-08-27 (TH)
*************************************************************************************************/ 
function fncCmbSelItem(form,feld)
{ wert=new Array();
  for(i=0;i<document[form][feld].length;++i)
  { if(document[form][feld].options[i].selected == true)
	  { wert["text"]=document[form][feld].options[i].text;
 	    wert["value"]=document[form][feld].options[i].value;
      wert["index"]=i;
    }
	}
  return wert;		
}


/************************************************************************************************
function:       
description:    
require:        
date:           
*************************************************************************************************/ 

var fadebgcolor="" // z.b.white
var fadearray=new Array() //array to cache fncSlideShow instances
var fadeclear=new Array() //array to cache corresponding clearinterval pointers
var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all
 
function fncSlideShow(theimages, fadewidth, fadeheight, borderwidth, delay)	
{	this.delay=delay
	this.degree=10 // deckkraft
	this.curimageindex=0
	this.nextimageindex=1
	fadearray[fadearray.length]=this
	this.slideshowid=fadearray.length-1
	this.canvasbase="canvas"+this.slideshowid
	this.curcanvas=this.canvasbase+"_0"
	theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
	this.theimages=theimages
	this.imageborder=parseInt(borderwidth)
	this.postimages=new Array() //preload images
	for (p=0;p<theimages.length;p++)
	{	this.postimages[p]=new Image()
		this.postimages[p].src=theimages[p][0]
	}
 
	var fadewidth=fadewidth+this.imageborder*2
	var fadeheight=fadeheight+this.imageborder*2
	 
	if (iebrowser&&dom||dom)
		document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>')
	else
		document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')
	 
	if (iebrowser&&dom||dom)
		this.startit()
	else
	{	this.curimageindex++
		setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
	}
}

function fadepic(obj)
{	if (obj.degree<100)
	{	obj.degree+=5 // geschwindigkeit blendeffekt
		if (obj.tempobj.filters&&obj.tempobj.filters[0])
		{	if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
			obj.tempobj.filters[0].opacity=obj.degree
			else //else if IE5.5-
			obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
		}
		else if (obj.tempobj.style.MozOpacity)
			obj.tempobj.style.MozOpacity=obj.degree/101
		else if (obj.tempobj.style.KhtmlOpacity)
			obj.tempobj.style.KhtmlOpacity=obj.degree/100
		else if (obj.tempobj.style.opacity&&!obj.tempobj.filters)
			obj.tempobj.style.opacity=obj.degree/101
	}
	else
	{	clearInterval(fadeclear[obj.slideshowid])
		obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
		obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
		obj.populateslide(obj.tempobj, obj.nextimageindex)
		obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
		setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
	}
}
 
fncSlideShow.prototype.populateslide=function(picobj, picindex)
{	var slideHTML=""
	slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
	picobj.innerHTML=slideHTML
}
 
 
fncSlideShow.prototype.rotateimage=function()
{	if (iebrowser&&dom||dom)
	{	this.resetit()
		var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
		crossobj.style.zIndex++
		fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
		this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
	}
	else
	{	var ns4imgobj=document.images['defaultslide'+this.slideshowid]
		ns4imgobj.src=this.postimages[this.curimageindex].src
	}
	this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}
 
fncSlideShow.prototype.resetit=function()
{	this.degree=10
	var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
	if (crossobj.filters&&crossobj.filters[0])
	{	if (typeof crossobj.filters[0].opacity=="number") //if IE6+
		crossobj.filters(0).opacity=this.degree
		else //else if IE5.5-
		crossobj.style.filter="alpha(opacity="+this.degree+")"
	}
	else if (crossobj.style.MozOpacity)
		crossobj.style.MozOpacity=this.degree/101
	else if (crossobj.style.KhtmlOpacity)
		crossobj.style.KhtmlOpacity=this.degree/100
	else if (crossobj.style.opacity&&!crossobj.filters)
		crossobj.style.opacity=this.degree/101
}
 
 
fncSlideShow.prototype.startit=function()
{	var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
	this.populateslide(crossobj, this.curimageindex)
	this.rotateimage()
}
