//________________________________________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_obj(mo_arg){
 if(typeof(mo_arg)=='object')return mo_arg;
 if(!document.getElementById)return FALSE;
 return document.getElementById(mo_arg);
 }
function mouse_in(){
 for (var i=0;i<mouse_in.arguments.length;++i){
  if(!(mo_obj=mouse_obj(mouse_in.arguments[i])))continue;
  if(!mo_obj.className)continue;
  if(0<mo_obj.className.indexOf("_hover"))continue;
  mo_obj.className=mo_obj.className+'_hover';
  }
 }
function mouse_out(){
 for (var i=0;i<mouse_out.arguments.length;++i){
  if(!(mo_obj=mouse_obj(mouse_out.arguments[i])))continue;
  if(!mo_obj.className)continue;
  if(0>(pos=mo_obj.className.indexOf("_hover")))continue;
  mo_obj.className=mo_obj.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 preview(res,ID,width,height){
   h = new Array(height + 56, height + 106);
   w = new Array(width + 16, width + 26);
   prev = window.open("","preview","width=" + w[0] + ",height=" + h[0] + ",left=100,top=100");
   prev.resizeTo(w[1], h[1]);
   prev.document.open();
   prev.document.writeln("<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.0 Strict\/\/EN\" \"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-strict.dtd\">\n");
   prev.document.writeln("<html>\n<head>\n<title>Vollbild<\/title>\n<\/head>\n<body style=\"margin: 8px;\">\n<div>\n");
   prev.document.writeln("<img src=\"view.php?" + res + "=" + ID + "\" alt=\"\" \/><br \/><br \/>\n");
   prev.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");
   prev.document.writeln("<\/div><\/body>\n<\/html>\n");
   prev.document.close();
   prev.focus();
   }
 function preview_flash(res,width,height,bgcol){
   h = new Array(height + 56, height + 106);
   w = new Array(width + 16, width + 26);
   prev = window.open("","preview","width=" + w[0] + ",height=" + h[0] + ",left=100,top=100");
   prev.resizeTo(w[1], h[1]);
   prev.document.open();
   prev.document.writeln("<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.0 Strict\/\/EN\" \"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-strict.dtd\">\n");
   prev.document.writeln("<html>\n<head>\n<title>Flashvorschau<\/title>\n<\/head>\n<body style=\"margin: 8px;\">\n<div>\n");
   prev.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");
   prev.document.writeln("<param name=\"movie\" value=\"" + res + "\" \/>\n");
   if(bgcol) prev.document.writeln("<param name=\"bgcolor\" value=\"" + bgcol + "\" \/>\n");
   else prev.document.writeln("<param name=\"wmode\" value=\"transparent\" \/>\n");
   prev.document.writeln("<param name=\"quality\" value=\"high\" \/>\n");
   prev.document.writeln("<param name=\"menu\" value=\"false\" \/>\n");
   prev.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");
   prev.document.writeln("<\/object>\n");
   prev.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");
   prev.document.writeln("<\/div>\n<\/body>");
   prev.document.close();
   prev.focus();
   }

//______________________________________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();
   }