function soundCheck(sc){
	href = parent.frames["sound"].location.href;
	if(sc != "") href = sc;
	if(href.indexOf("nosound")>=0){
		$("sc_off").show();
		$("sc_on").hide();
	}else{
		$("sc_off").hide();
		$("sc_on").show();
	}
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

document.observe("dom:loaded", function(){
	if(parent.frames["sound"]){
		//c = document.cookie;
		//if(c.include("sc=")){
		//	c_sc = readCookie("sc");
		//	top.sc = c_sc;
		//}

		soundCheck("");

		$("soundControl").observe('click', function(event){
			href = parent.frames["sound"].location.href;
			if(href.indexOf("nosound.html")>=0){
				top.sc = "0";
				document.cookie = "sc=0;";
				parent.frames["sound"].location.href = "/fileadmin/niemalz/static/sound.html";
				soundCheck("sound"); 
			}else{
				top.sc = "1";
				document.cookie = "sc=1;";
				parent.frames["sound"].location.href = "/fileadmin/niemalz/static/nosound.html";
				soundCheck("nosound"); 
			}
		});
	}else{
		$("sc_off").hide();
		$("sc_on").hide();
	}
});
