var tmp_obj=new Object();
var cache=Math.random();
var inserted=false;


function clear(obj,text){
	for(i=0;i<obj.childNodes.length;i++){
if(obj.childNodes[i].name==text && obj.childNodes[i].checked){
obj.childNodes[i].checked=false;
return;
}}}

function clear_all(){
var obj=document.getElementById("alter");
clear(obj,'alter');
obj=document.getElementById("toben");
clear(obj,'toben');
obj=document.getElementById("lage");
clear(obj,'lage');
obj=document.getElementById("teilnehmer");
clear(obj,'teilnehmer');
}
function submit_form(){
document.getElementById("send").value=123
return true;
}
function show_game(obj,spiel,objindex,lan){
var str;
inserted=false;
if(tmp_obj.id){str=tmp_obj.id;tmp_obj.setAttribute("id","");tmp_obj.parentNode.removeChild(tmp_obj);}
if(str !='det'+spiel){
	
// firefox trash can:
var b=new String(navigator.userAgent);
b=b.toLowerCase();
if(b.indexOf('firefox')>0)objindex+=2;
//=====================================

cache++;
el1=document.createElement("SCRIPT");
obj=document.getElementById("call");
obj.appendChild(el1);
obj.lastChild.setAttribute("src","../scripts/show_spiel.php?lan="+lan+"&spiel="+spiel+"&cache="+cache+"&obj_index="+objindex);
}
}

function set_radio_value(obj,spiel){
var val=obj.value;
obj.checked=true;
obj=obj.parentNode;
for(i=0;i<obj.childNodes.length;i++){

if(obj.childNodes[i].name=="gruppenhaus"){
obj.childNodes[i].disabled=true;
cache++;
}}
el1=document.createElement("SCRIPT");
obj=document.getElementById("call");
if(obj.lastChild)obj.removeChild(obj.lastChild);
obj.appendChild(el1);
obj.lastChild.setAttribute("src","../scripts/save_spiele_value.php?spiel="+spiel+"&cache="+cache+"&val="+val);
}

function store_comment(spiel){
if(inserted==false){
var comment=document.getElementById("comment").value;
var author=document.getElementById("name").value;
if(author.length>3 && comment.length>10){
var web=document.getElementById("web").value;
comment.replace('"','\\"');

var str=new String();
for(i=0;i<comment.length;i++){
	if(comment.charCodeAt(i)==13){str+="^";}
	else if(comment.charCodeAt(i)==10)str+="~";
	else str+=comment.charAt(i);
	}
author.replace('"','\\"');
web.replace('"','\\"');

var el1=document.createElement("SCRIPT");
var obj=document.getElementById("call");
cache++;
if(obj.lastChild)obj.removeChild(obj.lastChild);
obj.appendChild(el1);
obj.lastChild.setAttribute("src","../scripts/save_spiele_comment.php?spiel="+spiel+"&cache="+cache+"&name="+author+"&comment="+str+"&web="+web);	
}}}

function show_intro(obj,lan){
obj=document.getElementById("d_on");
if(lan==4){
var button_text="add a game";	
var text='Before you add a new game, please look first whether this or a similar one is not already listed. With similar games, you better edit these in "game: remarks" or add another version.';
}else if(lan==2){
var text='Prima che aggiungi un nuovo gioco, controlla per favore solo, se non esiste già nel elenco. A giochi simili si può aggiungere meglio un\'altra versione in "editano gioco > osservazioni."';
var button_text='aggiungi gioco';
}else if(lan==3){
var button_text='ajouter jeu';	
var text='Avant que tu ajoutes un nouveau jeu, regardes s\'il te plaît tout d\'abord si celui-ci ou un semblable jeu déjà existes. Aux jeux semblables on peut mieux ajouter une version plus vaste dans le link "éditer jeu > remarques."';
}else if(lan==5){
var button_text='agregar juego';
var text='Antes de que usted añada un nuevo partido, mira por favor primero si este o uno similar ya juega ser puesto en una lista. Con partidos similares uno puede añadir otro versión mejor en "editar - > comentarios."';
}else{
var button_text="Spiel hinzufügen";	
var text='Bevor Du ein neues Spiel hinzufügst, schau bitte erst einmal, ob dieses oder ein ähnliches spiel nicht schon gelistet sind. Bei ähnlichen Spielen kann man besser in "Spiel editieren -> Bemerkungen" eine weitere Version hinzufügen.';
}
if(obj.lastChild.lastChild){obj.removeChild(obj.lastChild);}
else{
var el=document.createElement("DIV");
el.style.border="solid 1px orange";
el.style.margin="1em 2em 1em 2em";
el.style.width="35em";
el.style.padding="0.5em";
obj.appendChild(el);
el=document.createTextNode(text);
obj.lastChild.appendChild(el);

el=document.createElement("BR");
obj.lastChild.appendChild(el);
el=document.createElement("INPUT");
el.setAttribute("type","button");
el.setAttribute("value",button_text);
el.style.marginLeft="20em";
el.onclick=function(){change_loc(lan);};
obj.lastChild.appendChild(el);
}
}
function change_loc(lan){
window.location.href="neues_spiel.php?lan="+lan;	
}
