var base64s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';

function decode(encStr)
{
 var bits;
 var decOut = '';
 var i = 0;
 for(; i<encStr.length; i += 4)
 {
		bits = (base64s.indexOf(encStr.charAt(i))    & 0xff) <<18 |
					 (base64s.indexOf(encStr.charAt(i +1)) & 0xff) <<12 |
					 (base64s.indexOf(encStr.charAt(i +2)) & 0xff) << 6 |
						base64s.indexOf(encStr.charAt(i +3)) & 0xff;
		decOut += String.fromCharCode((bits & 0xff0000) >>16, (bits & 0xff00) >>8, bits & 0xff);
 }
 if(encStr.charCodeAt(i -2) == 61)
 {
		return(decOut.substring(0, decOut.length -2));
 }
 else if(encStr.charCodeAt(i -1) == 61)
 {
		return(decOut.substring(0, decOut.length -1));
 }
 else {return(decOut)};
}

function linkTo_UnCryptMailto(s)
{
	document.location.href=decode(s);
}
function NavOver(cell)
{
  cell.style.cursor = 'hand';
  cell.className='navAktiv';
}

function NavOut(cell)
{
  cell.className='nav';
}

function NavClick(cell)
{
   if(event.srcElement.tagName=='TD')
   {
    cell.children.tags('A')[0].click();
   }
}

function popup(file, breite, hoehe)
{
  var links=(screen.width-breite)/2;
  var oben=(screen.height-hoehe)/2;
  WVCpopup=window.open(file,'WVCpopup','height='+hoehe+',left='+links+',top='+oben+',scrollbars=1,toolbar=0,status=0,menubar=0,resizable=1,width='+breite)
  WVCpopup.focus();
}

function StyleNull(what)
{
	$(what).style.filter='style=0';
	$(what).style.opacity='1';
}
function StyleGrey(what)
{
  $(what).style.filter='Alpha(opacity=33)';
  $(what).style.opacity='0.33'; 
  if ($('bild'))
    $('bild').innerHTML+='<div style=\"text-align:right;right:1px;filter:Alpha(style=0);opacity:1;\"><img src="../images/loading.gif" border="0"></div>';
  else
    $(what).innerHTML+='<div style=\"text-align:right;right:1px;filter:Alpha(style=0);opacity:1;\"><img src="../images/loading.gif" border="0"></div>';
}

function reloadObject(what,site,pars)
{
  new Ajax.Updater(what, site, {onComplete: function(){ StyleNull(what); }, onCreate: function(){ StyleGrey(what); }, evalScripts:true, method:"get", parameters:pars});
}

function reloadObject2(what,site,pars,completeRun)
{
  new Ajax.Updater(what, site, {onComplete: function(){ StyleNull(what); }, onCreate: function(){ StyleGrey(what); }, onComplete: function(){ completeRun; }, evalScripts:true, method:"get", parameters:pars});
} 

function NextFoto(ID,seite,archiv)
{
  var what='contentTxt';
  var site='/fotos/fotos.php';
  var pars='?ID='+ID+'&show=full&loader=ajax&seite='+seite+'&archiv='+archiv;
  new Ajax.Updater(what, site, {onComplete: function(){ StyleNull('foto'); }, onCreate: function(){ StyleGrey('foto'); }, evalScripts:true, method:"get", parameters:pars});
}
