function OpenTerminWindow(id) {
   link = "/scripte/show_entry_template.php?terminid="+id;
   Neufenster = window.open(link, "TerminFenster", "width=200,height=300,resizable");
   Neufenster.focus();
}

function OpenImgWindow(img) {
   imglink = "/scripte/image_mapper.php?imglink="+img;
   Neufenster = window.open(imglink, "ImgFenster", "width=10,height=10,resizable");
   Neufenster.focus();
}

// ********************************************
function tag_code(theform,thetag,theinfotext) {
    inserttext = prompt("Bitte Text eingeben..."+"\n["+thetag+"]xxx[/"+thetag+"]",theinfotext);
    if ((inserttext != null) && (inserttext != "")) {
        theform.text.value += "["+thetag+"]"+inserttext+"[/"+thetag+"] ";
    }
    theform.text.focus();

}

// ********************************************
function link_code(theform) {
    linktext = prompt("Bitte Text für den Link eingeben...","");
    prompt_text = "Bitte Link eingeben...";
    prompt_contents = "http://";
    link = prompt(prompt_text,prompt_contents);
    if ((link != null) && (link != "")) {
        if ((linktext != null) && (linktext != ""))
            theform.text.value += "[a href=\""+link+"\"]"+linktext+"[/a] ";
        else
            theform.text.value += "[a href=\""+link+"\"]"+link+"[/a] ";
    }
    theform.text.focus();
}

// ********************************************
function img_code(theform) {
    inserttext = prompt("Bitte Pfad zu Bild eingeben..."+"\n[img src=\"xxx\"]","");
    if ((inserttext != null) && (inserttext != "")) {
        theform.text.value += "[img src=\""+inserttext+"\"] ";
    }
    theform.text.focus();

}
// ********************************************

function popup_code(theform) {
    linktext = prompt("Bitte Text für das Bild eingeben...","");
    prompt_text = "Bitte den Pfad zum Bild eingeben...";
    prompt_contents = "...pfad... (bitte ersetzen!)";
    link = prompt(prompt_text,prompt_contents);
    if ((link != null) && (link != "")) {
        if ((linktext != null) && (linktext != ""))
            theform.text.value += "[POPUPIMG src=\""+link+"\"]"+linktext+"[/POPUPIMG] ";
        else
            theform.text.value += "[POPUPIMG src=\""+link+"\"]"+link+"[/POPUPIMG] ";
    }
    theform.text.focus();
}

// ********************************************
function open_image_window(x,y) {
    window.open("image_select.php", "images", "toolbar=no,scrollbars=yes,resizable=yes,width="+x+",height="+y);
}

function insert_image(img_path) {
    imgtype = document.forms["image_form"].elements["insert_type"].value;
    if (imgtype == "POPUPIMG") {
        linktext = prompt("Bitte Text für das Bild eingeben...","TEXT");
           if ((linktext != null) && (linktext != "")) {
               inserttext = "[POPUPIMG src=\""+img_path+"\"]"+linktext+"[/POPUPIMG] ";
           } else {
               inserttext = "[POPUPIMG src=\""+img_path+"\"]"+img_path+"[/POPUPIMG] ";
           }
    } else {
        inserttext = "[img src=\""+img_path+"\"] ";
    }

    opener.document.bc_trick_data.text.value += inserttext +"\n";
}