/*Window script - Copyrighted 2001 Thomas Brattli. This script will come as a stand-alone script in a while*/
var oWin=new Array; oWin.zIndex=10; oWin.dragobj=-1; oWin.resizeobj=-1; oWin.zIndex=100
var isFront;
function winit(w,is,w1,h1,x1,y1){
	wins=w
	win_init()
	winpage=lib_doc_size()
	for(i=0;i<wins;i++){
		create_window(i,0,0,1)
	}
	oWin.currwins=i
	if(is){
		isFront=1
		setWindows()
	}
	if(w1){
		j=0
		for(i=2;i<arguments.length;i+=4){
			oWin[j].resize(arguments[i],arguments[i+1])
			oWin[j].origw=arguments[i]; oWin[0].origh=arguments[i+1]
			oWin[j].moveIt(eval(arguments[i+2]),arguments[i+3])
			oWin[j].checkscroll()
			oWin[j].showIt()
			j++
		}
	}
}
function create_window(i,link,heading,SYSTEM){
	oWin[i]=new lib_obj2('divWin'+i,'','','',i)
	oWin[i].oWindow=new lib_obj2('divWindow'+i,'divWin'+i)
	oWin[i].oText=new lib_obj2('divWinText'+i,'divWin'+i,'divWindow'+i)
	oWin[i].oHead=new lib_obj2('divWinHead'+i,'divWin'+i)
	oWin[i].oButtons=new lib_obj2('divWinButtons'+i,'divWin'+i)
	oWin[i].oResize=new lib_obj2('divWinResize'+i,'divWin'+i)
	//Events
	oWin[i].oHead.evnt.onmouseover=new Function("w_mmover("+i+")")
	oWin[i].oHead.evnt.onmouseout=new Function("w_mmout()")
	if(!bw.ns4) oWin[i].oHead.evnt.ondblclick=new Function("mdblclick(0,"+i+")")
	oWin[i].oResize.evnt.onmouseover=new Function("w_mmover("+i+",1)")
	oWin[i].oResize.evnt.onmouseout=new Function("w_mmout()")	
	//Styles
	if(!bw.ns4){
		oWin[i].oHead.css.cursor="move"
		oWin[i].oResize.css.cursor="w-resize"
		if(!bw.opera5){
			oWin[i].oWindow.css.overflow="hidden"
			oWin[i].css.overflow="hidden"
		}
	}

	//Scroll
	oWin[i].oUp=new lib_obj2('divWinUp'+i,'divWin'+i)
	oWin[i].oDown=new lib_obj2('divWinDown'+i,'divWin'+i)
	
	//If loader
	if(link){
		//Loader
		if(!bw.ns4) oWin[i].oLoader=new lib_obj2('ifrWin'+i,'divWin'+i)
		if(!bw.ns6&&!bw.ns4) oWin[i].oIfr=document.frames['ifrWin'+i]
	}
	
	oWin[i].lastx=oWin[i].x
	oWin[i].lasty=oWin[i].y
	oWin[i].origw=250
	oWin[i].origh=250
	
	//Functions
	oWin[i].resize=win_resize;
	oWin[i].close=win_close;
	oWin[i].maximize=win_maximize;
	oWin[i].minimize=win_minimize;
	oWin[i].regwin=win_regwin
	oWin[i].checkscroll=win_checkscroll;
	oWin[i].up=win_up;
	oWin[i].down=win_down;
	oWin[i].addZ=win_addZ;
	oWin[i].state="reg"
	oWin[i].heading=heading?heading:""
	if(link){
		oWin[i].resize(250,250)
		oWin[i].moveIt(20,150)
	}
	if(!SYSTEM){
		oWin[i].showIt()
	}
}
//Window functions 
function win_regwin(){
	this.oResize.css.visibility="inherit"
	this.resize(this.origw,this.origh)
	this.slideIt(this.lastx,this.lasty,30,10)
	this.state="reg"
	this.addZ()
	this.checkscroll()
}
function win_maximize(){
	if(this.state!="max"){
		if(this.state!="min"){this.lastx=this.x; this.lasty=this.y}
		mw=winpage.x2 - 10
		mh=winpage.y2 - 10 - 140
		this.slideIt(5,143,30,10,this.obj+'.resize('+mw+','+mh+');')
		this.state="max"
		this.addZ()
	}else this.regwin()
}
function win_minimize(){
	if(this.state!="min"){
		couns=0
		if(this.state!="max"){this.lastx=this.x; this.lasty=this.y}
		y=winpage.y2-16; ox=winpage.x2-126
		a=0
		for(i=0;i<wins;i++){
			x=i*125; ok=a
			if(a*125>ox){
				if(ox>126) i=0
				a=0; y-=15; x=0
			}
			for(j=0;j<wins;j++){
				couns++
				//self.status=oWin[j].x + "=" + x + "   -    " + oWin[j].y + "=" + y
				if(oWin[j].x==x && oWin[j].y==y) a++
			}		
			if(a==ok) break;
		}
		x=a*125;
		this.slideIt(x,y,30,10)
		this.oResize.hideIt()
		this.state="min"
		this.resize(125,14)
	}else this.regwin()
}
function win_close(){
	this.hideIt()
	this.oUp.hideIt()
	this.oDown.hideIt()
}
function win_resize(w,h){
	this.oButtons.moveIt(w-39,0)
	this.oResize.moveIt(w-13,h-9)
	this.oWindow.clipTo(0,w-2,h-23,0,1)
	this.clipTo(0,w,h,0,1)
	this.oHead.clipTo(0,w,14,0,1)
	this.oText.moveIt(2,3)
	this.oUp.hideIt()
	this.oDown.hideIt()
}
function win_checkscroll(w,h){
	this.oText.height=this.oText.evnt.offsetHeight||this.oText.css.pixelHeight||this.oText.ref.height||0
	w=this.cr
	h=this.cb
	if(this.oText.height>h-28 && this.state!="min"){
		this.oWindow.clipTo(0,w-14,h-23,0,1)
		this.oUp.moveIt(w-12,14)
		this.oUp.clipTo(0,11,h-30,0,1)
		this.oDown.moveIt(w-12,h-21)
		this.oDown.clipTo(0,11,12,0,1)
		this.oUp.showIt()
		this.oDown.showIt()
	}else{
		this.oUp.hideIt()
		this.oDown.hideIt()
	}
}
var sctim=100;
var winScroll;
function win_up(){
	clearTimeout(sctim);
	if(this.oText.y>=this.oWindow.cb-this.oText.height-10 && winScroll){
		this.oText.moveBy(0,-8); 
		setTimeout(this.obj+".up()",30)
	}
}
function win_down(){
	clearTimeout(sctim);
	if(this.oText.y<=0 && winScroll){
		this.oText.moveBy(0,8);
		setTimeout(this.obj+".down()",30)
	}
}
function noScroll(){clearTimeout(sctim);winScroll=false}


function win_addZ(){
	oWin.zIndex++
	this.css.zIndex=oWin.zIndex
}
//Initiating winpage
function win_init(){
	if(document.layers){
		document.captureEvents(Event.MOUSEMOVE | Event.MOUSEDOWN | Event.MOUSEUP | Event.DBLCLICK)
		document.ondblclick=mdblclick;
	}
	document.onmousemove=mmove;
	document.onmousedown=mdown
	document.onmouseup=mup;
}
//Event functions
function w_mmover(num,resize){ //Mouseover on elements
	if(!resize) oWin.dragover=num
	else oWin.resizeover=num
}
function w_mmout(){ //Mouseout on elements
	oWin.dragover=-1
	oWin.resizeover=-1
}
function mup(e){ //Mouseup
	if(oWin.dragobj!=-1){oWin[oWin.dragobj].lastx=oWin[oWin.dragobj].x; oWin[oWin.dragobj].lasty=oWin[oWin.dragobj].y}
	oWin.dragobj=-1	
	if(oWin.resizeobj!=-1){
		oWin[oWin.resizeobj].checkscroll()
		oWin[oWin.resizeobj].origw=oWin[oWin.resizeobj].cr
		oWin[oWin.resizeobj].origh=oWin[oWin.resizeobj].cb		
	}else if(bw.ns4) routeEvent(e)		
	oWin.resizeobj=-1
}
function mdown(e){ //Mousedown
	x=(bw.ns4 || bw.ns6)?e.pageX:event.x||event.clientX
    y=(bw.ns4 || bw.ns6)?e.pageY:event.y||event.clientY
	if(bw.ie5 || bw.ie6) y+=document.body.scrollTop
	id1=oWin.dragover
	id2=oWin.resizeover
	if(id1>-1 || id2>-1){
		if(id2>-1){ id=id2; oWin.resizeobj=id;
		}else{ 
			id=id1; oWin.dragobj=id
			oWin.clickedX=x-oWin[id].x; 
			oWin.clickedY=y-oWin[id].y
		}
		oWin[id].addZ()
		//Setting background-colors	
		for(i=0;i<wins;i++){
			if(i!=id1&&i!=id2){
				oWin[i].oWindow.bg("white")
			}else oWin[i].oWindow.bg("#EEF3F9")
		}
	}else if(bw.ns4) routeEvent(e)
}
function mmove(e,y,rresize){ //Mousemove
	x=(bw.ns4 || bw.ns6)?e.pageX:event.x||event.clientX
    y=(bw.ns4 || bw.ns6)?e.pageY:event.y||event.clientY
	if(bw.ie5 || bw.ie6) y+=document.body.scrollTop
	id1=oWin.dragobj
	id2=oWin.resizeobj
	if(id2>-1){ //Resize
		nx=x; ny=y
		oldw=oWin[id2].cr
		oldh=oWin[id2].cb
		cw= nx -oWin[id2].x
		ch= ny - oWin[id2].y
		if(cw<120) cw=120
		if(ch<70) ch=70
		oWin[id2].resize(cw,ch)
	}else if(id1>-1){ //Move
		nx=x-oWin.clickedX; ny=y-oWin.clickedY
		if(ny<140) ny=140
		oWin[id1].moveIt(nx,ny)
		if(oWin[id].state==0){oWin[id].lastx=nx; oWin[id].lasty=ny}
	}
	if(!bw.ns4) return false      
}
function mdblclick(e,num){ //Doubleclick
	if(num>-1) oWin[num].maximize()
	else if(oWin.dragover>-1) oWin[oWin.dragover].maximize()
}
function setWindows(placeit,rez){
	between=10
	oWin.rows=Math.round((oWin.currwins/3)+0.2)
	oWin.columns=1
	j=0;a=0;c=0;
	for(i=0;i<wins;i++){
		if(j==oWin.columns-1){
			oWin.columns=oWin.currwins-a<3?oWin.currwins-a:oWin.currwins-a==4?2:3
			if(oWin.currwins!=1 && a!=0) c++
			j=0
		}else if(a!=0) j++
		oWin[i].origw=(winpage.x2-3-(between*oWin.columns))/oWin.columns 
		oWin[i].origh=(winpage.y2-137-(between*oWin.rows))/oWin.rows
		oWin[i].origx=oWin[i].origw*(j)+(between*j+1) +5
		oWin[i].origy=oWin[i].origh*c+140+(between*c)  + 3
		if(!placeit){oWin[i].lasty=oWin[i].origy; oWin[i].lastx=oWin[i].origx
		}else{
			oWin[i].lasty=((page.avail)*parseFloat(oWin[i].yy)/100)+130 ; 
			oWin[i].lastx=page.x2*parseFloat(oWin[i].xx)/100
		}
		oWin[i].resize(oWin[i].origw,oWin[i].origh)
		st=oWin[i].state; oWin[i].regwin()
		if(st==1) oWin[i].minimize(1); else if(st==2) oWin[i].maximize(1)
		else if(st==3) oWin[i].close(); 
		else oWin[i].moveIt(oWin[i].lastx,oWin[i].lasty); if(!placeit)oWin[i].showIt()
		a++;
	}
}

var mDebugging=2; oDCMenu=new makeCoolMenu("oDCMenu"); oDCMenu.useframes=0 
oDCMenu.frame="frmMain"; oDCMenu.offlineUrl=""; oDCMenu.onlineUrl="http://www.almer.net/";oDCMenu.NS4padding="2px";oDCMenu.useNS4links=1 ;oDCMenu.checkselect=1 ;oDCMenu.pagecheck=0;oDCMenu.checkscroll=2;oDCMenu.resizecheck=1 ;oDCMenu.wait=1000 ;
oDCMenu.usebar=1;oDCMenu.barcolor="#336699" ;oDCMenu.barwidth="100%" ;oDCMenu.barheight="menu" ;oDCMenu.barx=0 ;oDCMenu.bary="menu";oDCMenu.barinheritborder=0 ;oDCMenu.rows=1;oDCMenu.fromleft=170 ;oDCMenu.fromtop=0 ;oDCMenu.pxbetween=0;
avail="190+((toppage.x2-210)/7)";oDCMenu.menuplacement=new Array(192,avail+"-5",avail+"*2-12",avail+"*3-11",avail+"*4-18",avail+"*5-8",avail+"*6+1")
oDCMenu.level[0]=new Array() 
oDCMenu.level[0].width=90 
oDCMenu.level[0].height=19 
oDCMenu.level[0].bgcoloroff="transparent"
oDCMenu.level[0].bgcoloron="transparent" 
oDCMenu.level[0].textcolor="white"
oDCMenu.level[0].hovercolor="#FCCE55"  
oDCMenu.level[0].style="font-family:arial,helvetica; font-size:12px; font-weight:bold"
oDCMenu.level[0].border=0 
oDCMenu.level[0].bordercolor="" 
oDCMenu.level[0].offsetX=0 
oDCMenu.level[0].offsetY=-1 
oDCMenu.level[0].NS4font="arial,helvetica"
oDCMenu.level[0].NS4fontSize="2"
oDCMenu.level[0].align="bottom" 
oDCMenu.level[1]=new Array() 
oDCMenu.level[1].width=110
oDCMenu.level[1].height=22
oDCMenu.level[1].bgcoloroff="#CDDBEB"
oDCMenu.level[1].bgcoloron="#006699"
oDCMenu.level[1].textcolor="#006699"
oDCMenu.level[1].hovercolor="#FCCE55"
oDCMenu.level[1].style="padding:2px; font-family:arial,helvetica; font-size:11px; font-weight:bold"
oDCMenu.level[1].align="bottom" 
oDCMenu.level[1].offsetX=0
oDCMenu.level[1].offsetY=0
oDCMenu.level[1].border=1 
oDCMenu.level[1].bordercolor="#006699"
oDCMenu.level[1].NS4font="arial,helvetica"
oDCMenu.level[1].NS4fontSize="2"
oDCMenu.level[2]=new Array()
oDCMenu.level[2].width=150
oDCMenu.level[2].height=20
oDCMenu.level[2].style="padding:2px; font-family: arial,helvetica; font-size:10px; font-weight:bold"
oDCMenu.level[2].align="bottom" 
oDCMenu.level[2].offsetX=0
oDCMenu.level[2].offsetY=0
oDCMenu.level[2].border=1 
oDCMenu.level[2].bordercolor="#006699"
oDCMenu.level[2].NS4fontSize="1"
oDCMenu.level[2].bgcoloroff="#CDDBEB"
oDCMenu.level[2].bgcoloron="#006699"
oDCMenu.level[2].textcolor="#006699"
oDCMenu.level[2].hovercolor="#CDDBEB"
oDCMenu.makeMenu('top0','','<b>Home</b>','http://www.almer.net/index.php','')
oDCMenu.makeMenu('top1','','<b>Humor</b>','fun/index.php')
	oDCMenu.makeMenu('sub10','top1','All FUN','fun/index.php')
	oDCMenu.makeMenu('sub11','top1','Diverses','fun/text/index.php')
	oDCMenu.makeMenu('sub12','top1','Files (exe)','fun/exe/index.php')
	oDCMenu.makeMenu('sub13','top1','Movies','fun/movie/index.php')
	oDCMenu.makeMenu('sub14','top1','PDF','fun/pdf/index.php')
	oDCMenu.makeMenu('sub15','top1','Pictures','fun/pics/index.php')
	oDCMenu.makeMenu('sub16','top1','PPS','fun/pps/index.php')
	oDCMenu.makeMenu('sub17','top1','Witze','fun/witze/index.php')
oDCMenu.makeMenu('top8','','<b>Handy</b>')
	oDCMenu.makeMenu('sub80','top8','SMS-Sprüche','sms/sprueche/index.php')
	oDCMenu.makeMenu('sub81','top8','Klingeltöne','dienste/logos_toene')
oDCMenu.makeMenu('top2','','<b>Webmaster</b>')
	oDCMenu.makeMenu('sub221','top2','Scripts','dienste/script-user-manager/dlm/')
	/*oDCMenu.makeMenu('sub222','top2','Codes','tutorials/index.asp')
	oDCMenu.makeMenu('sub223','top2','Eintragsdienst','tutorials/index.asp')
	oDCMenu.makeMenu('sub224','top2','Frames erstellen','tutorials/index.asp')
	oDCMenu.makeMenu('sub225','top2','Design','tutorials/index.asp')
	oDCMenu.makeMenu('sub226','top2','DHTML','tutorials/index.asp')
	oDCMenu.makeMenu('sub231','top2','Gifs & Bilder','tutorials/index.asp')
	oDCMenu.makeMenu('sub227','top2','JavaScript','tutorials/index.asp')
	oDCMenu.makeMenu('sub228','top2','Metatagenerator','tutorials/index.asp')
	oDCMenu.makeMenu('sub229','top2','Service','tutorials/index.asp')
	oDCMenu.makeMenu('sub230','top2','Tipps & Tricks HP','tutorials/index.asp')*/
oDCMenu.makeMenu('top3','','<b>Dienste</b>')
	oDCMenu.makeMenu('sub30','top3','Chat','dienste/chat/index.php')
	oDCMenu.makeMenu('sub31','top3','Dein SMS-Spruch','sms/sprueche/eintragenform.php')
	oDCMenu.makeMenu('sub32','top3','Dein Witz','fun/witze/eintragenform.php')
	oDCMenu.makeMenu('sub33','top3','Tell a Friend','dienste/tellfriend/index.php')	
	oDCMenu.makeMenu('sub34','top3','Uploader','dienste/up')	
	/*oDCMenu.makeMenu('sub34','top3','E-Mailadresse','forums/forum.asp?FORUM_ID=5&CAT_ID=1&Forum_Title=dhtmlcentral%2Ecom')
	oDCMenu.makeMenu('sub35','top3','Buecher','forums/forum.asp?FORUM_ID=6&CAT_ID=1&Forum_Title=General+DHTML+issues')
	oDCMenu.makeMenu('sub36','top3','Auktion','forums/forum.asp?FORUM_ID=9&CAT_ID=1&Forum_Title=Off%2Dtopic')
	
oDCMenu.makeMenu('top5','','<b>Kommunikation</b>','coolmenus/index.asp')
oDCMenu.makeMenu('sub50','top5','Chatten','coolmenus/examples/')
	oDCMenu.makeMenu('sub51','top5','Forum','coolmenus/download.asp')
	oDCMenu.makeMenu('sub52','top5','Postkarten senden','coolmenus/tutorial.asp')
		oDCMenu.makeMenu('sub520','sub52','Senden','coolmenus/tutorial.asp','',150,0)
		oDCMenu.makeMenu('sub521','sub52','Empfangen','coolmenus/tutorial.asp','',150,0)
	oDCMenu.makeMenu('sub53','top5','SMS senden','','_blank',0,0,'','','','','','','if(!bw.ns4)window.open("http://www.almer.net/phpBB","","width=800,height=600")')
    oDCMenu.makeMenu('sub53','top5','SMS senden','','_blank',0,0,'','','','','','','if(!bw.ns4)window.open("http://www.almer.net/phpBB","","width=800,height=600")')*/
oDCMenu.makeMenu('top6','','<b>Infodienste</b>','infodienste/')
    oDCMenu.makeMenu('sub060','top6','News AlmerNET','/infodienste/news/index.php')
oDCMenu.makeMenu('top7','','<b>Support</b>')
	oDCMenu.makeMenu('sub70','top7','Contact us','http://www.almer.net/dienste/kontakt/index.php','',120,0)
	oDCMenu.makeMenu('sub71','top7','Forum','http://www.almer.net/dienste/forum_1_2_0/','',120,0)
	

oDCMenu.makeStyle(); oDCMenu.construct()
oDCMenu.resizecode="placeA(n)"
	
function placeA(n){	
	if(isFront){winpage=new makePageCoords(); setWindows()}
}
placeA(); var isFront
function cm_checkScrolled(obj){
	if(bw.mac) return
	if(bw.ns4 || bw.ns6) obj.scrolledY=obj.win.pageYOffset
	else obj.scrolledY=obj.win.document.body.scrollTop
	if(obj.scrolledY!=obj.lastScrolled){
		if(!obj.useframes){
			if(obj.scrolledY>119){
				for(i=0;i<obj.l[0].num;i++){var sobj=obj.l[0].o[i].oBorder; sobj.moveY(obj.scrolledY)}
				if(obj.usebar) obj.oBar.moveY(obj.scrolledY)
			}else{
				for(i=0;i<obj.l[0].num;i++){var sobj=obj.l[0].o[i].oBorder; sobj.moveY(obj.fromtop)}
				if(obj.usebar) obj.oBar.moveY(obj.fromtop)
			}
		}
		obj.lastScrolled=obj.scrolledY; page.y=obj.scrolledY; page.y2=page.y2orig+obj.scrolledY
		if(!obj.useframes || bw.ie){ clearTimeout(obj.tim); obj.isover=0; obj.hideSubs(1,0)}
	}
	if((bw.ns4 || bw.ns6) && !obj.useframes) setTimeout("cm_checkScrolled("+obj.name+")",200)
}