// CONFIG
var d = document;
  function initPage()
  {
  // trans layer
    setOpacity('trans', 60)
  // blur onfocus
    var tag = document.getElementsByTagName("a");
    for(i=0;i<tag.length;i++)
      tag[i].onfocus= function(){this.blur();};

  // init CSS-Styles
    var tag = d.getElementsByTagName("input");
    for(i=0;i<tag.length;i++)
    {
      if((tag[i].type == 'text' || tag[i].type == 'password') && tag[i].className != 'login')
      {
        tag[i].onfocus     = function(){ this.className = 'inputField_focus'; };
        tag[i].onmouseover = function(){ this.className = 'inputField_hover'; };
        tag[i].onmouseout  = function(){ this.className = 'inputField'; };
        tag[i].onblur      = function(){ this.className = 'inputField'; };
      }
    }
    var tag = d.getElementsByTagName("textarea");
    for(i=0;i<tag.length;i++)
    {
      tag[i].onfocus     = function(){ this.className = 'inputField_focus'; };
      tag[i].onmouseover = function(){ this.className = 'inputField_hover'; };
      tag[i].onmouseout  = function(){ this.className = 'inputField'; };
      tag[i].onblur      = function(){ this.className = 'inputField'; };
    }
  }
// TOOLS
  function empty(str)
  {
    if(str == '') return true;
  }
  
// POPUP
  function popup(obj)
  {
    url = obj.href;
    breite = 500; hoehe = 500;
    links = (screen.width/2)-(breite/2);
    oben = (screen.height/2)-(hoehe/2);
    
    window.open(url,"popup","height="+hoehe+",width="+breite+",status = no,toolbar = no,menubar = no,location = no,resizable = no,titlebar = no,scrollbars = no,fullscreen = no,top ="+oben+",left ="+links);
    return false;
  }
  
  function winOpen(url, breite, hoehe)
  {
    links = (screen.width/2)-(breite/2);
    oben = (screen.height/2)-(hoehe/2);
    window.open(url,"popup","height="+hoehe+",width="+breite+",status = no,toolbar = no,menubar = no,location = no,resizable = no,titlebar = no,scrollbars = no,fullscreen = no,top ="+oben+",left ="+links);
   } 

// get Files
  function getProduct(obj)
  {
    breite = 650; hoehe = 590;
    links = (screen.width/2)-(breite/2);
    oben = (screen.height/2)-(hoehe/2);
    
    window.open(baseURL + '/preview.php?' + obj.href,"popup","height="+hoehe+",width="+breite+",status = no,toolbar = no,menubar = no,location = no,resizable = no,titlebar = no,scrollbars = no,fullscreen = no,top ="+oben+",left ="+links);
    
    return false;
  }
  
  function hideTransLayer()
  {
    d.getElementById('ajax').innerHTML = '&nbsp;';
    d.getElementById('ajax').style.display = 'none';
    d.getElementById('trans').innerHTML = '&nbsp;';
    d.getElementById('trans').style.display = 'none';
  }
  
// AJAX
  var ajax = (window.ActiveXObject) ?  new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  function Ajax(file)
  {
    ajax.open('GET', file, false);
    ajax.send(null);
    
    return ajax.responseText;
  }
// SET OPACITY
  function setOpacity(objID, opacity)
  {
    var obj = d.getElementById(objID);
        obj.style.filter       = "alpha(opacity:"+opacity+")";
        obj.style.KHTMLOpacity = opacity/100;
        obj.style.MozOpacity   = opacity/100;
        obj.style.opacity      = opacity/100;
  }

// TOGGLE SELECT
  function toggleSelect(obj)
  {
    var display = obj.getElementsByTagName('div')[0].style.display;
    obj.getElementsByTagName('div')[0].style.display = (display == 'block') ? 'none' : 'block';
  }

// BOOKMARK
   function bookmark()
   {
     title = d.getElementsByTagName('head')[0].getElementsByTagName('title')[0].innerHTML; 
     url = d.location.href;

  	if(window.sidebar)                    window.sidebar.addPanel(title, url,"");
  	else if( window.external )            window.external.AddFavorite(url, title);
  	else if(window.opera && window.print) return true;
   }

// NAVIGATIOn
  function initNavigation()
  {
    var img = new Array();
    var tags = d.getElementById('header-navigation').getElementsByTagName('a');
    for(var i=0;i<tags.length;i++)
    {
      img[i] = new Image();
      img[i].src = tags[i].firstChild.src.replace(/\.jpg/g, '_hover.jpg');
      
      tags[i].onmouseover = function() {
        this.firstChild.src = this.firstChild.src.replace(/\.jpg/g, '_hover.jpg');
      };
      tags[i].onmouseout = function() {
        this.firstChild.src = this.firstChild.src.replace(/\_hover\.jpg/g, '.jpg');
      };
    }
  }
// ADD FLASH
  function addFlash()
  {    
    var ret        = new Object();
    ret.embedAttrs = new Object();
    ret.params     = new Object();
    ret.objAttrs   = new Object();

    for (var i=0; i < arguments.length; i=i+2)
    {
      ret.objAttrs[arguments[i]]   = arguments[i+1];
      ret.embedAttrs[arguments[i]] = ret.params[arguments[i]] = arguments[i+1];
      ret.params[arguments[i]]     = arguments[i+1];
    }

    ret.objAttrs['classid'] = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
    ret.embedAttrs['type']  = 'application/x-shockwave-flash';

    var str = '<object ';
    for(var i in ret.objAttrs)   str += i + '="' + ret.objAttrs[i] + '" '; str += '>';
    for(var i in ret.params)     str += '<param name="' + i + '" value="' + ret.params[i] + '" /> ';  str += '<embed ';
    for(var i in ret.embedAttrs) str += i + '="' + ret.embedAttrs[i] + '" '; str += ' ></embed></object>';

    document.write(str);
  }

// ADD EVENT
  function addEvent(obj, evType, fn)
  {
    if(obj.addEventListener)
    {
      obj.addEventListener(evType, fn, false);
     return true;
    } else if (obj.attachEvent){
      var r = obj.attachEvent("on"+evType, fn);
      return r;
    } else return false;
  }

addEvent(window,'load',initPage);

