/**
 * 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 !!
**/
var rs_allobjs=new Array();
var rs_scale=1;
var rs_width;
var rs_height;
function RS(p_mscale,p_caller){
	var thisobj=this;
	thisobj.gminw=parseInt((p_mscale*pcdi_docwidth)/100);
	thisobj.lastw=pcdi_docwidth;
	thisobj.lasth=pcdi_docheight;
	thisobj.resize=function(){
		rs_width = window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth);
		rs_height = window.innerHeight || (window.document.documentElement.clientHeight || window.document.body.clientHeight);
		var minw=screen.availWidth;
		if(rs_width==null){
			if(minw==null){
				rs_width=pcdi_docwidth;	
			}else{
				rs_width=minw;
			}
		}
		if((rs_width!=thisobj.lastw)||(rs_height!=thisobj.lasth)){			
			if((isNF())||(isIEM())){
				rs_scale=0.8;				
			}else if((isSFM())||(isOM())){
				//nothing
			}else{
				if(rs_width<thisobj.gminw){
					rs_width=thisobj.gminw;	
				}
				else if(pcdi_docwidth<minw){
					rs_width=(98.5*rs_width)/100;
				}
				rs_scale=((rs_width*100)/pcdi_docwidth)/100;
			}
			for(var i=0;i<bc_allobjs.length;i++){
				if(bc_allobjs[i][0]!=null){					
					rs_rsObj(bc_allobjs[i][0]);
				}
			}
			thisobj.lastw=rs_width;
			thisobj.lasth=rs_height;
			//min size
			if(rs_width<=thisobj.gminw){
				try{
					document.getElementsByTagName("body")[0].style.overflow="auto";
				}catch(e){
					//nothing
				}	
			}else{				
				try{
					document.getElementsByTagName("body")[0].style.overflow="hidden";
				}catch(e){
					//nothing
				}				
				var tmph=-1;
				var tmpt=0;
				for(var i=0;i<document.getElementsByTagName("body")[0].childNodes.length;i++){
					if(document.getElementsByTagName("body")[0].childNodes[i].nodeType==1){
						if(document.getElementsByTagName("body")[0].childNodes[i].height>rs_height+10){
							try{
								document.getElementsByTagName("body")[0].style.overflow="auto";
							}catch(e){
								//nothing
							}
							tmph=-1;
							break;
						}else{
							if(tmph<document.getElementsByTagName("body")[0].childNodes[i].height){
								tmph=document.getElementsByTagName("body")[0].childNodes[i].height;	
								tmpt=Number(document.getElementsByTagName("body")[0].childNodes[i].style.top.substring(0,document.getElementsByTagName("body")[0].childNodes[i].style.top-2));
							}
						}
					}
				}
				if((tmph!=-1)&&(!isNaN(tmph))){
					var tmpset=rs_height/2-tmph/2;
					for(var i=0;i<document.getElementsByTagName("body")[0].childNodes.length;i++){
						if(document.getElementsByTagName("body")[0].childNodes[i].style){
							document.getElementsByTagName("body")[0].childNodes[i].style.top=String(Number(document.getElementsByTagName("body")[0].childNodes[i].style.top.substring(0,document.getElementsByTagName("body")[0].childNodes[i].style.top.length-2))+tmpset)+"px";
						}
					}
				}
			}
		}
	};
	thisobj.resize();
	if(window.onresize==null){
		window.onresize=function(){
			thisobj.resize();
		};
	}
	if(p_caller!=null){
		if(p_caller==document){
			init();
		}else{
			p_caller.resCompl(thisobj);
		}
	}
}
function rs_rsObjs(p_indxs){
	for(var i=0;i<p_indxs.length;i++){
		rs_rsObj(bc_allobjs[p_indxs[i]][0]);
	}
}
function rs_rsObjSub(p_obj){
	if(p_obj.childNodes){
		for(var i=0;i<p_obj.childNodes.length;i++){
			rs_rsObjSub(p_obj.childNodes[i]);
		}
	}
	rs_rsObj(p_obj);
}
function rs_rsObj(p_obj){
	var indx=bc_isAllObj(p_obj);
	if(indx>-1){
		if(bc_allobjs[indx][2]==true){
			for(var i=0;i<bc_allobjs[indx][1].length;i++){
				if((bc_allobjs[indx][1][i][2]!=null)&&(bc_allobjs[indx][1][i][2]!="")&&(bc_allobjs[indx][1][i][2]!="%")){
					bc_setStyle(p_obj,String(bc_allobjs[indx][1][i][0]),String(Math.round(Number(bc_allobjs[indx][1][i][1])*rs_scale))+String(bc_allobjs[indx][1][i][2]));
				}
			}
		}
	}
}
