function galerie(text_id) {
	fenster=window.open('/galerie.php?text_id=' + text_id, 'Galerie', 'scrollbars=0,height=665,width=900,resizable=0,location=0,directories=0,status=0,menubar=0,toolbar=0');
	if (window.focus) {fenster.focus()}
};

function popup(id) {
	fenster=window.open('/popup.php?id=' + id, 'Popup', 'scrollbars=0,left=0,top=0,height=500,width=550,resizable=0,location=0,directories=0,status=0,menubar=0,toolbar=0');
	if (window.focus) {fenster.focus()}
};

function buchung(reise_id, datum, zustieg) {
	window.open('/buchung.php?reise_id=' + reise_id + '&datum=' + datum + '&zustieg=' + zustieg, 'Buchung', 'scrollbars=0,left=0,top=0,height=600,width=900,resizable=0,location=0,directories=0,status=0,menubar=0,toolbar=0');
};

function video(id) {
	fenster=window.open('/video.php?id=' + id, 'Video', 'scrollbars=0,left=0,top=0,height=630,width=665,resizable=0,location=0,directories=0,status=0,menubar=0,toolbar=0');
	if (window.focus) {fenster.focus()}
}

function formular_senden(formular, status, id, feld) {
 form=document.forms[formular];
 form.aktion.value=status;
 form.id.value=id;
 form.feld.value=feld;
 form.submit();
}

function maps(region) {
	window.open('http://www.scandtrack.com/gmaps/index.php?region=' + region, 'Kartendarstellung', 'scrollbars=0,left=0,top=0,height=600,width=900,resizable=0,location=0,directories=0,status=0,menubar=0,toolbar=0');
};

function formatierung_einfuegen(formular, element, aTag, eTag) {
  var input = document.forms[formular].elements[element];
  input.focus();
  /* für Internet Explorer */
  if(typeof document.selection != 'undefined') {
    /* Einfügen des Formatierungscodes */
    var range = document.selection.createRange();
    var insText = range.text;
    range.text = aTag + insText + eTag;
    /* Anpassen der Cursorposition */
    range = document.selection.createRange();
    if (insText.length == 0) {
      range.move('character', -eTag.length);
    } else {
      range.moveStart('character', aTag.length + insText.length + eTag.length);
    }
    range.select();
  }
  /* für neuere auf Gecko basierende Browser */
  else if(typeof input.selectionStart != 'undefined')
  {
    /* Einfügen des Formatierungscodes */
    var start = input.selectionStart;
    var end = input.selectionEnd;
    var insText = input.value.substring(start, end);
    input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
    /* Anpassen der Cursorposition */
    var pos;
    if (insText.length == 0) {
      pos = start + aTag.length;
    } else {
      pos = start + aTag.length + insText.length + eTag.length;
    }
    input.selectionStart = pos;
    input.selectionEnd = pos;
  }
  /* für die übrigen Browser */
  else
  {
    /* Abfrage der Einfügeposition */
    var pos;
    var re = new RegExp('^[0-9]{0,3}$');
    while(!re.test(pos)) {
      pos = prompt("Einfügen an Position (0.." + input.value.length + "):", "0");
    }
    if(pos > input.value.length) {
      pos = input.value.length;
    }
    /* Einfügen des Formatierungscodes */
    var insText = prompt("Bitte geben Sie den zu formatierenden Text ein:");
    input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos);
  }
};

function download_pdf(link, version, neu, projekt) {
  window.open('http://download.scandtrack.com/pdf.php?link=' + link + '&version=' + eval(version + "+" + neu), 'pdf_anzeigen', 'scrollbars=0,height=10,width=400,resizable=1,top=200,left=' + (screen.width-400)/2);
  if (neu == 1) {
   var fenster_drucken=window.open('http://download.scandtrack.com/pdf_erstellen.php?link=' + link + '&version=' + version + '&projekt=' + projekt, 'pdf_erstellen', 'height=50,width=50,top=0,left=0');
   fenster_drucken.window.hide;
/*   fenster_drucken.window.setTimeout("self.window.close()", 500);*/
/*   fenster_drucken.window.setTimeout("", 500);
   fenster_drucken.window.close();*/
  }
}



function popup_mouseover(code, event) {
 /*Mausposition ermitteln*/
 var mousex
 var mousey;
 var body = (window.document.compatMode && window.document.compatMode == "CSS1Compat") ?
 window.document.documentElement : window.document.body || null;

 mousey = event.pageY ? event.pageY : event.clientY + body.scrollTop;
 mousex = event.pageX ? event.pageX : event.clientX + body.scrollLeft;
 mousey = mousey - 0;
 mousex = mousex + 10;
 document.getElementById(code).style.top = mousey + "px";
 document.getElementById(code).style.left = mousex + "px";
 document.getElementById(code).style.visibility = "visible";
}

function popup_mouseout(code) {
 document.getElementById(code).style.visibility = "hidden";
}


function tabelle_ausblenden(ebene1) {
 for (var i = 0;i < document.getElementsByName('zeile_' + ebene1).length; i++) {
  document.getElementsByName('zeile_' + ebene1)[i].style.display = "none";
 }
}

function tabelle_einblenden(ebene1) {
 for (var i = 0;i < document.getElementsByName('zeile_' + ebene1).length; i++) {
  document.getElementsByName('zeile_' + ebene1)[i].style.display = "";
 }
}                                                                
