//------------------------------------------------------------------------------------
function substitute(string,from,to){
	var temp=''
	string+=''
	if (string.indexOf(from)!=-1){
		temp=string.substring(0,string.indexOf(from))
		temp+=to
		temp+=substitute(string.substring(string.indexOf(from)+from.length,string.length),from,to)
	}
	else temp=string
	return temp
}

//------------------------------------------------------------------------------------

function toggle(buttonID,exceptionID,frame){
	if (frame && frame.document.images && frame.document.images[buttonID] && buttonID!=exceptionID){
		if (frame.document.images[buttonID].src.indexOf('_0.')!=-1){
			frame.document.images[buttonID].src=substitute(frame.document.images[buttonID].src,'_0.','_1.')
			return
		}
		if (frame.document.images[buttonID].src.indexOf('_1.')!=-1){
			frame.document.images[buttonID].src=substitute(frame.document.images[buttonID].src,'_1.','_0.')
			return
		}
	}
}

function push(newbuttonID,oldbuttonID,frame){
	if (frame && frame.document.images && frame.document.images[oldbuttonID] && frame.document.images[oldbuttonID].src.indexOf('_1.')!=-1){
		frame.document.images[oldbuttonID].src=substitute(frame.document.images[oldbuttonID].src,'_1.','_0.')
		}
	if (frame && frame.document.images && frame.document.images[newbuttonID] && frame.document.images[newbuttonID].src.indexOf('_0.')!=-1){
		frame.document.images[newbuttonID].src=substitute(frame.document.images[newbuttonID].src,'_0.','_1.')
	}
}	

//------------------------------------------------------------------------------------

var styles=new Object()
	styles['popup']='width=755,height=510,resizable'
	styles['area2']='WIDTH=800, HEIGHT=600, screenX=100,left=100,screenY=100,top=100,toolbar=0,menubar=0,location=0,status=0,resizable=0,scrollbars=0'
	styles['rechner1']='WIDTH=430, HEIGHT=350, screenX=100,left=100,screenY=100,top=100,toolbar=0,menubar=0,location=0,status=0,resizable=0,scrollbars=0'
	styles['rechner2']='WIDTH=390, HEIGHT=350, screenX=100,left=100,screenY=100,top=100,toolbar=0,menubar=0,location=0,status=0,resizable=0,scrollbars=0'

function popup(url,name,style){
	if (style.indexOf(',')!=-1)var temp=style
	else var temp=styles[style]
	if (url.indexOf('http:')!=-1)var myurl=url
	else var myurl=getDirectory(self) + url
	if (top[name] && !top[name].closed){
		top[name].location=myurl
	}
	else {
		top[name]=window.open('',name,temp)
		top[name].location=myurl
	}
	top[name].focus()
}

//------------------------------------------------------------------------------------

function resize(fenster,width,height){
	if (document.layers) fenster.resizeTo(width,height)
	if (document.all){
		fenster.resizeTo(width,height)
		var xdiff=width-fenster.document.body.clientWidth
		var ydiff=height-fenster.document.body.clientHeight
		fenster.resizeTo(width+xdiff,height+ydiff)
	}
}

/*
function resize(object){
	var width=object.width
	var height=object.height
	if (document.layers) self.resizeTo(width,height)
	if (document.all) self.resizeTo(width+10,height+30)
}
*/

//------------------------------------------------------------------------------------

function getDirectory(window){
	var temp=substitute(window.location.pathname,'\\','/')
	var dir=temp.substring(0,temp.lastIndexOf('/')+1);
	return dir
}

function getFilename(window){
	var url=window.location.pathname
	url=substitute(url,'\\','/')
	var filename=url.substring(url.lastIndexOf('/')+1,url.length)
	return filename
}

function getFiletrunk(window){
	var filename=getFilename(window)
	var filetrunk=filename.substring(0,filename.lastIndexOf('.'))
	return filetrunk
}

//------------------------------------------------------------------------------------



