//________________________________________Common________________________________

 function go2(link) {
   location.href = link;
   }
 function externalLinks() {
   if (!document.getElementsByTagName) return;
   var anchors = document.getElementsByTagName("a");
   for (var i=0; i<anchors.length; i++) {
     var anchor = anchors[i];
     if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
       anchor.target = "_blank";
     }
   }
 window.onload = externalLinks;

//_______________________________________Mouse-Over_____________________________

 function mouse_in(button){
   if (!document.getElementById) return;
   myLayer=document.getElementById(button);
   if(!myLayer.className) return;
   if(myLayer.className) myLayer.className=myLayer.className + '_hover';
   }

 function mouse_out(button){
   if (!document.getElementById) return;
   myLayer=document.getElementById(button);
   if(!myLayer.className) return;
   var pos = myLayer.className.indexOf("_hover");
   if(!pos) return;
   if(myLayer.className) myLayer.className=myLayer.className.substring(0, pos);
   }

//________________________________________Layers________________________________

 function hide_select(){
   if (navigator.appName != 'Microsoft Internet Explorer') return;
   for (var i = 0; i < document.forms[0].length; ++i) {
     if(document.forms[0].elements[i].type != "select-one") continue;
     document.forms[0].elements[i].style.visibility = 'hidden';
     }
   }

 function show_select(){
   if (navigator.appName != 'Microsoft Internet Explorer') return;
   for (var i = 0; i < document.forms[0].length; ++i) {
     if(document.forms[0].elements[i].type != "select-one") continue;
     document.forms[0].elements[i].style.visibility = 'visible';
     }
   }

//________________________________________Checkboxes____________________________

 function setboxes(table, state){
   for (var i = 0; i < document.forms[0].length; ++i) {
     if(document.forms[0].elements[i].type != "checkbox") continue;
     if(table == 'multiple') match = eval('/_selected/');
     else var match = eval('/^' + table + '_selected/');
     if(document.forms[0].elements[i].name.match(match))
     document.forms[0].elements[i].checked = state;
     }
   }

//________________________________________BCode_________________________________

 var field = "";
 function storeCaret(input) {
   field = eval('document.forms[0].' + input);
   if (field.createTextRange) field.caretPos = document.selection.createRange().duplicate();
   }
 function unsetcode() {
   if(!field){
     alert("Bitte erst markieren");
     return;
     }
   // IE
   if(field.caretPos) {
     field.caretPos.text = field.caretPos.text.replace(/\[[^\]]+\]/g, "");
     return;
     }
   // Gecko
   if(typeof field.selectionStart != 'undefined') {
     var startpos = field.selectionStart;
     var endpos = field.selectionEnd;
     var area = field.value.substring(startpos, endpos);
     area = area.replace(/\[[^\]]+\]/g, "");
     field.value = field.value.substr(0, startpos) + area + field.value.substr(endpos);
     return;
     }
   // Other
   field.value = field.value.replace(/\[[^\]]+\]/g, "");
   }
 function setcode(text,block) {
   if(!field){
     alert("Bitte erst den Cursor platzieren");
     return;
     }
   var bcode = text.split("=");
   var start = "[" + text + "]";
   var end =  "[/" + bcode[0] + "]";
   if(block){
     start = start + '\n';
     end = '\n' + end;
     }
   insert(start,end);
   }
 function setcode_(text) {
   if(!field){
     alert("Bitte erst den Cursor platzieren");
     return;
     }
   text = "[" + text + "]";
   insert(text,'');
   }
 function insert(start,end) {
  field.focus();
  // IE
  if(field.caretPos) {
    field.caretPos.text = start + field.caretPos.text + end;
    return;
    }
  // Gecko
  if(typeof field.selectionStart != 'undefined') {
    var startpos = field.selectionStart;
    var endpos = field.selectionEnd;
    var area = field.value.substring(startpos, endpos);
    field.value = field.value.substr(0, startpos) + start + area + end + field.value.substr(endpos);
    // Cursorposition
    var pos;
    if (area.length == 0) pos = startpos + start.length;
    else pos = startpos + start.length + area.length + end.length;
    field.selectionStart = pos;
    field.selectionEnd = pos;
    return;
    }
  // Other
  field.value = field.value + start + end;
  }

//______________________________________Preview_________________________________

 function prev_pic(ID,width,height){
   width = width + 20;
   height = height + 60;
   pic = window.open("","","width=" + width + ",height=" + height + ",left=100,top=100");
   pic.document.open();
   pic.document.writeln("<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.0 Strict\/\/EN\" \"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-strict.dtd\">\n");
   pic.document.writeln("<html>\n<head>\n<title>Bildvorschau<\/title>\n<\/head>\n<body>\n<div>\n");
   pic.document.writeln("<img src=\"pic.php?PIC=" + ID + "\" \/><br \/><br \/>\n");
   pic.document.writeln("<div style=\"text-align: right; font-family: arial; font-size: 10px;\"><a style=\"text-decoration: none; color: #000000;\" href=\"javascript:self.close();\">[schließen]<\/a><\/div>\n");
   pic.document.writeln("<\/div><\/body>\n<\/html>\n");
   pic.document.close();
   }
 function prev_flash(res,width,height,bgcol){
   var f_width = width + 20; var f_height = height + 60;
   pic = window.open("","","width=" + f_width + ",height=" + f_height + ",left=100,top=100");
   pic.document.open();
   pic.document.writeln("<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.0 Strict\/\/EN\" \"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-strict.dtd\">\n");
   pic.document.writeln("<html>\n<head>\n<title>Flashvorschau<\/title>\n<\/head>\n<body>\n<div>\n");
   pic.document.writeln("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=6,0,40,0\" width=\"" + width + "\" height=\"" + height + "\">\n");
   pic.document.writeln("<param name=\"movie\" value=\"" + res + "\">\n");
   if(bgcol) pic.document.writeln("<param name=\"bgcolor\" value=\"" + bgcol + "\">\n");
   else pic.document.writeln("<param name=\"wmode\" value=\"transparent\">\n");
   pic.document.writeln("<param name=\"quality\" value=\"high\">\n");
   pic.document.writeln("<param name=\"menu\" value=\"false\">\n");
   pic.document.writeln("<embed src=\"" + res + "\" " + (bgcol?"bgcolor=\"" + bgcol + "\"" : "wmode=\"transparent\"") + " width=\"" + width + "\" height=\"" + height + "\" quality=\"high\" menu=\"false\" type=\"application\/x-shockwave-flash\" pluginspage=\"http:\/\/www.macromedia.com\/go\/getflashplayer\/\"><\/embed>\n");
   pic.document.writeln("<\/object>\n");
   pic.document.writeln("<div style=\"text-align: right; font-family: arial; font-size: 10px;\"><a style=\"text-decoration: none; color: #000000;\" href=\"javascript:self.close();\">[schließen]<\/a><\/div>\n");
   pic.document.writeln("<\/div>\n<\/body>");
   pic.document.close();
   }
 function prev_mpdrei(res){
   pic = window.open("","","width=220,height=20,left=100,top=100");
   pic.document.open();
   pic.document.writeln("<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.0 Strict\/\/EN\" \"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-strict.dtd\">\n");
   pic.document.writeln("<html>\n<head>\n<title>MP3-Vorschau<\/title>\n<\/head>\n<body>\n<div>\n");
   pic.document.writeln("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http:\/\/fpdownload.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=7,0,0,0\" width=\"200\" height=\"20\" id=\"dewplayer\" align=\"middle\">\n");
   pic.document.writeln("<param name=\"allowScriptAccess\" value=\"sameDomain\" \/>\n");
   pic.document.writeln("<param name=\"movie\" value=\"dewplayer.swf?son=" + res + "&amp;autostart=1&amp;bgcolor=FFFFFF\" \/>\n");
   pic.document.writeln("<param name=\"quality\" value=\"high\" \/>\n");
   pic.document.writeln("<param name=\"bgcolor\" value=\"FFFFFF\" \/>\n");
   pic.document.writeln("<embed src=\"dewplayer.swf?son=" + res + "&amp;autostart=1&amp;bgcolor=FFFFFF\" quality=\"high\" bgcolor=\"FFFFFF\" width=\"200\" height=\"20\" name=\"dewplayer\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application\/x-shockwave-flash\" pluginspage=\"http:\/\/www.macromedia.com\/go\/getflashplayer\" \/>\n");
   pic.document.writeln("<\/object>\n");
   pic.document.writeln("<div style=\"text-align: right; font-family: arial; font-size: 10px;\"><a style=\"text-decoration: none; color: #000000;\" href=\"javascript:self.close();\">[schließen]<\/a><\/div>\n");
   pic.document.writeln("<\/div>\n<\/body>");
   pic.document.close();
   }

//______________________________________Picdate_________________________________

 function picdate(target){
   var ziel = eval('document.forms[0].' + target);
   pdate = ziel.value;
   pd = window.open("picdate.php?target=" + target + "&pdate=" + pdate, "pd" ,"width=130,height=170,left=100,top=200");
   pd.focus();
   }
 function setdate(sdate,win,target) {
   var ziel = eval('document.forms[0].' + target);
   ziel.value = sdate;
   if(target == 'startdate' && document.forms[0].enddate)
   document.forms[0].enddate.value = sdate;
   win.close();
   }

//______________________________________Info____________________________________

 function helpfix(){
   if (!document.getElementById) return;
   myLayer = document.getElementById('help');
   document.forms[0].help_x.value = myLayer.style.left;
   document.forms[0].help_y.value = myLayer.style.top;
   document.forms[0].help_fix.value = "true";
   document.forms[0].submit();
   }

 function helpclose(){
   document.forms[0].help_fix.value = "false";
   document.forms[0].submit();
   }
 function help(topic){
   document.forms[0].help_fix.value = "true";
   document.forms[0].help_topic.value = topic;
   document.forms[0].submit();
   }