/*****************************************/
/*  Copyright (c)2010                    */
/*****************************************/

window.onerror = function(message,url,srcLine){return true;}

var        ifImg = document.images         ? true:false,
           ifAll = document.all            ? true:false,
           ifDom = document.getElementById ? true:false,
         ifLayer = document.layers         ? true:false,
      isNetscape = navigator.appName.indexOf('Netscape') >= 0 ? true:false,
         isOpera = navigator.userAgent.indexOf('Opera')  >= 0 ? true:false,

        ready2go = false,
          isLoad = false,
        aktImgNr = 0,
            elem = 1,
             tmp = null,
           smils = new Array (":-)",";-)","8-)",":-D","::i","!!!","???",":-(",":-o",":((","$-)","::!"),

           ltObj = null,
         ltWidth = 0,
        ltFaktor = 1,
          ltTime = 30,
         ltPause = 400,
     ltBodyWidth = 227,
           ltPos = 300,

           mausX = 0,
           mausY = 0,
        frmWidth = 0,
       frmHeight = 0,
         frmOfsX = 0,
         frmOfsY = 0,
              iW = 0,
              iH = 0,

        infoShow = false,
         infoDiv = null,
    infoDivStyle = null,
      infoHeight = 0,
       infoWidth = 0,
    iDivWidthAdd = 2,
    scrollBarsPx = 25,
      infoOfsetX = 5,
      infoOfsetY = 25,
   infoDivDesign = new Array('<table cellspacing="0" cellpadding="1" border="0"><tr><td class="infoBoxBorder"><div id="infoBoxDim"><table cellspacing="0" cellpadding="1" border="0"><tr>','<td class="infoBoxTitle" nowrap="nowrap">','</td></tr><tr>','<td class="infoBoxTxt" nowrap="nowrap">','</td></tr></table></div></td></tr></table>');

var pre1 = new Image(); pre1.src = 'img/logo.gif';
var pre2 = new Image(); pre2.src = 'img/tattoo.gif';
var pre3 = new Image(); pre3.src = 'img/dracheTop.gif';
var pre4 = new Image(); pre4.src = 'img/dracheBottomAni.gif';
var pre5 = new Image(); pre5.src = 'img/lineTop.gif';
var pre6 = new Image(); pre6.src = 'img/lineButtom.gif';
var pre7 = new Image(); pre7.src = 'img/1px.gif';

var pre28 = new Image(); pre28.src = 'img/dracheOver.gif';

var pre29 = new Image(); pre29.src = 'img/e1.gif';
var pre30 = new Image(); pre30.src = 'img/e2.gif';
var pre31 = new Image(); pre31.src = 'img/e3.gif';
var pre32 = new Image(); pre32.src = 'img/e4.gif';

window.defaultStatus='Tattoowina';

if(screen.width<1000||screen.height<700) alert('Willkommen bei Tattoowina\n\nBitte stellen sie eine Bildschirmauflösung von mid. 1024x768 ein.\nMit Ihrer aktuellen Auflösungen kann unsere Seite leider nicht vollständig angezeigt werden.\n\nIhr Tattoowina Team.');

if(document.layers) alert('Willkommen bei Tattoowina\n\nUnsere Seiten unterstützen leider Ihren Browser (Netscape 4) nicht.\nBitte benutzen Sie den Microsoft Internet Explorer ab Version 4 oder kompatible.\n\nIhr Tattoowina Team.');

//-----------------------------------------------------------------------------------
function imgPopUp(imgName,w,h,x,y){
 w=(w<100)?100:w;h=(h<100)?100:h;
 x=(x==0?Math.round(screen.width/2-w/2):x);
 y=(y==0?Math.round((screen.height/2-20)-h/2):y);
 var imgWin = null, param = 'width='+w+',height='+h+',top='+y+',left='+x+',location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no';
 imgWin=window.open('','dummy',param);
 imgWin.document.open();
 imgWin.document.write('<html><head><title>Tattoowina</title></head><body onblur="window.close()" onDragstart="return false" onSelectstart="return false" onContextmenu="return false" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0"><img galleryimg="no" src="'+imgName+'" name="showImg" width="'+w+'" height="'+h+'" alt=""></body></html>');
 imgWin.document.close();
 imgWin.document.showImg.src = imgName;
 imgWin.focus();
}

//-----------------------------------------------------------------------------------
function imgOver(nr,o) {
 if(!isLoad || nr==aktImgNr) return true;
 window.status= o ? 'ZOOM':'';
 obj = ( ifDom ? document.getElementById('t'+nr) : document.all['t'+nr]);
 obj.className = 'galTD'+o;
 return true;
}

//-----------------------------------------------------------------------------------
function imgCl(nr,imgName,w,h,x,y) {
 if(!isLoad) return false;
 if(aktImgNr){
   obj = ( ifDom ? document.getElementById('t'+aktImgNr) : document.all['t'+aktImgNr]);
   obj.className = 'galTD0';
 }
 aktImgNr=nr;
 obj = ( ifDom ? document.getElementById('t'+nr) : document.all['t'+nr]);
 obj.className = 'galTD2';
 imgPopUp(imgName,w,h,x,y);
 return false;
}

//-----------------------------------------------------------------------------------
function setElem(n){
 elem=n;
}

//-----------------------------------------------------------------------------------
function setSmile(n){
 if(!isLoad) return false;
 tmp = elem ? document.art.text : document.art.titel;
 tmp.value += ' '+smils[n]+' ';
 tmp.focus();
 return false;
}

//-----------------------------------------------------------------------------------
function getFrmDim() {
 frmWidth  = isOpera || isNetscape ? window.innerWidth  : document.body.offsetWidth;
 frmHeight = isOpera || isNetscape ? window.innerHeight : document.body.offsetHeight;
 frmOfsX = isOpera || isNetscape ? window.pageXOffset : document.body.scrollLeft;
 frmOfsY = isOpera || isNetscape ? window.pageYOffset : document.body.scrollTop;
}

//-----------------------------------------------------------------------------------
function laufTextInit() {
 ltObj   = ifLayer ? document.layers[ 'ltBody' ].document.layers[ 'lt' ] :
           ( ifDom ? document.getElementById('lt').style : document.all['lt'].style );
 ltWidth = ifLayer ? self.document.layers['ltBody'].document.layers['lt'].document.width :
           ( ifDom ? document.getElementById('lt').offsetWidth : document.all['lt'].offsetWidth );
 if(ltWidth){
   ltObj.visibility=(ifLayer?'show':'visible');
   ltAni();
 }
}

//-----------------------------------------------------------------------------------
function ltAni() {
 ltPos-=ltFaktor;
 if(ltPos<-ltWidth)ltPos=ltBodyWidth+ltPause;
 ltObj.left = ltPos;
 window.setTimeout('ltAni()',ltTime);
}

//-----------------------------------------------------------------------------------
function infoDivMove(e) {
 if(infoShow){
      e = window.Event && !isOpera ? e : window.event;
  mausX = window.Event && !isOpera ? e.pageX : e.clientX;
  mausY = window.Event && !isOpera ? e.pageY : e.clientY;
  mausX = isNetscape ? mausX : (mausX + document.body.scrollLeft);
  mausY = isNetscape ? mausY : (mausY + document.body.scrollTop);
  if(infoShow) infoDivStyle.left = ( ( ( ( (mausX + infoOfsetX + scrollBarsPx + infoWidth) > (frmOfsX + frmWidth) ) && ( (mausX - frmOfsX) > (frmOfsX + frmWidth - mausX) ) ) ? ( (mausX - infoOfsetX - infoWidth) > frmOfsX ? (mausX - infoOfsetX - infoWidth) : frmOfsX ) : ( (mausX + infoOfsetX + infoWidth) > (frmOfsX + frmWidth - scrollBarsPx) ? (frmOfsX + frmWidth - infoWidth - scrollBarsPx) : (mausX + infoOfsetX) ) ) + (ifLayer?'':'px') );
  if(infoShow) infoDivStyle.top = ( ( ( ( (mausY + infoOfsetY + scrollBarsPx + infoHeight) > (frmOfsY + frmHeight) ) && ( (mausY - frmOfsY) > (frmOfsY + frmHeight - mausY) ) ) ? (mausY - infoOfsetY - infoHeight) : (mausY + infoOfsetY) ) + (ifLayer?'':'px') );
 }
}

//-----------------------------------------------------------------------------------
function iBox(title,text,status) {
 if(!ready2go) return false;
 var range = null,
      cont = null,
       str = infoDivDesign[0]+(title ?(infoDivDesign[1]+title+infoDivDesign[2]):'')+infoDivDesign[3]+text+infoDivDesign[4]+"\n";
 window.status = status;
 getFrmDim();
 infoDivStyle.visibility = ifLayer ? 'show':'visible';
 if(ifAll){
   infoDiv.innerHTML = str;
 }else if(ifDom){
   if(typeof infoDiv.innerHTML == 'string'){
     infoDiv.innerHTML = str;
   }else{
     range = document.createRange();
     range.setStartBefore(infoDiv);
     cont = range.createContextualFragment(str);
     while(infoDiv.hasChildNodes())
       infoDiv.removeChild(infoDiv.lastChild);
     infoDiv.appendChild(cont);
   }
 }else{
   infoDiv.open();
   infoDiv.write(str);
   infoDiv.close();
 }
 infoHeight = ifLayer ? document.layers['infoBox'].document.height :
   ( ifDom ? document.getElementById('infoBoxDim').offsetHeight : document.all['infoBoxDim'].offsetHeight );
 infoWidth = ifLayer ? document.layers['infoBox'].document.width :
   ( ifDom ? document.getElementById('infoBoxDim').offsetWidth : document.all['infoBoxDim'].offsetWidth );
 if(infoWidth && !ifLayer) infoDivStyle.width = infoWidth + iDivWidthAdd + 'px';
 infoShow = true;
 return true;
}

//-----------------------------------------------------------------------------------
function iBoxClr() {
 if(!ready2go) return false;
 infoShow = false;
 window.status = '';
 infoDivStyle.visibility = ifLayer ? 'hide':'hidden';
 infoDivStyle.left = ifLayer ? '1':'1px';
 infoDivStyle.top  = ifLayer ? '-400':'-400px';
 return true;
}

//-----------------------------------------------------------------------------------
function infoBoxInit() {
 if(ifDom ||
   (ifAll && typeof document.all['infoBox']=='object') ||
   (ifLayer && typeof document.layers['infoBox']=='object')){
   infoDiv = ifLayer ? document.layers['infoBox'].document :
    ( ifDom ? document.getElementById('infoBox') : document.all['infoBox'] );
   infoDivStyle = ifLayer ? document.layers['infoBox'] :
    ( ifDom ? document.getElementById('infoBox').style : document.all['infoBox'].style );
   if(ifLayer){
     window.captureEvents(Event.MOUSEMOVE);
     window.onmousemove = infoDivMove;
     iW = window.innerWidth;
     iH = window.innerHeight;
     window.onresize = function(){if(iW!=window.innerWidth||iH!=window.innerHeight)self.location.reload();}
   }else{
     document.onmousemove = infoDivMove;
     infoDivStyle.top  = '-400px';
   }
   ready2go=true;
 }
}
