/*
 * Site Javascript
 *
 * eigene JavaScript Funktionen der Webseite
 *
 */

// ###### Konstanten ######

// Verzeichnis mit HTML Vorlagen.
var DIV_CONTENT_DIR = "div_content/"

/*
 *
 * Ersetzt den Content des eines <div> durch eine den Inhalt einer HTML Datei
 *
 * Parameter:
 *   file: Name der html Datei.
 *   target_div:   ID des <div> das ersetzt werden soll.
 */
 function replace_content(file, target_div) {

        file_content = load_file(DIV_CONTENT_DIR + file);

        document.getElementById(target_div).innerHTML = file_content;

 }

 /*
 *
 * Ersetzt den Content des eines <div> durch eine den Inhalt einer HTML Datei
 *
 * Parameter:
 *   file: Name der html Datei.
 *   target_div:   ID des <div> das ersetzt werden soll.
 */
 function replace_gallery_content(file, target_div) {


        file_content = load_file(file);

        document.getElementById(target_div).innerHTML = file_content;
        document.getElementById(target_div).replace;

 }

function replace_nav_text(text, picture, target_div) {
    div_content = "<a href=\"#\" onMouseOut=\"clear_nav_text('" + text + "','" + picture + "','" + target_div + "');\"><img src=\"./images/icons/" + picture + "\"></a><h3>" + text + "</h3>"
        document.getElementById(target_div).replace = div_content;
        new Effect.Shake(target_div, { duration: 0.5 });
 }

 function clear_nav_text(text,picture,target_div) {
    div_content = "<a href=\"#\" onMouseOver=\"replace_nav_text('" + text + "','" + picture + "','" + target_div + "');\"><img src=\"./images/icons/" + picture + "\"></a>"
        document.getElementById(target_div).replace = div_content;
        new Effect.Pulsate(target_div, { duration: 0.5 });
 }

 /*
  *  Datei laden
  *
  *  TODO: prüfen ob IE unterstützugn vorhanden ist. XMLHttpRequest vs. ActiveXObject.
  *  TODO: exceptions fangen.
  */
 function load_file(url) {

try {
   req = new ActiveXObject("Microsoft.XMLHTTP");    // Trying Internet Explorer
}
catch(e)    // Failed
{
  req = new XMLHttpRequest()
}

        req.open("GET", url,true);
        req.send(null);

        return req.responseText;

 }

 /*
  *  Navigations Dekoration
  */
function decorate_nav_link(text){

}

function video_2() {
        $('video_gallery_content').innerHTML = "<object width=\"315\" height=\"234\"><param name=\"movie\" value=\"http://www.youtube.com/v/FNRad6LgIaw&hl=de&fs=1\"></param><param name=\"allowFullScreen\" value=\"true\"></param><embed src=\"http://www.youtube.com/v/FNRad6LgIaw&hl=de&fs=1\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" width=\"315\" height=\"234\"></embed></object>";
}

function video_3() {
        $('video_gallery_content').innerHTML = "<object width=\"315\" height=\"234\"><param name=\"movie\" value=\"http://www.youtube.com/v/BISLV4-BYW4&hl=de&fs=1\"></param><param name=\"allowFullScreen\" value=\"true\"></param><embed src=\"http://www.youtube.com/v/BISLV4-BYW4&hl=de&fs=1\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" width=\"315\" height=\"234\"></embed></object>";
}


function live_gallery() {

$('photo_gallery_aj').innerHTML = "<a href=\"images/gallery/02_live/live_1.JPG\" rel=\"lytebox[live]\" title=\"\"><img src=\"images/gallery/02_live/live_1_thumb.jpg\"></a><a href=\"images/gallery/02_live/live_2.JPG\" rel=\"lytebox[live]\" title=\"\"><img src=\"images/gallery/02_live/live_2_thumb.jpg\"></a><a href=\"images/gallery/02_live/live_3.JPG\" rel=\"lytebox[live]\" title=\"\"><img src=\"images/gallery/02_live/live_3_thumb.jpg\"></a><a href=\"images/gallery/02_live/live_4.JPG\" rel=\"lytebox[live]\" title=\"\"><img src=\"images/gallery/02_live/live_4_thumb.jpg\"></a><a href=\"images/gallery/02_live/live_5.JPG\" rel=\"lytebox[live]\" title=\"\"><img src=\"images/gallery/02_live/live_5_thumb.jpg\"></a><a href=\"images/gallery/02_live/live_6.JPG\" rel=\"lytebox[live]\" title=\"\"><img src=\"images/gallery/02_live/live_6_thumb.jpg\"></a><a href=\"images/gallery/02_live/live_7.JPG\" rel=\"lytebox[live]\" title=\"\"><img src=\"images/gallery/02_live/live_7_thumb.jpg\"></a><a href=\"images/gallery/02_live/live_8.JPG\" rel=\"lytebox[live]\" title=\"\"><img src=\"images/gallery/02_live/live_8_thumb.jpg\"></a><a href=\"images/gallery/02_live/live_9.JPG\" rel=\"lytebox[live]\" title=\"\"><img src=\"images/gallery/02_live/live_9_thumb.jpg\"></a><br clear=\"all\"><div id=\"gallery_back\"><h3><a href=\"photo.html\">>> zur presse gallery</a></h3></div>";
}
