

//===================================================================================
// help functions used often, in general
//===================================================================================
function show_id(id) {
        if (document.getElementById(id))
                document.getElementById(id).style.display="block";
        }
function hide_id(id) {
        if (document.getElementById(id))
                document.getElementById(id).style.display="none";
        }

// ======================================================
// preloadImages and swap functions
// ======================================================
function preloadImages() {
  var doc = document;
  var arg = preloadImages.arguments;
  if (doc.images){
          if (!doc.arr)         // if images not yet loaded
                doc.arr = new Array();
          var i, j = doc.arr.length;
        for (i = 0; i < arg.length; i++)
            if (arg[i].indexOf("#")!=0) {
                        doc.arr[j] = new Image;
                        doc.arr[j++].src = arg[i];
                        }
                }
        }

function swapImgRestore() { //v3.0
          var i,x,a=document.sr;
          for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)
                  x.src=x.oSrc;
        }

function findObj(n, d) { //v4.01
          var p,i,x;
        if (!d)
                d=document;
        if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document;
        n=n.substring(0,p);
        }
          if(!(x=d[n])&&d.all)
                x=d.all[n];
        for (i=0;!x&&i<d.forms.length;i++)
                x=d.forms[i][n];
          for(i=0;!x&&d.layers&&i<d.layers.length;i++)
                x=findObj(n,d.layers[i].document);
          if(!x && d.getElementById)
                x=d.getElementById(n);
        return x;
        }

function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments;
  document.sr=new Array;
  for (i=0;i<(a.length-2);i+=3)
        if ((x = findObj(a[i])) != null){
                document.sr[j++] = x;
                if (!x.oSrc)
                        x.oSrc = x.src;
                x.src=a[i+2];
                }
        }

// ======================================================
// opens window
// ======================================================
function openwin(name) {
var h=screen.availHeight-50;
var l=300;
var l=(screen.width-860)/2;
var att='dependent=yes,scrollbars=yes,resizable=yes,titlebar=no,status=no,left=' + l + ',screenX=' + l + ',top=0,screenY=0,width=760,height=' + h;
        x = window.open(name,null,att);
        x.focus();
        }

//===================================================================================
// types out text of id-element
//===================================================================================
function type_id(id) {
        new TypingText(document.getElementById(id), 50);
        document.getElementById(id).typingText.run();
        }

//===================================================================================
// variables and functions concerned with the display of text.
//===================================================================================
var left = 0;
var top = 0;
var width = 0;
var height = 0;
var first = 0;
var id_text = "";
var title = "";

function txt_appear (msg) {
        if (document.getElementById('l_lang'))
                hide_id('l_lang');
        if (document.getElementById('l_pic'))
                hide_id('l_pic');
        if (document.getElementById('l_pic_1'))
                hide_id('l_pic_1');
        if (document.getElementById('l_pic_2'))
                hide_id('l_pic_2');
        if (document.getElementById('l_pic_3'))
                hide_id('l_pic_3');
        if (document.getElementById('l_pic_4'))
                hide_id('l_pic_4');
        if (document.getElementById('i_info_1'))
                hide_id('i_info_1');
        if (document.getElementById('i_info_2'))
                hide_id('i_info_2');
        var lay = document.getElementById ('l_text');
         if (first != 0) {
                lay.style.top = top + "px";
                lay.style.left = left + "px";
                lay.style.width = width + "px";
                lay.style.height = height + "px";
                lay.style.display = "block";
                left -= 10;
                top -= 10;
                width += 20;
                height += 10;
                }
        else {
                first = 1;
                left = 268;
                top = 380;
                width = 10;
                height = 10;
                lay.style.top = top + "px";
                lay.style.left = left + "px";
                lay.style.width = width + "px";
                lay.style.height = height + "px";
                }
        if (width <= 770 && height <= 270)
                window.setTimeout("txt_appear('" + msg + "')",30);
        else {
                lay.style.top = top + "px";
                lay.style.left = left + "px";
                lay.style.width = 0 + "px";
                lay.style.height = 0 + "px";
                if (document.getElementById(id_text)) {
                        document.getElementById(id_text).style.display = "block";
                        document.getElementById(id_text).style.width=790 + "px";
                        document.getElementById(id_text).style.height=290 + "px";
                        }
                if (document.getElementById('n_close'))
                        document.getElementById('n_close').style.display = "block";
                if (document.getElementById('i_title_small')) {
                        title = document.getElementById('i_title_small').innerHTML;
                        document.getElementById('i_title_small').innerHTML = "<h1>" + title + " " + msg + "</h1>";
                        show_id('i_title_small');
                        type_id('i_title_small');
                        }
                if (document.getElementById('l_pic'))
                        document.getElementById('l_pic').style.display = "none";
                if (document.getElementById('l_logo'))
                        document.getElementById('l_logo').style.color="#CCCCCC";
                if (document.getElementById('i_title')) {
                        document.getElementById('i_title').style.display="none";
                        }
                first = 0;
                }
        }

function txt_hide() {
        if (document.getElementById('i_text_1')){
                hide_id('i_text_1');
                document.getElementById('i_text_1').style.width = 0;
                document.getElementById('i_text_1').style.height = 0;
                }
        if (document.getElementById('i_text_2')){
                hide_id('i_text_2');
                document.getElementById('i_text_2').style.width = 0;
                document.getElementById('i_text_2').style.height = 0;
                }
        if (document.getElementById('i_text_3')){
                hide_id('i_text_3');
                document.getElementById('i_text_3').style.width = 0;
                document.getElementById('i_text_3').style.height = 0;
                }
        if (document.getElementById('i_text_4')){
                hide_id('i_text_4');
                document.getElementById('i_text_4').style.width = 0;
                document.getElementById('i_text_4').style.height = 0;
                }
        if (document.getElementById('l_text'))        {
                document.getElementById('l_text').style.width = 0;
                document.getElementById('l_text').style.height = 0;
                hide_id('l_text');
                }
        if (document.getElementById('i_info_1'))
                show_id('i_info_1');
        if (document.getElementById('i_info_2'))
                show_id('i_info_2');
        if (document.getElementById('l_pic'))
                show_id('l_pic');

        if (document.getElementById('l_logo')) document.getElementById('l_logo').style.color="#FF6600";
        if (document.getElementById('n_close')) hide_id('n_close');
        if (document.getElementById('i_title'))
                        show_id('i_title');
        if (document.getElementById('i_title_small')) {
                        document.getElementById('i_title_small').innerHTML =  title;
                        hide_id('i_title_small');
                        }
        document.getElementsByTagName('body')[0].style.backgroundColor="#333333";
        document.getElementsByTagName('body')[0].style.backgroundImage="";
        }


// ======================================================
// special functions - to be transferred into the modules directly
// ======================================================
function show_web () {
show_id('l_pic_web');
hide_id('l_pic');
show_id('n_rule');
hide_id('n_design');
show_id('n_card_web');
hide_id('n_card');
show_id('n_impr_web');
hide_id('n_impr');
}

function hide_web () {
hide_id('l_pic_web');
show_id('l_pic');
hide_id('n_rule');
show_id('n_design');
hide_id('n_card_web');
show_id('n_card');
hide_id('n_impr_web');
show_id('n_impr');
}

function resize() {
        window.moveTo(0,0);
        if (document.all)
                window.resizeTo (screen.availWidth,screen.availHeight);
        else if (document.layers || document.getElementById) {
                if (window.outerHeight < screen.availHeight || window.outerWidth < screen.availWidth) {
                        window.outerHeight = screen.availHeight;
                        window.outerWidth = screen.availWidth;
                        }
                }
        }


// ======================================================
// opens contact form
// ======================================================
function open_contact(name) {
        var left = (screen.width - 800) / 2 - 6;
        var top = (screen.height - 400) / 2;
        var att = "titlebar=no, status=no, scrollbars=no, height=400, width=700, top=" + top + ", left=" + left + ", screenX = " + left+ ", screenY=" + top + ", scrollbars=no, resizable=no, dependent=yes";
        x = window.open(name,null,att);
        x.focus();
        }

// ======================================================
// check form data before sending informations
// ======================================================
function chk_form() {
        if(document.contact.zuname.value == ""){
                alert("Bitte geben Sie Ihren Namen an!");
                document.contact.zuname.focus();
                return false;
                }
        if(document.contact.opt[0].checked == false &&
                        document.contact.opt[1].checked == false &&
                        document.contact.opt[2].checked == false &&
                        document.contact.opt[3].checked == false &&
                        document.contact.text.value == "" &&
                        document.contact.tel.value == "") {
                alert("Bitte verraten Sie uns Ihr Anliegen!\nKlicken Sie auf eine der Checkboxen\noder schreiben Sie uns eine Nachricht.\nVielen Dank!");
                document.contact.text.focus();
                return false;
                }
        if(document.contact.email.value != "" && document.contact.email.value.indexOf('@') == -1) {
                alert("Ungültige E-Mail-Adresse! Bitte korrigieren Sie!");
                document.contact.email.focus();
                return false;
                }
        if(document.contact.email.value == "") {
                alert("Bitte geben Sie uns Ihre Mailadresse bekannt!");
                document.contact.email.focus();
                return false;
                }
        if(document.contact.opt[0].checked == true && document.contact.tel.value == "") {
                alert("Bitte Ihre Telefonnummer eintragen!");
                document.contact.text.focus();
                return false;
                }
        }
