/*

===============================================================================
============  Sie interessieren sich fuer den Quelltext von j-s-h? ============
===============================================================================

Bitte beachten Sie,

1. dass diese Website barrierefrei gestaltet wurde
   (d.h. ohne Tabellenlayouts, sondern mit XHTML und CSS,
    sowie erweiterter Unterstuetzung fuer Vorlesegeraete usw.), und

2. dass alles, was Sie hier lesen koennen, urheberrechtlich geschuetzt ist!


(c) j-s-h J. Sanchez-Haas. Alle Rechte vorbehalten.


  == Design + Programmierung: ==

      www.ZweiSteinSoft.de

    Webdesign + PC-Services
Webdesign-Service@ZweiSteinSoft.de

===============================================================================
===============================================================================




*/

// preload some images

window.setTimeout("preloadImages();",10000);

// detect framesets

if(top.location!=self.location)
   top.location =self.location;

// ##########################################################################

function preloadImages() {

    // preload some images

    preloadImage("img/contact_hover.gif");
    preloadImage("img/contact_pressed.gif");
    preloadImage("img/balloontip.gif");
    preloadImage("img/backRight.jpg");
    preloadImage("img/brunnen.jpg");
    preloadImage("img/gebaeude.jpg");
    preloadImage("img/hole_wall.jpg");
    preloadImage("img/Julia_Sanchez-Haas.jpg");
    preloadImage("img/kirche.jpg");
    preloadImage("img/coaching.jpg");
    preloadImage("img/netzwerk.jpg");
    preloadImage("img/rainbow.jpg");
    preloadImage("img/span_impressionen.jpg");
    preloadImage("img/stormsrivermouth.jpg");
    preloadImage("img/tunnel.jpg");
    preloadImage("img/willkommen.jpg");
    preloadImage("img/zebras.jpg");

}

// ##########################################################################

// Functions for centering the contents when page is loaded

function windowWidth()
{
 if (window.innerWidth) return window.innerWidth;
 else if (document.body && document.body.offsetWidth) return document.body.offsetWidth;
 else return 0;
}
function centerContents()
{
 if(document.getElementById){
     var width = windowWidth();
     var contentWidth = 770;

     if(width < contentWidth + 35) document.getElementById("wholepage").style.left = "2px";
     else document.getElementById("wholepage").style.left = ((width-contentWidth)/2)+"px";
     document.getElementById("wholepage").style.top = "5px";
 }
}

// ##########################################################################

function changeBackgroundImage(objectId,imageSrc) {

    // toggles the image source of the image corresponding to the imageId

    if(document.getElementById) {

        document.getElementById(objectId).style.backgroundImage = "url(" + imageSrc + ")";

    }
}

function toggleImage(imgId,imgSrc) {

    // toggles the image source of the given imgId

    if (document.getElementById) {
        document.getElementById(imgId).src = imgSrc;
    }
}

function preloadImage(imageSrc) {

    // preloads the image in imageSrc into the browser's cache

    if(document.images) {

        var image = new Image();
        image.src = imageSrc;

    }
}

// ##########################################################################

function formCheck() {

    // checks if all guestbook -> new_entry form fields are filled

    if(document.getElementById)
    {
        if(document.getElementById('txt_name').value == "") {
            document.getElementById('txt_name').focus();
            alert("Bitte geben Sie Ihren Namen ein.");
            return false; }
        if(document.getElementById('txt_mail').value == "") {
            document.getElementById('txt_mail').focus();
            alert("Bitte geben Sie Ihre eMail-Adresse ein.");
            return false; }
        if(document.getElementById('txt_mail').value.match
          (/^[a-z0-9]+([-|.|_][a-z0-9]+)*@(([a-z0-9]+([-|_][a-z0-9]+)*)+[.])+[a-z]{2}([a-z0-9]?){4}$/i)
           ==null) {
            document.getElementById('txt_mail').value="";
            document.getElementById('txt_mail').focus();
            alert("Bitte geben Sie Ihre gültige eMail-Adresse ein.");
            return false; }
        if(document.getElementById('txt_entry').value == "") {
            document.getElementById('txt_entry').focus();
            alert("Bitte geben Sie einen Text\nfür den Güstebuch-Eintrag ein.");
            return false; }
        else
            return true;
    }
}

// ##########################################################################

function formCheck2() {

    // checks if all contact form fields are filled

    if(document.getElementById)
    {
        if(document.getElementById('txt_text').value == "") {
            document.getElementById('txt_text').focus();
            alert("Bitte geben Sie Ihr Anliegen ein.");
            return false; }
        if(document.getElementById('txt_name').value == "") {
            document.getElementById('txt_name').focus();
            alert("Bitte geben Sie Ihren Namen ein.");
            return false; }
        if(document.getElementById('txt_mail').value == "") {
            document.getElementById('txt_mail').focus();
            alert("Bitte geben Sie Ihre eMail-Adresse ein.");
            return false; }
        if(document.getElementById('txt_mail').value.match
          (/^[a-z0-9]+([-|.|_][a-z0-9]+)*@(([a-z0-9]+([-|_][a-z0-9]+)*)+[.])+[a-z]{2}([a-z0-9]?){4}$/i)
           ==null) {
            document.getElementById('txt_mail').value="";
            document.getElementById('txt_mail').focus();
            alert("Bitte geben Sie Ihre gültige eMail-Adresse ein.");
            return false; }

        else
            return true;
    }
    return true;
}
// ##########################################################################

function loginFormCheck() {

    // checks if all login form fields are filled

    if(document.getElementById)
    {
        if(document.getElementById('txt_user').value == "") {
            document.getElementById('txt_user').focus();
            alert("Bitte geben Sie Ihren Benutzernamen ein.");
            return false; }
        if(document.getElementById('txt_password').value == "") {
            document.getElementById('txt_password').focus();
            alert("Bitte geben Sie Ihr Passwort ein.");
            return false; }
        else
            return true;
    }
    return true;
}

// ##########################################################################

function showPopup(popupFile,popupLeft,popupTop,popupWidth,popupHeight) {

    // shows a popup window

    var properties = "left=" + popupLeft + ",top=" + popupTop + ",toolbar=no,dependent=yes,";

    properties += "hotkeys=no,width=" + popupWidth + ",height=" + popupHeight + ",";
    properties += "scrollbars=yes";
    properties  = window.open(popupFile,"popup",properties);
}

// ##########################################################################

function setFocus(objectId) {

    // sets the focus to the object with the given id

    if(document.getElementById)
        document.getElementById(objectId).focus();

}

// ##########################################################################

function areaHide(areaName)
{
    if (document.getElementById)
    {
        document.getElementById(areaName).style.visibility = "hidden";
    }
}

function areaShow(areaName)
{
    if (document.getElementById)
    {
        document.getElementById(areaName).style.visibility = "visible";
    }
}
function areaHideBlock(areaName)
{
    if (document.getElementById)
    {
        document.getElementById(areaName).style.display = "none";
    }
}

function areaShowBlock(areaName)
{
    if (document.getElementById)
    {
        document.getElementById(areaName).style.display = "block";
    }
}
// ##########################################################################

// create timer for hiding submenu's
var subMenuTimer;

function startHiderTimer(areaName) {

    // starts a timer after which the specified area will be hidden

    subMenuTimer = window.setTimeout("areaHide('" + areaName + "');", 100);

}
function stopHiderTimer() {

    // stops the hiderTimer specified in the global var subMenuTimer

    if(subMenuTimer != -1) {
        window.clearTimeout(subMenuTimer);
        subMenuTimer = -1;
    }
}

if (location.hash && location.hash.substring(1, 2) == "/") {
    //location.replace(location.hash.substring(2));
    location.hash = '';
}

