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[1].sort.value;
    if(oldval==sortval)
	sortval=sortval+" DESC";
    document.forms[1].sort.value=sortval;
    document.forms[1].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 htmlarea_change_format(data){
    data=data.replace(/</g,"OPEN_TAG");
    data=data.replace(/>/g,"CLOSE_TAG");
    data=data.replace(/#/g,"HASH_TAG");
    data=data.replace(/\(/g,"OPEN_BRACKET");
    data=data.replace(/\)/g,"CLOSE_BRACKET");
    data=data.replace(/\[/g,"OPEN_QBRACKET");
    data=data.replace(/\]/g,"CLOSE_QBRACKET");
    data=data.replace(/select/g,"PULLDOWN_TAG");
    return data;
}

