/*
 * ByRei winDiv 0.72 - Div Window Script
 *
 * Copyright (c) 2008 Markus Bordihn (markusbordihn.de)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * $Date: 2008-05-26 18:00:00 +0100 (Mon, 26 Mai 2008) $
 * $Rev: 0.72 $
 */

ByRei_winDiv=
	{
	info:
		{
		Name:"ByRei winDiv",Version:0.72,Author:"Markus Bordihn (http://markusbordihn.de)",Description:"Div Window Script"
	}
	,cache:
		{
		font:'"Impact" fantasy',opacity:75,relpic:[],next_func:'',prev_func:'',head_h:0,foot_h:0,limit_h:0,limit_w:0,nobg:0,error:0,EvtBug:0,hidden_obj:[],active:false,scrollTop:0,scrollLeft:0,safari:(navigator.userAgent.indexOf("Safari")!==-1||navigator.userAgent.indexOf("AppleWebKit")!==-1)?1:0,ie6:(navigator.userAgent.indexOf("MSIE 6.",0)!==-1)?1:0,ie:window.attachEvent?1:0
	}
	,id:
		{
		zIndex:9999,def:'ByRei_winDivdef',bg:'ByRei_winDivbg',body:'ByRei_winDivbody',content:'ByRei_winDivcontent',top:'ByRei_winDivtop',bottom:'ByRei_winDivbottom'
	}
	,get_type:function(a)
		{
		var b='unknown';
		if(a)
			{
			a=a.toLowerCase();
			if(a.match('.jpe?g|.png|.gif'))
				{
				b='img'
			}
			else if(a.match('youtube.com/(v/|watch)'))
				{
				b='youtube'
			}
			else if(a.match('(video.)?google.(com|de)/(videoplay|googleplayer.swf)'))
				{
				b='videogoogle'
			}
			else if(a.match('myvideo.de/movie/'))
				{
				b='myvideo'
			}
			else if(a.match('clipfish.de/videoplayer.swf'))
				{
				b='clipfish'
			}
			else if(a.match('veoh.com/(videos/|videodetails)'))
				{
				b='veoh'
			}
			else if(a.match('putfile.com/'))
				{
				b='putfile'
			}
			else if(a.match('sevenload.com/(pl|.*/.*-.*)'))
				{
				b='sevenload'
			}
			else if(a.match('megavideo.com/.?(v/|v=)'))
				{
				b='megavideo'
			}
			else if(a.match('.html?#swf'))
				{
				b='swf-fallback'
			}
			else if(a.match('.swf'))
				{
				b='swf'
			}
			else if(a.match('#'))
				{
				b='direct'
			}
			else if(a.match('.te?xt|.xml'))
				{
				b='txt'
			}
			else if(a.match('.pdf'))
				{
				b='plugin'
			}
			else if(a.match('.7?zip|.7z|.exe|.pdf|.tar|.rar'))
				{
				b='file'
			}
			else if(a.match('.s?d?x?html?|.php|.pl|.asp|.cgi'))
				{
				b='html'
			}
		}
		return b
	}
	,init:function()
		{
		var b=0,div_list=document.getElementsByTagName('a');
		for(var i=0;
		i<div_list.length;
		i++)
			{
			var c=div_list[i].className.split(' ');
			if(ByRei_winDiv.check_array(c,'winDiv'))
				{
				ByRei_winDiv.add_pop(div_list[i],ByRei_winDiv.get_type(div_list[i].href));
				b++
			}
		}
		if(b)
			{
			ByRei_winDiv.cache.evtBug=ByRei_winDiv.get_clientWidth()+ByRei_winDiv.get_clientHeight();
			ByRei_winDiv.set_hotkeys();
			if(ByRei_winDiv.cache.ie6)
				{
				ByRei_winDiv.set_eventListener(window,'scroll',function(a)
					{
					ByRei_winDiv.close_pop()
				}
				)
			}
			else
				{
				ByRei_winDiv.set_eventListener(window,'scroll',function(a)
					{
					if(ByRei_winDiv.cache.active)
						{
						if(ByRei_winDiv.cache.scrollTop!==ByRei_winDiv.get_scrollTop()||ByRei_winDiv.cache.scrollLeft!==ByRei_winDiv.get_scrollLeft())
							{
							window.scrollTo(ByRei_winDiv.cache.scrollLeft,ByRei_winDiv.cache.scrollTop)
						}
					}
					else
						{
						ByRei_winDiv.cache.scrollTop=ByRei_winDiv.get_scrollTop();
						ByRei_winDiv.cache.scrollLeft=ByRei_winDiv.get_scrollLeft()
					}
				}
				)
			}
			ByRei_winDiv.set_eventListener(window,'resize',function(a)
				{
				if(ByRei_winDiv.get_clientWidth()+ByRei_winDiv.get_clientHeight()!==ByRei_winDiv.cache.evtBug)
					{
					ByRei_winDiv.cache.evtBug=ByRei_winDiv.get_clientWidth()+ByRei_winDiv.get_clientHeight();
					ByRei_winDiv.close_pop()
				}
			}
			)
		}
	}
	,add_pop:function(b,c)
		{
		if(b&&c)
			{
			var d=null,nofooter=null,classNames=b.className.split(' '),rel=(b.rel||false),title=(b.title||b.alt||false),height=ByRei_winDiv.check_array(classNames,'winDiv_height-',1).split('winDiv_height-')[1],width=ByRei_winDiv.check_array(classNames,'winDiv_width-',1).split('winDiv_width-')[1],nobg=ByRei_winDiv.check_array(classNames,'winDiv_nobg')?1:0,noclose=ByRei_winDiv.check_array(classNames,'winDiv_noclose')?1:0,scale=ByRei_winDiv.check_array(classNames,'winDiv_scale')&&(c==='img')?1:0;
			if(ByRei_winDiv.check_array(classNames,'winDiv_Ajax'))
				{
				c='ajax'
			}
			switch(c)
				{
				case"txt":case"html":case"unknown":nofooter=0;
				break;
				default:nofooter=1;
				break
			}
			nofooter=(ByRei_winDiv.check_array(classNames,'winDiv_nofooter')||(!title&&!rel&&nofooter))?1:0;
			if(rel)
				{
				ByRei_winDiv.cache.relpic.push([b,rel,c])
			}
			if(c==='direct')
				{
				var e=document.getElementsByTagName('a');
				for(var i=0;
				i<e.length;
				i++)
					{
					if(e[i].name===b.href.split('#')[1])
						{
						if(e[i].parentNode.style)
							{
							e[i].parentNode.style.display='none';
							e[i].parentNode.style.visibility='hidden';
							d=e[i].parentNode
						}
					}
				}
			}
			ByRei_winDiv.set_eventListener(b,'click',function(a)
				{
				ByRei_winDiv.show_pop(c,b,title,rel,width,height,scale,nobg,nofooter,noclose,d);
				if(a.returnValue)
					{
					a.returnValue=false
				}
				else if(a.preventDefault)
					{
					a.preventDefault()
				}
				else
					{
					return false
				}
			}
			)
		}
	}
	,close_pop:function()
		{
		ByRei_winDiv.cache.active=false;
		ByRei_winDiv.show_object();
		if(ByRei_winDiv.cache.error)
			{
			window.clearInterval(ByRei_winDiv.cache.error);
			ByRei_winDiv.cache.error=0
		}
		if(ByRei_winDiv.getElem('popup'))
			{
			ByRei_winDiv.getElem('popup').style.display='none';
			document.body.removeChild(ByRei_winDiv.getElem('popup'))
		}
		if(ByRei_winDiv.getElem('bg'))
			{
			document.body.removeChild(ByRei_winDiv.getElem('bg'))
		}
	}
	,show_pop:function(b,c,d,f,g,h,j,k,l,m,n)
		{
		if(ByRei_winDiv.cache.nobg)
			{
			ByRei_winDiv.close_pop();
			ByRei_winDiv.cache.nobg=0
		}
		if(!k)
			{
			ByRei_winDiv.show_background()
		}
		else
			{
			ByRei_winDiv.cache.nobg=1
		}
		ByRei_winDiv.template(g,h,l,m,k,j,b);
		if(ByRei_winDiv.getElem('content'))
			{
			ByRei_winDiv.hide_object();
			ByRei_winDiv.cache.active=true;
			var o=document.createElement("div"),obj_obj=document.createElement("object");
			if(j&&f||!j)
				{
				ByRei_winDiv.message('Please wait loading...')
			}
			if(f)
				{
				var p,found,prev_Obj,next_Obj,i2=0,navi=document.createElement("div"),navi_prev=document.createElement("div"),navi_next=document.createElement("div"),navi_text=document.createElement("div"),navi_func=function(a)
					{
					if(ByRei_winDiv.getElem('popup'))
						{
						ByRei_winDiv.getElem('popup').style.display='none';
						document.body.removeChild(ByRei_winDiv.getElem('popup'))
					}
					ByRei_winDiv.show_pop(ByRei_winDiv.get_type(a.href),a,a.title,f,ByRei_winDiv.cache.limit_w,ByRei_winDiv.cache.limit_h,j,k,l,m)
				};
				for(var i=0;
				i<ByRei_winDiv.cache.relpic.length;
				i++)
					{
					if(c===ByRei_winDiv.cache.relpic[i][0])
						{
						found=++i2
					}
					if(f===ByRei_winDiv.cache.relpic[i][1]&&c!==ByRei_winDiv.cache.relpic[i][0])
						{
						if(!next_Obj)
							{
							if(!found)
								{
								prev_Obj=ByRei_winDiv.cache.relpic[i][0]
							}
							else
								{
								next_Obj=ByRei_winDiv.cache.relpic[i][0]
							}
						}
						++i2
					}
				}
				ByRei_winDiv.cache.prev_func=ByRei_winDiv.cache.next_func="";
				navi_text.style.display='block';
				navi_text.style.textAlign='center';
				navi.style.position='relative';
				navi.style.padding='4px';
				navi_prev.style.position=navi_next.style.position='absolute';
				navi_prev.style.top=navi_next.style.top=0;
				navi_prev.style.fontFamily=navi_next.style.fontFamily=ByRei_winDiv.cache.font;
				navi_prev.style.fontSize=navi_next.style.fontSize='16px';
				navi_prev.style.cursor=navi_next.style.cursor='pointer';
				navi_prev.style.left='5px';
				navi_next.style.right='5px';
				switch(b)
					{
					case"img":p='Bild';
					break;
					case"youtube":case"videogoogle":case"myvideo":case"clipfish":p='Video';
					break;
					default:p='Seite';
					break
				}
				if(prev_Obj)
					{
					ByRei_winDiv.cache.prev_func=function()
						{
						navi_func(prev_Obj)
					};
					navi_prev.appendChild(document.createTextNode('[Prev]'));
					ByRei_winDiv.add_hover(navi_prev);
					ByRei_winDiv.set_eventListener(navi_prev,'click',ByRei_winDiv.cache.prev_func);
					navi.appendChild(navi_prev)
				}
				if(next_Obj)
					{
					ByRei_winDiv.cache.next_func=function()
						{
						navi_func(next_Obj)
					};
					navi_next.appendChild(document.createTextNode('[Next]'));
					ByRei_winDiv.add_hover(navi_next);
					ByRei_winDiv.set_eventListener(navi_next,'click',ByRei_winDiv.cache.next_func);
					navi.appendChild(navi_next)
				}
				navi_text.appendChild(document.createTextNode(((d)?(d+' '):'')+' ('+p+': '+found+' von '+i2+')'));
				navi.appendChild(navi_text);
				ByRei_winDiv.set_title(navi)
			}
			switch(b)
				{
				case"img":var q=new Image();
				ByRei_winDiv.set_eventListener(q,'error',function(e)
					{
					ByRei_winDiv.error_message('Error loading Image: '+c.href)
				}
				);
				ByRei_winDiv.set_eventListener(q,'load',function(e)
					{
					if(j)
						{
						ByRei_winDiv.scale_template(q.width,q.height)
					}
					var a=ByRei_winDiv.get_scaling(q.width,q.height);
					q.width=a.w;
					q.height=a.h;
					if(j)
						{
						ByRei_winDiv.scale_template(q.width,q.height)
					}
					if(q.height<ByRei_winDiv.cache.limit_h)
						{
						q.style.paddingTop=((ByRei_winDiv.cache.limit_h-q.height)/2)+'px'
					}
					q.style.cursor='pointer';
					ByRei_winDiv.set_content(q);
					ByRei_winDiv.visible()
				}
				);
				q.src=c.href;
				break;
				case"youtube":case"videogoogle":case"myvideo":case"clipfish":case"veoh":case"putfile":case"sevenload":case"megavideo":case"swf":case"swf-fallback":if(c.href.indexOf('http://')>=0)
					{
					var r,param_movie=document.createElement("param"),param_wmode=document.createElement("param"),param_flashvars=document.createElement("param"),param_allowfullscreen=document.createElement("param");
					var s=null;
					ByRei_winDiv.scale_template(ByRei_winDiv.get_clientWidth(),ByRei_winDiv.get_clientHeight());
					switch(b)
						{
						case"youtube":if(c.href.indexOf('watch?v=')>=0)
							{
							c.href=c.href.replace(/watch\?v=/,'v/')
						}
						s=ByRei_winDiv.get_scaling(425,355,true);
						r='autoplay=1';
						break;
						case"videogoogle":if(c.href.indexOf('videoplay')>=0)
							{
							c.href=c.href.replace(/videoplay/,'googleplayer.swf')
						}
						s=ByRei_winDiv.get_scaling(400,326,true);
						r='autoplay=1';
						break;
						case"clipfish":if(c.href.indexOf('as=0')>=0)
							{
							c.href=c.href.replace(/as=0/,'as=1')
						}
						s=ByRei_winDiv.get_scaling(464,380,true);
						r='as=1';
						break;
						case"myvideo":s=ByRei_winDiv.get_scaling(470,406,true);
						break;
						case"veoh":if(c.href.indexOf('/videos/')>=0)
							{
							c.href=c.href.replace(/\/videos\//,'/videodetails2.swf?player=videodetailsembedded&permalinkId=')
						}
						s=ByRei_winDiv.get_scaling(540,438,true);
						r='videoAutoPlay=1';
						break;
						case"putfile":if(c.href.indexOf('putfile.swf')<0)
							{
							c.href=c.href.replace(/media.putfile.com\//,'feat.putfile.com/flow/putfile.swf?videoFile=')
						}
						s=ByRei_winDiv.get_scaling(425,345,true);
						break;
						case"sevenload":if(c.href.indexOf('/swf')<0)
							{
							c.href='http://de.sevenload.com/pl/'+c.href.match(/.*\/(\w*)-/)[1]+'/500x408/swfplay'
						}
						c.href+='?autoplay=1';
						s=ByRei_winDiv.get_scaling(500,408,true);
						break;
						case"megavideo":if(c.href.indexOf('?v=')>=0)
							{
							c.href=c.href.replace(/\?v=/,'v/')
						}
						c.href+='.'+Math.floor(Math.random()*100000000)+'.0';
						s=ByRei_winDiv.get_scaling(425,351,true);
						break;
						case"swf-fallback":if(c.href.indexOf('#swf')>=0)
							{
							c.href=c.href.replace(/.htm#swf/,'.swf')
						}
						break
					}
					if(s)
						{
						ByRei_winDiv.scale_template(s.w,s.h)
					}
					if(ByRei_winDiv.cache.ie)
						{
						o.innerHTML='<object type="application/x-shockwave-flash" data="'+c.href+'" width="'+ByRei_winDiv.cache.limit_w+'" height="'+ByRei_winDiv.cache.limit_h+'">'+' <param name="flashvars" value="'+r+'">'+' <param name="movie" value="'+c.href+'">'+' <param name="allowFullScreen" value="true">'+' <param name="wmode" value="window">'+'<\/object>'
					}
					else
						{
						param_wmode.name="wmode";
						param_wmode.value="window";
						param_flashvars.name="flashvars";
						param_flashvars.value=r;
						param_allowfullscreen.name="allowFullScreen";
						param_allowfullscreen.value="true";
						param_movie.name="movie";
						obj_obj.data=param_movie.value=c.href;
						obj_obj.type="application/x-shockwave-flash";
						obj_obj.width=ByRei_winDiv.cache.limit_w+'px';
						obj_obj.height=ByRei_winDiv.cache.limit_h+'px';
						obj_obj.appendChild(param_movie);
						obj_obj.appendChild(param_wmode);
						obj_obj.appendChild(param_flashvars);
						obj_obj.appendChild(param_allowfullscreen);
						o.appendChild(obj_obj)
					}
					ByRei_winDiv.set_content(o)
				}
				else
					{
					ByRei_winDiv.error_message('Invalid URL: '+c.href)
				}
				break;
				case"txt":case"html":case"unknown":var t;
				switch(b)
					{
					case"txt":t="text/plain";
					break;
					case"html":t="text/html";
					break;
					default:t="text/html";
					break
				}
				if(ByRei_winDiv.cache.ie)
					{
					o.innerHTML='<object type="'+t+'" data="'+c.href+'" width="'+ByRei_winDiv.cache.limit_w+'" height="'+ByRei_winDiv.cache.limit_h+'"><\/object>'
				}
				else
					{
					obj_obj.data=c.href;
					obj_obj.type=t;
					obj_obj.width=ByRei_winDiv.cache.limit_w+'px';
					obj_obj.height=ByRei_winDiv.cache.limit_h+'px';
					o.appendChild(obj_obj)
				}
				ByRei_winDiv.set_content(o);
				break;
				case"ajax":ByRei_winDiv.get_remoteContent(c.href);
				break;
				case"direct":if(n)
					{
					if(n.hasChildNodes())
						{
						var u=n.childNodes;
						for(i=0;
						i<u.length;
						i++)
							{
							ByRei_winDiv.show_object(u[i])
						}
					}
					var v=n.cloneNode(true);
					v.style.display='block';
					v.style.visibility='visible';
					o.appendChild(v);
					ByRei_winDiv.set_content(o)
				}
				else
					{
					ByRei_winDiv.error_message('Error no Content found')
				}
				break;
				default:ByRei_winDiv.error_message('Error no Matching Type: '+b);
				break
			}
			var w=document.createElement("div");
			w.style.textAlign='center';
			if(d)
				{
				w.appendChild(document.createTextNode(d))
			}
			else if(!f)
				{
				w.appendChild(document.createTextNode('Source: '+c.href))
			}
			if(w.firstChild)
				{
				ByRei_winDiv.set_title(w)
			}
		}
	}
	,set_title:function(a)
		{
		if(ByRei_winDiv.getElem('bottom')&&a)
			{
			ByRei_winDiv.getElem('bottom').appendChild(a)
		}
	}
	,set_content:function(a)
		{
		if(ByRei_winDiv.getElem('content')&&a)
			{
			var b=ByRei_winDiv.getElem('content');
			if(b.firstChild)
				{
				b.replaceChild(a,b.firstChild)
			}
			else
				{
				b.appendChild(a)
			}
		}
	}
	,scale_template:function(a,b)
		{
		if((a||b)&&ByRei_winDiv.getElem('popup')&&ByRei_winDiv.getElem('content')&&ByRei_winDiv.getElem('body'))
			{
			var c=ByRei_winDiv.getElem('popup'),divbody=ByRei_winDiv.getElem('body'),divcontent=ByRei_winDiv.getElem('content'),width=(Number(a)+100<ByRei_winDiv.get_clientWidth())?Number(a):ByRei_winDiv.get_clientWidth()-100,height=(Number(b)+100+ByRei_winDiv.cache.head_h<ByRei_winDiv.get_clientHeight())?Number(b):ByRei_winDiv.get_clientHeight()-100-ByRei_winDiv.cache.head_h;
			ByRei_winDiv.cache.limit_w=width;
			ByRei_winDiv.cache.limit_h=height;
			c.style.height=(height+ByRei_winDiv.cache.head_h+ByRei_winDiv.cache.foot_h+10)+'px';
			c.style.width=width+6+'px';
			divbody.style.height=(height+ByRei_winDiv.cache.foot_h)+'px';
			divcontent.style.height=(height)+'px';
			divcontent.style.width=(width)+'px';
			divcontent.style.paddingLeft=2+'px';
			c.style.top=((ByRei_winDiv.get_clientHeight()-Number(c.style.height.split('px')[0])-c.style.paddingTop.split('px')[0])/2)+(ByRei_winDiv.cache.ie6?(ByRei_winDiv.get_scrollTop()):0)+'px';
			c.style.left=((ByRei_winDiv.get_clientWidth()-Number(c.style.width.split('px')[0]))/2)+(ByRei_winDiv.cache.ie6?(ByRei_winDiv.get_scrollLeft()):0)+'px'
		}
	}
	,template:function(b,c,d,f,g,h,i)
		{
		if(!ByRei_winDiv.getElem('popup'))
			{
			var j=document.createElement("div"),divbody=document.createElement("div"),divcontent=document.createElement("div"),divbottom=document.createElement("div"),c0_t=document.createElement("b"),c0_b=document.createElement("b"),c1=document.createElement("b"),c2=document.createElement("b"),c3=document.createElement("b"),c4=document.createElement("b"),c5=document.createElement("b");
			ByRei_winDiv.cache.head_h=(f)?0:25;
			ByRei_winDiv.cache.foot_h=(d)?0:20;
			var k=(Number(b)+100<ByRei_winDiv.get_clientWidth())?Number(b):Number(ByRei_winDiv.get_clientWidth()-100),height=(Number(c)+100+ByRei_winDiv.cache.head_h<ByRei_winDiv.get_clientHeight())?Number(c):ByRei_winDiv.get_clientHeight()-100-ByRei_winDiv.cache.head_h;
			ByRei_winDiv.cache.limit_w=k;
			ByRei_winDiv.cache.limit_h=height;
			j.id=ByRei_winDiv.id.def;
			divbody.id=ByRei_winDiv.id.body;
			divcontent.id=ByRei_winDiv.id.content;
			divbottom.id=ByRei_winDiv.id.bottom;
			c1.style.display=c2.style.display=c3.style.display=c4.style.display=c5.style.display='block';
			c1.style.height=c2.style.height=c3.style.height=c4.style.height=c5.style.height='1px';
			c0_t.style.height=c0_b.style.height='5px';
			c0_t.style.overflow=c0_b.style.overflow=c1.style.overflow=c2.style.overflow=c3.style.overflow=c4.style.overflow=c5.style.overflow=divbottom.style.overflow=j.style.overflow='hidden';
			c0_t.style.background=c0_b.style.background=c1.style.background=c2.style.background=c3.style.background=c4.style.background=c5.style.background='#fff';
			c1.style.marginLeft=c1.style.marginRight='3px';
			c1.style.paddingLeft=c1.style.paddingRight='1px';
			c1.style.background='#bfbfbf';
			c2.style.marginLeft=c2.style.marginRight=c2.style.paddingRight=c2.style.paddingLeft='1px';
			c2.style.background='#cecece';
			c3.style.marginLeft=c3.style.marginRight='1px';
			c3.style.borderLeft=c3.style.borderRight=divbody.style.borderLeft=divbody.style.borderRight='1px solid #cecece';
			if(!g)
				{
				c1.style.borderLeft=c1.style.borderRight=c4.style.borderLeft=c4.style.borderRight='1px solid #6d6d6d';
				c2.style.borderLeft=c2.style.borderRight='1px solid #191919';
				c5.style.borderLeft=c5.style.borderRight='1px solid #bfbfbf'
			}
			else
				{
				c1.style.borderLeft=c1.style.borderRight=c2.style.borderLeft=c2.style.borderRight=c4.style.borderLeft=c4.style.borderRight=c5.style.borderLeft=c5.style.borderRight='1px solid #cecece'
			}
			switch(i)
				{
				case"direct":case"ajax":divcontent.style.overflow='auto';
				break;
				default:divcontent.style.overflow='hidden';
				break
			}
			divcontent.style.textAlign='center';
			j.style.width=(k)+'px';
			j.style.height=(height+ByRei_winDiv.cache.head_h+ByRei_winDiv.cache.foot_h+10)+'px';
			j.style.paddingTop=ByRei_winDiv.cache.head_h+'px';
			j.style.position=ByRei_winDiv.cache.ie6?'absolute':'fixed';
			j.style.top=((ByRei_winDiv.get_clientHeight()-Number(j.style.height.split('px')[0])-j.style.paddingTop.split('px')[0])/2)+(ByRei_winDiv.cache.ie6?(ByRei_winDiv.get_scrollTop()):0)+'px';
			j.style.left=((ByRei_winDiv.get_clientWidth()-Number(j.style.width.split('px')[0]))/2)+(ByRei_winDiv.cache.ie6?(ByRei_winDiv.get_scrollLeft()):0)+'px';
			j.style.zIndex=ByRei_winDiv.id.zIndex;
			divbody.style.background='#fff';
			divbody.style.height=(height+ByRei_winDiv.cache.foot_h)+'px';
			divbottom.style.height=ByRei_winDiv.cache.foot_h+'px';
			divbottom.style.fontFamily='Verdana, Arial, Helvetica, sans-serif';
			divbottom.style.fontSize='12px';
			divcontent.style.height=(height)+'px';
			divcontent.style.width=(k)+'px';
			c0_t.appendChild(c1);
			c0_t.appendChild(c2);
			c0_t.appendChild(c3);
			c0_t.appendChild(c4);
			c0_t.appendChild(c5);
			c0_b.appendChild(c5.cloneNode(true));
			c0_b.appendChild(c4.cloneNode(true));
			c0_b.appendChild(c3.cloneNode(true));
			c0_b.appendChild(c2.cloneNode(true));
			c0_b.appendChild(c1.cloneNode(true));
			if(!f)
				{
				var l=document.createElement("div"),divtop_cont=document.createElement("div"),divdummy=document.createElement("div");
				divtop_cont.id=ByRei_winDiv.id.top;
				l.style.cursor='pointer';
				l.style.textAlign='center';
				l.style.height=ByRei_winDiv.cache.head_h+'px';
				l.style.width='150px';
				l.style.position='absolute';
				l.style.top=divdummy.style.height='2px';
				l.style.right=ByRei_winDiv.cache.ie6?'-1px':0;
				l.style.fontFamily=ByRei_winDiv.cache.font;
				l.style.fontSize='16px';
				divtop_cont.style.background=divdummy.style.background='#fff';
				divtop_cont.style.borderLeft=divtop_cont.style.borderRight=divdummy.style.borderRight='1px solid #cecece';
				divtop_cont.appendChild(document.createTextNode('close Screen [X]'));
				divdummy.style.overflow='hidden';
				divdummy.style.borderLeft='1px solid #fff';
				ByRei_winDiv.add_hover(divtop_cont);
				ByRei_winDiv.set_eventListener(divtop_cont,'click',function()
					{
					ByRei_winDiv.close_pop()
				}
				);
				l.appendChild(c0_t.cloneNode(true));
				l.appendChild(divtop_cont);
				l.appendChild(divdummy);
				divbody.appendChild(l)
			}
			if(i==='img')
				{
				ByRei_winDiv.set_eventListener(divcontent,'click',function(e)
					{
					if(ByRei_winDiv.cache.ie)
						{
						e.cancelBubble=true
					}
					if(e.stopPropagation)
						{
						e.stopPropagation()
					}
					var a=e.target?e.target:e.srcElement;
					if(!a.id)
						{
						ByRei_winDiv.close_pop()
					}
				}
				)
			}
			divbody.appendChild(divcontent);
			divbody.appendChild(divbottom);
			j.appendChild(c0_t);
			j.appendChild(divbody);
			j.appendChild(c0_b);
			if(h)
				{
				j.style.display='none'
			}
			document.body.appendChild(j)
		}
	}
	,message:function(a,b)
		{
		var c=ByRei_winDiv.getElem('content'),msg=document.createElement('div');
		msg.appendChild(document.createTextNode(a));
		msg.style.fontFamily=ByRei_winDiv.cache.font;
		msg.style.fontSize='16px';
		msg.style.width=ByRei_winDiv.get_clientWidth()+'px';
		msg.style.textAlign='center';
		msg.style.position='absolute';
		msg.style.top=((ByRei_winDiv.cache.limit_h-Number(msg.style.height.split('px')[0]))/2)+'px';
		msg.style.left=((ByRei_winDiv.cache.limit_w-Number(msg.style.width.split('px')[0]))/2)+'px';
		if(b||!c.firstChild)
			{
			c.appendChild(msg)
		}
		else
			{
			c.replaceChild(msg,c.firstChild)
		}
		ByRei_winDiv.visible();
		ByRei_winDiv.hide_object(c)
	}
	,error_message:function(a)
		{
		ByRei_winDiv.message(a);
		ByRei_winDiv.cache.error=window.setInterval(ByRei_winDiv.close_pop,5000)
	}
	,set_hotkeys:function()
		{
		var c=function(a)
			{
			var b=(a)?a.keyCode:event.keyCode;
			if(b===27||b===88)
				{
				ByRei_winDiv.close_pop()
			}
			else if(b===37||b===100)
				{
				if(ByRei_winDiv.cache.prev_func)
					{
					ByRei_winDiv.cache.prev_func()
				}
			}
			else if(b===39||b===102)
				{
				if(ByRei_winDiv.cache.next_func)
					{
					ByRei_winDiv.cache.next_func()
				}
			}
		};
		if(document.onkeyup===null)
			{
			document.onkeyup=c
		}
		else if(document.onkeyup)
			{
			document.onkeyup=document.onkeyup+'\n'+c
		}
		else
			{
			ByRei_winDiv.set_eventListener(document,'keypress',c)
		}
	}
	,show_background:function()
		{
		var a;
		if(!ByRei_winDiv.getElem('bg'))
			{
			a=document.createElement("div");
			a.id=ByRei_winDiv.id.bg;
			a.style.position=ByRei_winDiv.cache.ie6?'absolute':'fixed';
			a.style.overflow='hidden';
			a.style.zIndex=ByRei_winDiv.id.zIndex-1;
			a.style.top=ByRei_winDiv.cache.ie6?(ByRei_winDiv.get_scrollTop()):0+'px';
			a.style.left=ByRei_winDiv.cache.ie6?(ByRei_winDiv.get_scrollLeft()):0+'px';

			a.style.width=ByRei_winDiv.get_clientWidth()+'px';
			a.style.height=ByRei_winDiv.get_clientHeight()+'px';
			a.style.background='#000';
			a.style.filter='alpha(opacity:'+ByRei_winDiv.cache.opacity+')';
			a.style.opacity='0.'+ByRei_winDiv.cache.opacity;
			document.body.appendChild(a)
		}
		else
			{
			a=ByRei_winDiv.getElem('bg');
			a.style.display='block'
		}
	}
	,getElem:function(a)
		{
		var b;
		switch(a)
			{
			case"popup":b=ByRei_winDiv.id.def;
			break;
			case"bg":b=ByRei_winDiv.id.bg;
			break;
			case"content":b=ByRei_winDiv.id.content;
			break;
			case"top":b=ByRei_winDiv.id.top;
			break;
			case"bottom":b=ByRei_winDiv.id.bottom;
			break;
			case"body":b=ByRei_winDiv.id.body;
			break
		}
		return(document.getElementById(b)||0)
	}
	,hide_object:function()
		{
		if(ByRei_winDiv.cache.ie||ByRei_winDiv.cache.safari)
			{
			var a=[];
			if(document.getElementsByTagName("object").length>0)
				{
				a.push(document.getElementsByTagName("object"))
			}
			if(document.getElementsByTagName("embed").length>0)
				{
				a.push(document.getElementsByTagName("embed"))
			}
			if(ByRei_winDiv.cache.ie&&document.getElementsByTagName("select").length>0)
				{
				a.push(document.getElementsByTagName("select"))
			}
			if(ByRei_winDiv.cache.ie&&document.getElementsByTagName("iframe").length>0)
				{
				a.push(document.getElementsByTagName("iframe"))
			}
			for(var b=0;
			b<a.length;
			b++)
				{
				for(var i=0;
				i<a[b].length;
				i++)
					{
					if(a[b][i].style.visibility!=='hidden'&&a[b][i].style.display!=='none')
						{
						ByRei_winDiv.cache.hidden_obj.push([a[b][i],a[b][i].style.visibility]);
						a[b][i].style.visibility='hidden'
					}
				}
			}
		}
	}
	,show_object:function(a)
		{
		if(ByRei_winDiv.cache.hidden_obj)
			{
			for(var i=0;
			i<ByRei_winDiv.cache.hidden_obj.length;
			i++)
				{
				if(a)
					{
					if(ByRei_winDiv.cache.hidden_obj[i][0]===a)
						{
						ByRei_winDiv.cache.hidden_obj[i][0].style.visibility=ByRei_winDiv.cache.hidden_obj[i][1]
					}
				}
				else
					{
					ByRei_winDiv.cache.hidden_obj[i][0].style.visibility=ByRei_winDiv.cache.hidden_obj[i][1]
				}
			}
			if(!a)
				{
				ByRei_winDiv.cache.hidden_obj=[]
			}
		}
	}
	,get_scaling:function(a,b,c,d,e)
		{
		if(a&&b)
			{
			var f=a/b;
			if(!d||!e)
				{
				d=ByRei_winDiv.cache.limit_w;
				e=ByRei_winDiv.cache.limit_h
			}
			if(!c)
				{
				if(a>d&&b>e)
					{
					if((a-d>b-e))
						{
						a=d;
						b=d/f
					}
					else if((a-d<b-e))
						{
						a=e*f;
						b=e
					}
				}
				if(a>d)
					{
					a=d;
					b=d/f
				}
				if(b>e)
					{
					a=e*f;
					b=e
				}
			}
			else
				{
				if(d/f<e)
					{
					a=d;
					b=d/f
				}
				else if(e*f<d)
					{
					a=e*f;
					b=e
				}
			}
			return
				{
				w:a,h:b
			}
		}
	}
	,add_hover:function(a)
		{
		ByRei_winDiv.set_eventListener(a,'mouseover',function()
			{
			a.style.color='#f00'
		}
		);
		ByRei_winDiv.set_eventListener(a,'mouseout',function()
			{
			a.style.color='#000'
		}
		)
	}
	,get_scrollTop:function()
		{
		return(window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop)
	}
	,get_scrollLeft:function()
		{
		return(window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft)
	}
	,get_clientWidth:function()
		{
		var x;
		if(self.innerWidth)
			{
			x=self.innerWidth
		}
		else if(document.documentElement&&document.documentElement.clientWidth)
			{
			x=document.documentElement.clientWidth
		}
		else if(document.body)
			{
			x=document.body.clientWidth
		}
		return Number(x)
	}
	,get_clientHeight:function()
		{
		var y;
		if(self.innerHeight)
			{
			y=self.innerHeight
		}
		else if(document.documentElement&&document.documentElement.clientHeight)
			{
			y=document.documentElement.clientHeight
		}
		else if(document.body)
			{
			y=document.body.clientHeight
		}
		return Number(y)
	}
	,get_remoteContent:function(b)
		{
		var c=false;
		if(window.XMLHttpRequest)
			{
			c=new XMLHttpRequest();
			if(c.overrideMimeType)
				{
				c.overrideMimeType('text/xml')
			}
		}
		else if(window.ActiveXObject)
			{
			try
				{
				c=new ActiveXObject("Msxml2.XMLHTTP")
			}
			catch(e)
				{
				try
					{
					c=new ActiveXObject("Microsoft.XMLHTTP")
				}
				catch(e2)
					{
				}
			}
		}
		if(!c)
			{
			ByRei_winDiv.error_message('Cant create XMLHTTP-Object')
		}
		else
			{
			c.onreadystatechange=function()
				{
				if(c.readyState===4)
					{
					if(c.status===200)
						{
						var a=c.responseText,obj_div=document.createElement('div');
						if(a.indexOf('<body>'))
							{
							a=a.split('<body>')[1];
							if(a.indexOf('<\/body>'))
								{
								a=a.split('<\/body>')[0]
							}
						}
						if(a)
							{
							obj_div.innerHTML=a;
							obj_div.background='#fff';
							ByRei_winDiv.set_content(obj_div)
						}
						else
							{
							ByRei_winDiv.error_message('Empty Content')
						}
					}
					else
						{
						ByRei_winDiv.error_message('There is an Error with the Request ('+c.status+')')
					}
				}
			};
			if(b.indexOf('http:')>=0||!window.location.hostname)
				{
				if(!b.match(window.location.hostname)||!window.location.hostname)
					{
					ByRei_winDiv.error_message('Offline Test and Crossdomain are not possible over AJAX !');
					c=false
				}
			}
			if(c)
				{
				c.open('GET',b,true);
				c.send(null)
			}
		}
	}
	,visible:function()
		{
		if(ByRei_winDiv.getElem('popup'))
			{
			ByRei_winDiv.getElem('popup').style.display='block'
		}
	}
	,hide:function()
		{
		if(ByRei_winDiv.getElem('popup'))
			{
			ByRei_winDiv.getElem('popup').style.display='none'
		}
	}
	,check_array:function(a,b,c)
		{
		var d='';
		if(a&&b)
			{
			for(var i=0;
			i<a.length;
			i++)
				{
				if(c&&a[i].indexOf(b)>=0)
					{
					d=a[i];
					break
				}
				else if(a[i]===b)
					{
					d=a[i];
					break
				}
			}
		}
		return d
	}
	,set_eventListener:function(a,b,c,d)
		{
		if(a&&b&&c)
			{
			if(ByRei_winDiv.cache.ie)
				{
				a.attachEvent("on"+b,c)
			}
			else
				{
				a.addEventListener(b,c,(d)?d:false)
			}
		}
	}
};
ByRei_winDiv.set_eventListener(window,'load',ByRei_winDiv.init);
