var musicfile="musik.htm"
var noMusicfile="nomusic.htm"
var pictureOn="Nav/musik_no.jpg"
var pictureOff="Nav/musik_no.jpg"
//var pictureOn="Nav/mus_on.jpg"
//var pictureOff="Nav/musik_off.jpg"
var musicButton="musicbutton"

function switchMusic(pathToRoot){
	
	var myPath=pathToRoot
	if (musicOn())
	{
		myPath=myPath + noMusicfile
		parent.frm_music.location.href=myPath
		parent.frm_main.document.getElementById(musicButton).setAttribute("src",pathToRoot + pictureOn) 
	}
	else
	{
		myPath=myPath + musicfile
		parent.frm_music.location.href=myPath
		parent.frm_main.document.getElementById(musicButton).setAttribute("src",pathToRoot + pictureOff)
	}

	
}

function musicOn(){
	
	var dateiname=parent.frm_music.location.href
	dateiname=dateiname.substring(dateiname.lastIndexOf("/")+1)
	if(musicfile == dateiname)
		return true
	else
		return false
	
}

function preloadImages(){
	
	document.Vorladen=new Array()
	document.Vorladen[0]=new Image()
	document.Vorladen[0].src=pictureOn
	document.Vorladen[1]=new Image()
	document.Vorladen[1].src=pictureOff
	
}

function playMusic(musicpath, pathToRoot ){

		if (musicOn()){
			switchMusic(pathToRoot)	
		}
		window.open(musicpath)
	
}

function getMusicImage(pathToRoot){

	var bild = "<img id='musicbutton' width='46' height='23' border='0' src='"
	if ( musicOn()){
		bild= bild + pathToRoot + pictureOff
	}
	else{
		bild = bild + pathToRoot + pictureOn
	}	
	
	bild = bild + "'>"
	return bild;
}