/**
 * Vers. 3.3 (22-09-2011)(c) by Bernd Kiessling 
 * All Rights Reserved.
 * Es ist nicht erlaubt, diese Scripts ohne schriftliche Zustimmung des Autor´s zu verwenden, zu kopieren oder weiterzugeben !!
 * Aufruf:
 	new PCDI("ifr1",90,"dlgbk",null);
	botnote bottom element
	bckgrd_[name]_[top-distance]_[right-distance]_[bottom-distance]_[left-distance]
	forgrd_[name]_[top-distance]_[right-distance]_[bottom-distance]_[left-distance]
	bigover_[parameter]     parameter: 1 = proportional , 2 = maximale Größe
 *
**/
var pcdi_docwidth=0;
var pcdi_docheight=0;
function PCDI(p_mwidth,p_mheight,p_ifcl,p_alpha,p_dlgcl,p_caller){
	var thisobj=this;
	thisobj.cbt;
	thisobj.clkbt;
	thisobj.lastbt;
	thisobj.tout;
	pcdi_isbig=false;
	thisobj.isstop=false;
	thisobj.links=new Array();
	thisobj.big=new Array();
	thisobj.getAll=function(p_parent){
		for(var i=0;i<p_parent.childNodes.length;i++){
			if(p_parent.childNodes[i].nodeType==1){
				var tmpobj=p_parent.childNodes[i];			
				if(tmpobj.childNodes){
					thisobj.getAll(tmpobj);
				}
				if(tmpobj.className.toLowerCase().indexOf("bckgrd_")>-1){	
					var tmpsrc=tmpobj.className.substring(tmpobj.className.toLowerCase().indexOf("bckgrd_")+7);
					if(tmpsrc.indexOf(" ")>7){
						tmpsrc=tmpsrc.substring(0,tmpsrc.indexOf(" "));
					}
					var tmpleft=tmpsrc.substring(tmpsrc.lastIndexOf("_")+1);
					tmpsrc=tmpsrc.substring(0,tmpsrc.lastIndexOf("_"));
					var tmpbottom=tmpsrc.substring(tmpsrc.lastIndexOf("_")+1);
					tmpsrc=tmpsrc.substring(0,tmpsrc.lastIndexOf("_"));
					var tmpright=tmpsrc.substring(tmpsrc.lastIndexOf("_")+1);
					tmpsrc=tmpsrc.substring(0,tmpsrc.lastIndexOf("_"));
					var tmptop=tmpsrc.substring(tmpsrc.lastIndexOf("_")+1);
					if((isNaN(tmptop)==false)&&(isNaN(tmpright)==false)&&(isNaN(tmpbottom)==false)&&(isNaN(tmpleft)==false)){
						var tmpcont=document.createElement("div");			
						var tmpimg=new Image();
						tmpsrc=rtPh()+"local/bg/"+tmpsrc.substring(0,tmpsrc.lastIndexOf("_"))+".png";
						if((isIE())&&(!isIEM())){
							tmpimg.src=rtPh()+"scripts/ie/tmp.png";
							tmpimg.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+tmpsrc+"',sizingMethod='scale')";
						}else{			
							tmpimg.src=tmpsrc;
						}			
						var tmpvl;
						if(enPos()){
							if(tmpobj.style.position!="absolute"){
								tmpobj.style.position="absolute";
							}
							tmpimg.style.position="absolute";
							if((bc_getSzStyle(tmpobj,"left")!=null)&&(isNaN(bc_getSzStyle(tmpobj,"left")[1])==false)){
								tmpvl=bc_getSzStyle(tmpobj,"left")[1]+bc_getSzStyle(tmpobj,"left")[2];
								tmpimg.style.left=tmpvl;
								tmpobj.style.left=String(Number(tmpleft)+Number(bc_spltStyle(tmpvl)[0]))+String(bc_spltStyle(tmpvl)[1]);
							}else{
								tmpimg.style.left="0px";
								tmpobj.style.left=tmpleft+"px";
							}							
							if((bc_getSzStyle(tmpobj,"top")!=null)&&(isNaN(bc_getSzStyle(tmpobj,"top")[1])==false)){
								tmpvl=bc_getSzStyle(tmpobj,"top")[1]+bc_getSzStyle(tmpobj,"top")[2];
								tmpimg.style.top=tmpvl;
								tmpobj.style.top=String(Number(tmptop)+Number(bc_spltStyle(tmpvl)[0]))+String(bc_spltStyle(tmpvl)[1]);
							}else{
								tmpimg.style.top="0px";
								tmpobj.style.top=tmptop+"px";
							}
						}
						if((bc_getSzStyle(tmpobj,"width")!=null)&&(isNaN(bc_getSzStyle(tmpobj,"width")[1])==false)&&(bc_getSzStyle(tmpobj,"height")!=null)&&(isNaN(bc_getSzStyle(tmpobj,"height")[1])==false)){
							tmpvl=bc_getSzStyle(tmpobj,"width")[1]+bc_getSzStyle(tmpobj,"width")[2];
							tmpimg.style.width=tmpvl;
							tmpobj.style.width=String(Number(bc_spltStyle(tmpvl)[0])-Number(tmpleft)-Number(tmpright))+String(bc_spltStyle(tmpvl)[1]);
							tmpvl=bc_getSzStyle(tmpobj,"height")[1]+bc_getSzStyle(tmpobj,"height")[2];
							tmpimg.style.height=tmpvl;
							tmpobj.style.height=String(Number(bc_spltStyle(tmpvl)[0])-Number(tmptop)-Number(tmpbottom))+String(bc_spltStyle(tmpvl)[1]);
							try{
								tmpimg.border=tmpobj.border;
							}catch(e){
								tmpimg.border="0";
							}
							p_parent.insertBefore(tmpimg,tmpobj);
							tmpobj.style.backgroundColor="transparent";
							bc_addThisObj(tmpimg);
							i++;
						}
					}
				}
				if(tmpobj.className.toLowerCase().indexOf("forgrd_")>-1){	
					var tmpsrc=tmpobj.className.substring(tmpobj.className.toLowerCase().indexOf("forgrd_")+7);
					if(tmpsrc.indexOf(" ")>7){
						tmpsrc=tmpsrc.substring(0,tmpsrc.indexOf(" "));
					}
					var tmpleft=tmpsrc.substring(tmpsrc.lastIndexOf("_")+1);
					tmpsrc=tmpsrc.substring(0,tmpsrc.lastIndexOf("_"));
					var tmpbottom=tmpsrc.substring(tmpsrc.lastIndexOf("_")+1);
					tmpsrc=tmpsrc.substring(0,tmpsrc.lastIndexOf("_"));
					var tmpright=tmpsrc.substring(tmpsrc.lastIndexOf("_")+1);
					tmpsrc=tmpsrc.substring(0,tmpsrc.lastIndexOf("_"));
					var tmptop=tmpsrc.substring(tmpsrc.lastIndexOf("_")+1);
					if((isNaN(tmptop)==false)&&(isNaN(tmpright)==false)&&(isNaN(tmpbottom)==false)&&(isNaN(tmpleft)==false)){
						var tmpcont=document.createElement("div");			
						var tmpimg=new Image();
						tmpsrc=rtPh()+"local/bg/"+tmpsrc.substring(0,tmpsrc.lastIndexOf("_"))+".png";
						if((isIE())&&(!isIEM())){
							tmpimg.src=rtPh()+"scripts/ie/tmp.png";
							tmpimg.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+tmpsrc+"',sizingMethod='scale')";
						}else{			
							tmpimg.src=tmpsrc;
						}			
						var tmpvl;
						if(enPos()){
							if(tmpobj.style.position!="absolute"){
								tmpobj.style.position="absolute";
							}
							tmpimg.style.position="absolute";
							if(isNaN(bc_getSzStyle(tmpobj,"left")[1])==false){
								tmpvl=bc_getSzStyle(tmpobj,"left")[1]+bc_getSzStyle(tmpobj,"left")[2];
								tmpimg.style.left=tmpvl;
								tmpobj.style.left=String(Number(tmpleft)+Number(bc_spltStyle(tmpvl)[0]))+String(bc_spltStyle(tmpvl)[1]);
							}else{
								tmpimg.style.left="0px";
								tmpobj.style.left=tmpleft+"px";
							}							
							if(isNaN(bc_getSzStyle(tmpobj,"top")[1])==false){
								tmpvl=bc_getSzStyle(tmpobj,"top")[1]+bc_getSzStyle(tmpobj,"top")[2];
								tmpimg.style.top=tmpvl;
								tmpobj.style.top=String(Number(tmptop)+Number(bc_spltStyle(tmpvl)[0]))+String(bc_spltStyle(tmpvl)[1]);
							}else{
								tmpimg.style.top="0px";
								tmpobj.style.top=tmptop+"px";
							}
						}
						if((isNaN(bc_getSzStyle(tmpobj,"width")[1])==false)&&(isNaN(bc_getSzStyle(tmpobj,"height")[1])==false)){
							tmpvl=bc_getSzStyle(tmpobj,"width")[1]+bc_getSzStyle(tmpobj,"width")[2];
							tmpimg.style.width=tmpvl;
							tmpobj.style.width=String(Number(bc_spltStyle(tmpvl)[0])-Number(tmpleft)-Number(tmpright))+String(bc_spltStyle(tmpvl)[1]);
							tmpvl=bc_getSzStyle(tmpobj,"height")[1]+bc_getSzStyle(tmpobj,"height")[2];
							tmpimg.style.height=tmpvl;
							tmpobj.style.height=String(Number(bc_spltStyle(tmpvl)[0])-Number(tmptop)-Number(tmpbottom))+String(bc_spltStyle(tmpvl)[1]);
							tmpimg.border=tmpobj.border;
							p_parent.insertBefore(tmpimg,tmpobj);
							p_parent.removeChild(tmpobj);
							p_parent.insertBefore(tmpobj,tmpimg);
							tmpimg.style.backgroundColor="transparent";
							bc_addThisObj(tmpimg);
							i++;
						}
					}
				}				
				if(tmpobj.tagName.toLowerCase()=="a"){
					if(tmpobj.target=="_blank"){
					   tmpobj.href="javascript:nIF('"+tmpobj.href+"','"+p_ifcl+"','"+String(p_alpha)+"','"+p_dlgcl+"');";
					   tmpobj.removeAttribute("target");
					}
					if(tmpobj.id!=""){
						thisobj.links.push(tmpobj);
					}else{
						tmpobj.id="txt_0_0";
						new Bt(tmpobj,null);
					}
				}
				if(tmpobj.className.toLowerCase().indexOf("bigover_")>-1){
					thisobj.big.push(tmpobj);
					if(tmpobj.className.toLowerCase().indexOf("forgrd_")>-1){
						try{
							if((isIE())&&(!isIEM())){
								tmpobj.nextSibling.style.cursor="url("+rtPh()+btfolder+"zplus.cur),pointer";
							}else{
								tmpobj.nextSibling.style.cursor="url("+rtPh()+btfolder+"zplus.png),pointer";
							}
						}catch(e){
							//nothing
						}
						tmpobj.nextSibling.onmouseover=function(p_event){
							//nothing
						}						
						tmpobj.nextSibling.onmouseup=function(p_event){
							p_event = p_event || window.event;
							var target = p_event.target || p_event.srcElement;
							new dlg_mkBig(target.previousSibling,thisobj.big,p_ifcl,p_alpha,p_dlgcl,thisobj);
						}
					}else{
						try{
							if((isIE())&&(!isIEM())){
								tmpobj.style.cursor="url("+rtPh()+btfolder+"zplus.cur),pointer";
							}else{
								tmpobj.style.cursor="url("+rtPh()+btfolder+"zplus.png),pointer";
							}
						}catch(e){
							//nothing
						}						
						tmpobj.onmouseup=function(p_event){
							p_event = p_event || window.event;
							var target = p_event.target || p_event.srcElement;
							if(target.className.toLowerCase().indexOf("bigover_")>-1){
								new dlg_mkBig(target,thisobj.big,p_ifcl,p_alpha,p_dlgcl,thisobj);
							}else{
								new dlg_mkBig(target.parentNode,thisobj.big,p_ifcl,p_alpha,p_dlgcl,thisobj);
							}
						};
						tmpobj.onmouseover=function(p_event){
							//nothing
						};
					}
				}
				bc_addThisObj(tmpobj);
				var tmpparent=tmpobj.parentNode;
				var tmpw=0;
				var tmph=0;				
				if(bc_getCurrentSzStyle(tmpobj,"height")!=null){
					tmph=Number(bc_getCurrentSzStyle(tmpobj,"height")[1]);
					if(bc_getCurrentSzStyle(tmpobj,"top")!=null){
						tmph=tmph+Number(bc_getCurrentSzStyle(tmpobj,"top")[1]);
					}
				}
				if((tmpw>0)||(tmph>0)){		
					while(tmpparent!=document.getElementsByTagName("body")[0]){
						if(bc_getCurrentSzStyle(tmpparent,"left")!=null){
							tmpw=tmpw+Number(bc_getCurrentSzStyle(tmpparent,"left")[1]);
						}
						if(bc_getCurrentSzStyle(tmpparent,"top")!=null){
							tmph=tmph+Number(bc_getCurrentSzStyle(tmpparent,"top")[1]);
						}
						tmpparent=tmpparent.parentNode;
					}
				}
				if(tmpw>0){
					if(tmpw>pcdi_docwidth){
						pcdi_docwidth=tmpw;
					}
				}
				if(tmph>0){
					if(tmph>pcdi_docheight){
						pcdi_docheight=tmph;
					}
				}
			}
		}
	};
	thisobj.setActive=function(p_link){
		p_link.isactive=true;
		p_link.alink.className=p_link.clname+"active";
		if(p_link.img!=null){
			if((isIE())&&(!isIEM())){
				p_link.img.src=rtPh()+"scripts/ie/tmp.png";
				p_link.img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+p_link.asrc+"',sizingMethod='scale')";
			}else{			
				p_link.img.src=p_link.asrc;	
			}
		}
	};
	thisobj.btmover=function(p_bt){
		if(thisobj.isstop==true){
			if(thisobj.clkbt!=p_bt){
				if(p_bt.sident==0){
					thisobj.clkbt.outLayout();
					thisobj.clkbt=null;
					thisobj.isstop==false;
					thisobj.showHideSub(p_bt,true);
				}
			}
		}else{
		   thisobj.showHideSub(p_bt,true);
		}
	};
	thisobj.btmout=function(p_bt){
		if(thisobj.clkbt!=null){
			thisobj.clkbt.downLayout();
		}
		thisobj.lastbt=p_bt;
		thisobj.tout=window.setTimeout(thisobj.out,500);
	};
	thisobj.out=function(){
		for(var i=0;i<thisobj.links.length;i++){			
			if(thisobj.isstop==false){
				if(thisobj.lastbt==thisobj.cbt){
					if(thisobj.links[i].sident>0){
						thisobj.links[i].setVisible(false);
					}
				}
			}else{
				break;	
			}
		}
	};
	thisobj.btmdown=function(p_bt){
		
	};
	thisobj.btmup=function(p_bt){
		if(p_bt.alink.href.substring(p_bt.alink.href.length-1) =="#"){
			if(thisobj.isstop==false){
				thisobj.clkbt=p_bt;
				thisobj.isstop=true;
				thisobj.showHideSub(p_bt,true);
				p_bt.mdown();
			}else{
				thisobj.isstop=false;
				thisobj.showHideSub(p_bt,false);
			}
		}
		for(var i=0;i<thisobj.links.length;i++){
			if(thisobj.links[i]!=p_bt){
				 thisobj.links[i].isactive=false;
				  thisobj.links[i].alink.className=thisobj.links[i].clname
				  if(thisobj.links[i].img!=null){
					  if((isIE())&&(!isIEM())){
						  thisobj.links[i].img.src=rtPh()+"scripts/ie/tmp.png";
						  thisobj.links[i].img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+thisobj.links[i].nsrc+"',sizingMethod='scale')";
					  }else{			
						 thisobj.links[i].img.src=thisobj.links[i].nsrc;	
					  }
				  }
			}
			if(p_bt.alink.href.substring(p_bt.alink.href.length-1) !="#"){
				if(thisobj.links[i].sident>0){
						thisobj.links[i].setVisible(false);
					}
			}
		}
	};
	thisobj.btmclick=function(p_bt){
		
	};
	thisobj.closeSubbt=function(p_bt){
		
	};
	thisobj.showHideSub=function(p_bt,p_show){
		thisobj.cbt=p_bt;
		if(thisobj.lastbt!=null){
			thisobj.isstop=true;
			window.clearTimeout(thisobj.tout);
			for(var i=0;i<thisobj.links.length;i++){				
				if((thisobj.links[i].sident==thisobj.cbt.ident)||(thisobj.isParentoRoot(thisobj.links[i],thisobj.cbt))){
					if(p_show==true){
						thisobj.links[i].setVisible(true);
					}else{
						thisobj.links[i].setVisible(false);
					}
				}else{
					if((thisobj.links[i].sident>0)&&(thisobj.links[i].sident!=thisobj.cbt.sident)){
						thisobj.links[i].setVisible(false);		
					}
				}
			}
		}else{
			for(var i=0;i<thisobj.links.length;i++){
				if((thisobj.links[i].sident==thisobj.cbt.ident)||((thisobj.links[i].sident==thisobj.cbt.sident)&&(thisobj.cbt.sident>0))){
					thisobj.links[i].setVisible(true);	
				}
			}
		}
		if(thisobj.clkbt!=null){
			if(p_show==false){
				thisobj.isstop=false;
				thisobj.clkbt=null;
			}
		}else{
			thisobj.isstop=false;
		}
	};
	thisobj.isParentoRoot=function(p_bt,p_sub){		
		if(p_sub.sident==p_bt.ident){
			return true;	
		}
		var tmpident=p_sub.sident;
		while(tmpident>0){
			if((p_bt.ident==tmpident)||(p_bt.sident==tmpident)){
				return true;
			}
			for(i=0;i<thisobj.links.length;i++){
				if(thisobj.links[i].ident==tmpident){
					tmpident=thisobj.links[i].sident;
					break;
				}
			}
		}
		return false;
	};
	bc_addThisObj(document.getElementsByTagName("body")[0]);
	thisobj.getAll(document.getElementsByTagName("body")[0]);	
	for(var i=0;i<thisobj.links.length;i++){
		var tmptxt=thisobj.links[i].id.substring(0,thisobj.links[i].id.lastIndexOf("_"));
		if(isNaN(tmptxt.substring(tmptxt.lastIndexOf("_")+1))==true){
			thisobj.links[i].tabindex=tmptxt.substring(tmptxt.lastIndexOf("_")+1);
		}
		tmptxt=tmptxt.substring(0,tmptxt.lastIndexOf("_"));
		thisobj.links[i]=new Bt(thisobj.links[i],thisobj);		
		thisobj.links[i].moveToLast();				
		if(thisobj.links[i].alink.href==window.location){
			thisobj.setActive(thisobj.links[i]);
		}
	}
	if(p_mwidth>pcdi_docwidth){
		pcdi_docwidth=p_mwidth;
	}
	if(p_mheight>pcdi_docheight){
		pcdi_docheight=p_mheight;
	}	
	if(document.getElementById("botnote")!=null){
		bc_setObjSValue(document.getElementById("botnote"),"top",pcdi_docheight);
		pcdi_docheight=Number(pcdi_docheight)+Number(bc_getCurrentSzStyle(document.getElementById("botnote"),"height")[1]);
	}
	if(p_caller!=null){
		p_caller.intCompl(thisobj);
	}
}
