var ieOld = parseInt(navigator.appVersion.substr(navigator.appVersion.indexOf('MSIE') + 5), 10) < 7;

var cur_pos=0;

var news_lenght = 1;

var from;
var to;
var step_lenght = 425;

function set_lenght( tmp )
{
 news_lenght=tmp;
}

function news_schieben()
{
 setTimeout("document.getElementById('newsbox').className='nbc1';", 200);
 setTimeout("document.getElementById('newsbox').className='nbc2';", 400);
 setTimeout("document.getElementById('newsbox').className='nbc3';", 500);
 setTimeout("document.getElementById('newsbox').className='nbc4';", 600);
 setTimeout("document.getElementById('newsbox').className='nbc5';", 700);
 setTimeout("document.getElementById('newsbox').className='nbc6';", 800);
 setTimeout("document.getElementById('newsbox').className='nbc7';", 1000);

 setTimeout("document.getElementById('newsbox').style.left=-to + 'px';", 1300);

 setTimeout("document.getElementById('newsbox').className='nbc7';", 1600);
 setTimeout("document.getElementById('newsbox').className='nbc6';", 1800);
 setTimeout("document.getElementById('newsbox').className='nbc5';", 2000);						 
 setTimeout("document.getElementById('newsbox').className='nbc4';", 2200);
 setTimeout("document.getElementById('newsbox').className='nbc3';", 2400);			 
 setTimeout("document.getElementById('newsbox').className='nbc2';", 2600);
 setTimeout("document.getElementById('newsbox').className='nbc1';", 2800);
 setTimeout("document.getElementById('newsbox').className='nbc0';", 3000);
}         

function news_go_new( mode )
{
 from = cur_pos*step_lenght; 
	
 if (mode=='up')
 {
  cur_pos=cur_pos+1;	
 } else {
  cur_pos=cur_pos-1;
 }
	
 if (cur_pos>=news_lenght)
  cur_pos=0;
  
 if (cur_pos<0)
  cur_pos=(news_lenght-1);
  
 to = cur_pos*step_lenght;
  
 news_schieben(); 
 
 return false;
}

function news_schieber()
{ 
 from = cur_pos*step_lenght; 
 to   = (cur_pos+1)*step_lenght
 
 if (cur_pos>=(news_lenght-1))
 {
  cur_pos=0;
  to = 0;
  
 } else {
  cur_pos=cur_pos+1; 
 }

 news_schieben();
}


// :::::::: welcher Browser ? ::::::::
if (document.layers) {navigator.family = "nn4"}
if (document.all) {navigator.family = "ie4"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {navigator.family = "gecko"}

overdiv="0";

//  :::::::: kreiert Tabelle für die PopUp-Box ::::::::
function popLayer(a){
if(!descarray[a]){descarray[a]="<font color=red>Dieses PopUp (#"+a+") ist nicht korrekt definiert - Beschreibung fehlt</font>";}
if (navigator.family == "gecko") {pad="0"; bord="1 bordercolor=black";}
else {pad="1"; bord="0";}
desc = "<table cellspacing=0 cellpadding="+pad+" border="+bord+" bgcolor=black><tr><td>\n"
        +"<table cellspacing=0 cellpadding=4 border=0 width=100%><tr><td class=\"help_div_table\">\n"
        +descarray[a]
        +"\n</td></tr></table>\n"
        +"</td></tr></table>";
if(navigator.family =="nn4") {
        document.help_msg.document.write(desc);
        document.help_msg.document.close();
        document.help_msg.left=x+15;
        document.help_msg.top=y-5;
        }
else if(navigator.family =="ie4"){
        help_msg.innerHTML=desc;
        help_msg.style.pixelLeft=x+15;
        help_msg.style.pixelTop=y-5;
        }
else if(navigator.family =="gecko"){
        document.getElementById("help_msg").innerHTML=desc;
        document.getElementById("help_msg").style.left=x+15;
        document.getElementById("help_msg").style.top=y-5;
        }
}

var isNav = (navigator.appName.indexOf("Netscape") !=-1);

function handlerMM(e)
{
        x = (isNav) ? e.pageX : event.clientX + document.body.scrollLeft;
        y = (isNav) ? e.pageY : event.clientY + document.body.scrollTop;
}

if (isNav){document.captureEvents(Event.MOUSEMOVE);} document.onmousemove = handlerMM;


//  :::::::: versteckt die PopUp-Box ::::::::
function hideLayer(){
if (overdiv == "0") {
        if(navigator.family =="nn4") {eval(document.help_msg.top="-500");}
        else if(navigator.family =="ie4"){help_msg.innerHTML="";}
        else if(navigator.family =="gecko") {document.getElementById("help_msg").style.top="-500";}
        }
}

function rechnungs_popup( id, type )
{
      if (type=="") { type="RE"; }
      var breite=635;
      var hoehe=screen.availHeight;
      var positionX=((screen.availWidth / 2) - breite / 2);
      var positionY=((screen.availHeight / 2) - hoehe / 2);
      var url='/rechnung.php?rechn_nr=' + id + '&type=' + type;
      pop=window.open('','','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,fullscreen=0,width='+breite+',height='+hoehe+',top=0,left=0');
      pop.resizeTo(breite,hoehe);
      pop.moveTo(positionX,positionY);
      pop.location=url;
	  
	  return false;
}
	  
function doamin_loesch_popup( id )
{
      var breite=635;
      var hoehe=screen.availHeight;
      var positionX=((screen.availWidth / 2) - breite / 2);
      var positionY=((screen.availHeight / 2) - hoehe / 2);
      var url='/domain_kuendigung.php?domain_nr=' + id;
      pop=window.open('','','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,fullscreen=0,width='+breite+',height='+hoehe+',top=0,left=0');
      pop.resizeTo(breite,hoehe);
      pop.moveTo(positionX,positionY);
      pop.location=url;
}


// global xmlhttprequest object
var xmlHttp = false;



/** AJAX functions **/

// constants
var REQUEST_GET        = 0;
var REQEST_POST        = 2;
var REQUEST_HEAD       = 1;
var REQUEST_XML        = 3;



/**
 * instantiates a new xmlhttprequest object
 *
 * @return xmlhttprequest object or false
 */
function getXMLRequester( )
{
    var xmlHttp = false;
            
    // try to create a new instance of the xmlhttprequest object        
    try
    {
        // Internet Explorer
        if( window.ActiveXObject )
        {
            for( var i = 5; i; i-- )
            {
                try
                {
                    // loading of a newer version of msxml dll (msxml3 - msxml5) failed
                    // use fallback solution
                    // old style msxml version independent, deprecated
                    if( i == 2 )
                    {
                        xmlHttp = new ActiveXObject( "Microsoft.XMLHTTP" );    
                    }
                    // try to use the latest msxml dll
                    else
                    {
                        
                        xmlHttp = new ActiveXObject( "Msxml2.XMLHTTP." + i + ".0" );
                    }
                    break;
                }
                catch( excNotLoadable )
                {                        
                    xmlHttp = false;
                }
            }
        }
        // Mozilla, Opera und Safari
        else if( window.XMLHttpRequest )
        {
            xmlHttp = new XMLHttpRequest();
        }
    }
    // loading of xmlhttp object failed
    catch( excNotLoadable )
    {
        xmlHttp = false;
    }
    return xmlHttp ;
}


/**
 * sends a http request to server
 * @param strSource, String, datasource on server, e.g. data.php
 * @param strData, String, data to send to server, optionally
 * @param intType, Integer,request type, possible values: REQUEST_GET, REQUEST_POST, REQUEST_XML, REQUEST_HEAD default REQUEST_GET
 * @param strData, Integer, ID of this request, will be given to registered event handler onreadystatechange', optionally
 * @return String, request data or data source
 */
function sendRequest( strSource, strData, intType, intID )
{
    if( !strData )
        strData = '';

    // default type (0 = GET, 1 = xml, 2 = POST )
    if( isNaN( intType ) )
        intType = 0; // GET

    // previous request not finished yet, abort it before sending a new request
    if( xmlHttp && xmlHttp.readyState )
    {
        xmlHttp.abort( );
        xmlHttp = false;
    }
        
    // create a new instance of xmlhttprequest object
    // if it fails, return
    if( !xmlHttp )
    {
        xmlHttp = getXMLRequester( );
        if( !xmlHttp )
            return false;
    }
    
    // parse query string
    if( intType != 1 && ( strData && strData.substr( 0, 1 ) == '&' || strData.substr( 0, 1 ) == '?' ) )
        strData = strData.substring( 1, strData.length );

    // data to send using POST
    var dataReturn = strData ? strData : strSource;
    
    switch( intType )
    {
        case 1:    // xml
            strData = "xml=" + strData;
        case 2: // POST
            // open the connection 
            xmlHttp.open( "POST", strSource, true );
            xmlHttp.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );
            xmlHttp.setRequestHeader( 'Content-length', strData.length );
            break;
        case 3: // HEAD
            // open the connection 
            xmlHttp.open( "HEAD", strSource, true );
            strData = null;
            break;
        default: // GET
            // open the connection 
            var strDataFile = strSource + (strData ? '?' + strData : '' );
            xmlHttp.open( "GET", strDataFile, true );
            strData = null;
    }

    // set onload data event-handler
    xmlHttp.onreadystatechange = new Function( "", "processResponse(" + intID + ")" ); ;

    // send request to server
    xmlHttp.send( strData );    // param = POST data
    
    return dataReturn;
}
    

function processResponse( intID )
{
    // status 0 UNINITIALIZED open() has not been called yet.
    // status 1 LOADING send() has not been called yet.
    // status 2 LOADED send() has been called, headers and status are available.
    // status 3 INTERACTIVE Downloading, responseText holds the partial data.
    // status 4 COMPLETED Finished with all operations.
    switch( xmlHttp.readyState )
    {
        // uninitialized
        case 0:
        // loading
        case 1:
        // loaded
        case 2:
        // interactive
        case 3:
            break;
        // complete
        case 4:    
            // check http status
            if( xmlHttp.status == 200 )    // success
            {
                if (intID==6513) {
                 processInfopops( xmlHttp );
                } else {
                 processData( xmlHttp, intID );
                }
            }
            // loading not successfull, e.g. page not available
            else
            {
                if( window.handleAJAXError )
                    handleAJAXError( xmlHttp, intID );
                else
                    alert( "ERROR\n HTTP status = " + xmlHttp.status + "\n" + xmlHttp.statusText ) ;
            }
    }
}

function encode_utf8(rohtext) 
{
 // dient der Normalisierung des Zeilenumbruchs
 rohtext = rohtext.replace(/\r\n/g,"\n");
 var utftext = "";
 for(var n=0; n<rohtext.length; n++)
 {
  // ermitteln des Unicodes des  aktuellen Zeichens
  var c=rohtext.charCodeAt(n);
  // alle Zeichen von 0-127 => 1byte
  if (c<128)
   utftext += String.fromCharCode(c);
   // alle Zeichen von 127 bis 2047 => 2byte
  else if((c>127) && (c<2048)) {
   utftext += String.fromCharCode((c>>6)|192);
   utftext += String.fromCharCode((c&63)|128);}
   // alle Zeichen von 2048 bis 66536 => 3byte
  else {
  utftext += String.fromCharCode((c>>12)|224);
  utftext += String.fromCharCode(((c>>6)&63)|128);
  utftext += String.fromCharCode((c&63)|128);}
 }
 return utftext;
}

function decode_utf8(utftext) 
{
 var plaintext = ""; var i=0; var c=c1=c2=0;
 // while-Schleife, weil einige Zeichen uebersprungen werden
 while(i<utftext.length)
 {
  c = utftext.charCodeAt(i);
  if (c<128) 
  {
   plaintext += String.fromCharCode(c);
   i++;
  } else if((c>191) && (c<224)) {
   c2 = utftext.charCodeAt(i+1);
   plaintext += String.fromCharCode(((c&31)<<6) | (c2&63));
   i+=2;
  } else {
   c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2);
   plaintext += String.fromCharCode(((c&15)<<12) | ((c2&63)<<6) | (c3&63));
   i+=3;
  }
 }
 return plaintext;
}

function question (nachricht, url)
{
 var reply = prompt(nachricht + "\nGeben Sie OK ein!", "");

 if (reply=="OK" || reply=="ok")
  { window.location.href=url; }
 else
  {}
}

var top_menu_cache = new Object;

var show_top_navi_layer_entsch_a = false;
var show_top_navi_layer_entsch_b = false;

function do_over_top_menu(titel, obj)
{
 top_menu_cache[titel] = obj.firstChild.src;
 obj.firstChild.src = 'http://www.movetec.ch/templates/movetec/ger/images/top_menu_'+titel+'_over.jpg';
 
 switch(titel)
 {
  case 'domain': 
       var tmp_obj = domain_meneu;
       document.getElementById('top_navi_layer').style.left='1px';
       break;

  case 'hosting':
       var tmp_obj = hosting_meneu;
       document.getElementById('top_navi_layer').style.left='94px';
       break;

  case 'design':
       var tmp_obj = design_meneu;
       document.getElementById('top_navi_layer').style.left='187px';
       break;
       
  case 'suchmaschinen':
       var tmp_obj = suchmaschinen_meneu;
       document.getElementById('top_navi_layer').style.left='377px';
       break;

  case 'optimierung':
       var tmp_obj = optimierung_meneu;
       document.getElementById('top_navi_layer').style.left='470px';
       break;

  case 'werbung':
       var tmp_obj = werbung_meneu;
       document.getElementById('top_navi_layer').style.left='563px';
       break;

  case 'service':
       var tmp_obj = service_meneu;
       document.getElementById('top_navi_layer').style.left='656px';
       break;

  case 'software':
       var tmp_obj = software_meneu;
       document.getElementById('top_navi_layer').style.left='749px';
       break;

  case 'entwicklung':
       var tmp_obj = entwicklung_meneu;
       document.getElementById('top_navi_layer').style.left='842px';
       break;

  case 'faq':
       var tmp_obj = faq_meneu;
       document.getElementById('top_navi_layer').style.left='935px';
       break;
 }

 var tmp = '';
 for(i in tmp_obj)
 {
  if (tmp_obj[i][1]=='spacer')
   tmp = tmp + '<b>&nbsp;</b>';
  else
   tmp = tmp + '<a href="'+tmp_obj[i][0]+'">'+tmp_obj[i][1]+'</a>';
 }

 if (tmp!='')
 {
  show_top_navi_layer_entsch_a = true; 
  document.getElementById('top_navi_layer_ct').innerHTML=tmp;
  document.getElementById('top_navi_layer').style.display='block';
 }
 delete tmp;
 delete tmp_obj;
}

function do_out_top_menu(titel, obj)
{
 obj.firstChild.src = top_menu_cache[titel];
 show_top_navi_layer_entsch_a = false;

 window.setTimeout("hide_top_navi_layer_real()", 5);
}

function show_top_navi_layer()
{
 show_top_navi_layer_entsch_b = true;
 document.getElementById('top_navi_layer').style.display='block';
}

function hide_top_navi_layer()
{
 show_top_navi_layer_entsch_b = false;
 
 window.setTimeout("hide_top_navi_layer_real()", 5);
}

function hide_top_navi_layer_real()
{
 if (show_top_navi_layer_entsch_b==false && show_top_navi_layer_entsch_a==false)
  document.getElementById('top_navi_layer').style.display='none';
}

function popWin(a)
{
 help_window = window.open(a ,'Hilfe','width=680,height=600,resizable,scrollbars=yes');
 help_window.focus();
}

function setCookie(name, value, expiresin, path, domain, secure) {
  if (expiresin<1)
   expiresin=1;
  
  now=new Date();
  expires=new Date(now.getTime()+expiresin*86400000);

  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path)    ? "; path=" + path : "") +
      ((domain)  ? "; domain=" + domain : "") +
      ((secure)  ? "; secure" : "");
  document.cookie = curCookie;
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function function_exists( function_name ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Steve Clay
    // +   improved by: Legaev Andrey
    // *     example 1: function_exists('isFinite');
    // *     returns 1: true
 
 
    if (typeof function_name == 'string'){
        return (typeof window[function_name] == 'function');
    } else{
        return (function_name instanceof Function);
    }
}

function class_exists(cls) {
    // Checks if the class exists  
    // 
    // version: 903.3016
    // discuss at: http://phpjs.org/functions/class_exists
    // +   original by: Brett Zamir (http://brettz9.blogspot.com)
    // *     example 1: function class_a() {this.meth1 = function() {return true;}};
    // *     example 1: var instance_a = new class_a();
    // *     example 1: class_exists('class_a');
    // *     returns 1: true
    var i = '';
    cls = window[cls]; // Note: will prevent inner classes

    if (typeof cls !== 'function') {return false;}

    for (i in cls.prototype) {
        return true;
    }
    for (i in cls) { // If static members exist, then consider a "class"
        if (i !== 'prototype') {
            return true;
        }
    }
    if (cls.toSource && cls.toSource().match(/this\./)) { 
        // Hackish and non-standard but can probably detect if setting
        // a property (we don't want to test by instantiating as that
        // may have side-effects)
        return true;
    }

    return false;
}

function call_user_func(cb, parameters) {
    // http://kevin.vanzonneveld.net
    // +   original by: Brett Zamir (http://brettz9.blogspot.com)
    // *     example 1: call_user_func('isNaN', 'a');
    // *     returns 1: true
 
    var func;
 
    if (typeof cb == 'string') {
        if (typeof this[cb] == 'function') {
            func = this[cb];
        } else {
            func = (new Function(null, 'return ' + cb))();
        }
    } else if (cb instanceof Array) {
        func = eval(cb[0]+"['"+cb[1]+"']");
    }
    
    if (typeof func != 'function') {
        throw new Error(func + ' is not a valid function');
    }

  //  return func.apply(null, Array.prototype.slice.call(parameters, 1));
  
    return func.apply(null, new Array(parameters) );
}

function InitInfopops()
{
 renderInfopops();
}

function reloadInfopops()
{
 sendRequest('/get_infoPops.php', '', REQUEST_GET, 6513);
}

function processInfopops( xmlHttp )
{
 infoPops = eval('('+xmlHttp.responseText+')');
 renderInfopops();
}

function renderInfopops()
{
 var html = '';

 for(var i in infoPops)
 {
  var fn = 'renderInfopops_'+infoPops[i]['action']+''; 

  if (function_exists( fn ))
  {
   html += call_user_func(fn, infoPops[i]);
  }
 }
 
 document.getElementById('infoPops').innerHTML = html;

 window.setTimeout("reloadInfopops()", 60000); // 60 sec
}

function renderInfopops_powerSale( obj )
{
 // print_r(obj);
 
 if (!obj.produkt)
  return '';

 var html = '<div class="powerSaleBlock" onClick="location.href=\''+obj.produkt.url+'\'" style="cursor:pointer;">';
 
 //obj.preise.CHF = parseFloat(obj.preise.CHF);
 //obj.preise.EUR = parseFloat(obj.preise.EUR);
 //obj.produkt.preise.CHF = parseFloat(obj.produkt.preise.CHF);
 //obj.produkt.preise.EUR = parseFloat(obj.produkt.preise.EUR);
 // .toFixed(2)

 var runTimeDays    = 0;
 var runTimeHours   = 0;
 var runTimeMinutes = obj.runTime;

 
 if (runTimeMinutes>=(60*24))
 {
  runTimeDays =Math.floor(runTimeMinutes/(60*24));
  runTimeMinutes = runTimeMinutes-(runTimeDays*60*24);
 }
 
 if (runTimeMinutes>=(60))
 {
  runTimeHours = Math.floor(runTimeMinutes/(60));
  runTimeMinutes = runTimeMinutes-(runTimeHours*60);
 }
 
 var runTime = ''; 

 if (runTimeDays==1)
  runTime += runTimeDays+' Tag '+SetStrLength(runTimeHours, 2, '0')+':'+SetStrLength(runTimeMinutes, 2, '0')+':00 Min';
 else if (runTimeDays>1) {
  runTime += runTimeDays+' Tage '+SetStrLength(runTimeHours, 2, '0')+':'+SetStrLength(runTimeMinutes, 2, '0')+':00 Min';
 } else {
   
  if (runTimeHours==1)
   runTime += SetStrLength(((runTimeHours*60)+runTimeMinutes), 2, '0')+' Min';
  else if(runTimeHours>1) {
   runTime += SetStrLength(runTimeHours, 2, '0')+' Std '+SetStrLength(runTimeMinutes, 2, '0')+' Min';
  } else {
   runTime += SetStrLength(runTimeMinutes, 2, '0')+' Min';
  }

 }

 html += '<table border="0" cellpadding="0" cellspacing="0" class="powerSaleib">';
 html += '<tr><td><img src="/images/powerSale_Layer_top.jpg" border="0" /></td>';
 html += '<tr><td align="left" class="powerSaleib_td">';

 html += '<h2>'+obj.titel+' CHF '+obj.preise.CHF+'/ '+obj.preise.EUR+' €</h2>';
 if (obj.text && obj.text.length>0)
  html += obj.text+'<br />';
 html += 'statt: CHF '+obj.produkt.preise.CHF+'/ '+obj.produkt.preise.EUR+' € | Max Stückzahl: '+obj.perRun+'<br>Angebotsdauer: '+runTime+' | läuft noch: <span id="coundown_'+obj.identifier+'">'+obj.toRun+'</span> Min';

 html += '</td>';
 html += '<tr><td><img src="/images/powerSale_Layer_bottom.jpg" border="0" /></td>';
 html += '</table>';

 html += '</div>';
 
 var runUpToo = new Date();
 runUpToo.setTime(parseInt(obj.runUpToo)*1000);

 var CountDown= new CountDownSimple();
 CountDown.to_date   = runUpToo;
 CountDown.DivObject = 'coundown_'+obj.identifier;
 CountDown.init();

 return html;
}

function SetStrLength(Str, Length, FillSymbol)
{
  var ss = '' + Str + '';
  while (ss.length < Length) ss = FillSymbol + ss;

  if (ss.length > Length) {
   ss = ss.substr(0,Length-1);
   ss = ss + '-';
  }

  return ss;
}

function CountDownSimple() {
    //  this.init();
}

CountDownSimple.prototype = {
 message   : '',
 soundfile : '',
 to_date   : 0,
 bStopZero : 0,
 DivBlock  : null,
 
 init: function()
 {
  var that = this;
  setTimeout(function() { that.UpdatePanel(); }, 1000);
 },
 
 ShowMessage: function(sMessage, sSound)
 {
  var screenW = 640;
  var screenH = 480;
  if (parseInt(navigator.appVersion)>3)
  {
   screenW = screen.width;
   screenH = screen.height;
  }

  msg=window.open("","TimeLeft","width=300,height=200,left="+(screenW-300)/2+", top="+(screenH-300)/2+", resizable=yes, ");
  if (navigator.appName=="Microsoft Internet Explorer")
   msg.document.write('<bgsound src='+'"'+sSound+'"'+' >')
  else 
   msg.document.write('<embed src=\"'+sSound+'\" hidden="true" border="0" width="20" height="20" autostart="true">');

  msg.document.write('<style type="text/css">');
  msg.document.write('.mess {color:#2D5C3D;font-family:Arial,helvetica,sans serif;font-size:13pt;font-weight:bold;}');
  msg.document.write('a.close {color:#618D6E;text-decoration:underline;font-family:verdana,helvetica,sans serif;font-size:11px;font-weight:bold;}');
  msg.document.write('</style>');

  msg.document.write('<body>');

  msg.document.write('<table width="100%" border="0">');
  msg.document.write('<tr><td height="140" class=mess valign="top">'+sMessage+'</td></tr>');
  msg.document.write('<tr><td height="*" class=close><hr size="1"><div align="center"><a class=close href=# onclick=self.close()>close</a></div></td></tr>');
  msg.document.write('</table>');

  msg.document.write('</body>');
 },

 SetVal: function(Image, Str, Index)
 {
  c = Str.charAt(Index);
  if (c==' ') c = '10';
  if (c=='-') c = '11';
  if (Image.src != dig[c]) Image.src = dig[c];
 },

 GetDayCount: function(iYear, iMonth)
 {
  var acMonth = new Array (31,28,31,30,31,30,31,31,30,31,30,31);

  if ((iYear % 4 == 0) && (iMonth == 1)) return 29;
  else {
   if (iMonth==0) iMonth = 11;
   return acMonth[iMonth];
  }
 },

 UpdatePanel: function()
 {
  var that = this;
 
  var now = new Date;
  var y=0, m=0, d=0, h=0, min=0, s=0;

  var tmp_date = 0;
  var to_date1 = this.to_date;

  if (now > to_date1)
   { tmp_date = now; now = to_date1; to_date1 = tmp_date; }
  
  var x11 = now.getYear();
  var x12 = now.getMonth();
  var x13 = now.getDate();
  var x14 = now.getHours();
  var x15 = now.getMinutes();
  var x16 = now.getSeconds();

  var x21 = to_date1.getYear();
  var x22 = to_date1.getMonth();
  var x23 = to_date1.getDate();
  var x24 = to_date1.getHours();
  var x25 = to_date1.getMinutes();
  var x26 = to_date1.getSeconds();
 
  if (x26 >= x16) s = x26 - x16;
  else {s = 60+x26-x16; x15 = x15+1; }
  if (x25 >= x15) min = x25 - x15;
  else { min = 60+x25-x15; x14 = x14+1; }
  if (x24 >= x14) h = x24 - x14;
  else { h = 24+x24-x14; x13 = x13+1; }
  if (x23 >= x13) d = x23-x13;
  else { d = this.GetDayCount(x11,x12) + x23-x13; x22 = x22-1; }
  if (x22 >= x12) m = x22-x12;
  else { m = 12+x22-x12; x11 = x11+1; }
  y = x21 - x11;

  var fm = y*12 + m;
  var msec = Date.parse(to_date1) - Date.parse(now);
  var fs = Math.floor(msec/1000);
  var fmin = Math.floor(msec/(1000*60));
  var fh = Math.floor(msec/(1000*60*60));
  var fd = Math.floor(msec/(1000*60*60*24));
  var fw = Math.floor(fd/7);
  var dw = fd%7;
  
  if (y+m+d+h+min+s == 0) 
   this.ShowMessage(this.message, this.soundfile);
   
  if ((tmp_date != 0) && (this.bStopZero==1)) {y=0; m=0; d=0; h=0; min=0; s=0;}
  
  var sFD  = SetStrLength(fd,  5, '0');
  var sH   = SetStrLength(h,   2, '0');
  var sMIN = SetStrLength(min, 2, '0');
  var sS   = SetStrLength(s,   2, '0');
  
  if (this.DivBlock==null) {
   this.DivBlock = document.getElementById(this.DivObject);
  }

  var html = '';

  if (fd==1)
   html += fd+' Tag ';
  if (fd>1)
   html += fd+' Tage ';

  if (sH>0)
   html += sH+':'; 
   
  html += sMIN+':'+sS;
  
  this.DivBlock.innerHTML = html

  setTimeout(function() { that.UpdatePanel(); }, 1000);
 } 
}


function print_r(arr)
{
 alert(dump(arr));
}

function dump(arr,level) {
	var dumped_text = "";
	if(!level) level = 0;
	
	//The padding given at the beginning of the line.
	var level_padding = "";
	for(var j=0;j<level+1;j++) level_padding += "    ";

	if(typeof(arr) == 'object') { //Array/Hashes/Objects 
		for(var item in arr) {
			var value = arr[item];
			
			if(typeof(value) == 'object') { //If it is an array,
				dumped_text += level_padding + "'" + item + "' "+typeof(value)+"\n";
				dumped_text += dump(value,level+1);
			} else {
				dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
			}
		}
	} else { //Stings/Chars/Numbers etc.
		dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
	}
	return dumped_text;
}

var hiddenEls = new Array();

function hideElements(type, thisWindow) {

	if (!thisWindow) {
		hideElements(type, self);
	} else {

		var tagName, tagNames = type === 'flash' ? ['object', 'embed'] : [type];
		try {
			while ((tagName = tagNames.pop())) {
				var els = thisWindow.document.getElementsByTagName(tagName),
				      i = els.length;
				while (i--) {
					var el = els[i];
					if (el.style.visibility !== 'hidden' && (tagName !== 'object' ||
					(el.getAttribute('type') && el.getAttribute('type').toLowerCase() === 'application/x-shockwave-flash') ||
					(el.getAttribute('classid') && el.getAttribute('classid').toLowerCase() === 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000') ||
					/data\s*=\s*"?[^>"]+\.swf\b/i.test(el.innerHTML) ||
					/param\s+name\s*=\s*"?(movie|src)("|\s)[^>]+\.swf\b/i.test(el.innerHTML))) {
						hiddenEls.push(el);
						el.style.visibility = 'hidden';
					}
				}
			}
		} catch(e) {}
		var iframes = thisWindow.frames, i = iframes.length;
		while (i--) {
			try {
				if (typeof iframes[i].window === 'object') this.hideElements(type, iframes[i].window);
			} catch(e) {}
		}
	}
}


function showHiddenElements()
{
		while(hiddenEls.length) {
			var el = hiddenEls.pop();
			el.style.visibility = 'visible';
			if (this.ffOld && this.ffMac) {
				el.focus();
				el.blur();
			}
		}

}