function ask_delete(link){
    var ok=confirm('Sind Sie sicher, dass Sie diesen Datensatz löschen wollen');
    if(ok==true)
	document.location.href=link;
}
function ask_q(frage,link){
    var ok=confirm(frage);
    if(ok==true)
	document.location.href=link;
}

function set_sortval(sortval){
    var oldval=document.forms[0].sort.value;
    if(oldval==sortval)
	sortval=sortval+" DESC";
    document.forms[0].sort.value=sortval;
    document.forms[0].submit();
}
function autodate(formnr,feld,jahr,monat,tag){
    
    for(var j=0;j<document.forms[formnr].neu_bis_j.options.length;j++){
	if(document.forms[formnr].neu_bis_j.options[j].value==jahr)
	  document.forms[formnr].neu_bis_j.options[j].selected="true";
    }
    for(var j=0;j<document.forms[formnr].neu_bis_m.options.length;j++){
	if(document.forms[formnr].neu_bis_m.options[j].value==monat)
	  document.forms[formnr].neu_bis_m.options[j].selected="true";
    }
    for(var j=0;j<document.forms[formnr].neu_bis_d.options.length;j++){
	if(document.forms[formnr].neu_bis_d.options[j].value==tag)
	  document.forms[formnr].neu_bis_d.options[j].selected="true";
    }
}

function open_multiselect_window(formnr,strurl,breite,hoehe){
    var uebergabe="";
    for(var i=0;i<document.forms[formnr].length;i++){
	if(document.forms[formnr].elements[i].name.search()!=-1 && document.forms[formnr].elements[i].checked==true)
	    uebergabe+=document.forms[formnr].elements[i].name.substr(3) + "|";
    }
    if(uebergabe!=""){
	editwinstat(strurl + uebergabe,breite,hoehe);
    }else{
	alert("die Auswahl ist leer");
    }
}

function frage_baustein_version(){
    var cfm=confirm('Sind Sie sicher, dass Sie eine neue Version anlegen wollen?');
    if(cfm==true){
	document.forms[0].mode.value='b_copy';
	document.forms[0].submit();
    }
}

function checkradio(theRadio){
    
  if(theRadio.getAttribute("wasChecked")=="true"){
    theRadio.checked = false;
    theRadio.setAttribute("wasChecked","false");
  } else {
    theRadio.setAttribute("wasChecked","true");
  }
  if(theRadio.name=="sofitel_zimmer" && theRadio.checked == true){
      document.anmeldung.hotel[0].checked="true";
      document.anmeldung.maritim_zimmer[0].checked="";
      document.anmeldung.maritim_zimmer[1].checked="";
  }
  if(theRadio.name=="maritim_zimmer" && theRadio.checked == true){
      document.anmeldung.hotel[1].checked="true";
      document.anmeldung.sofitel_zimmer[0].checked="";
      document.anmeldung.sofitel_zimmer[1].checked="";
  }
  if(theRadio.name=="hotel"){
      if(theRadio.value=="maritim"){
	  document.anmeldung.sofitel_zimmer[0].checked="";
	  document.anmeldung.sofitel_zimmer[1].checked="";	  
      }else{
	  document.anmeldung.maritim_zimmer[0].checked="";
	  document.anmeldung.maritim_zimmer[1].checked="";	  
      }
  }
}

