var preloadFlag = false;
var Bild = new Array();

function preload(){
  for (i=0;i<preload.arguments.length;i++)
  {
    Bild[i]=new Image()
		Bild[i].src=preload.arguments[i]
	}
	
  preloadFlag = true;  	
}

// Pfad und Name der Images innerhalb von Anführungszeichen eintragen.
// Liste nach Bedarf erweitern.
//preload("./galerie/galerie002.jpg","./galerie/galerie004.jpg","./galerie/galerie003.jpg");

function galerie(language,image,x,y){
  var newwin = window.open(language+'_galeriepopup.php?img='+image+'','Galerie','toolbar=no,menubar=no,scrollbars=no,status=no,width='+x+',height='+y+',left=15,top=15');
  newwin.focus();
}
		
function writeTo(suffix, prefix){
	location.href = "mai" + "lto:" + prefix + "@" + suffix;
}
		
function Seitenanfang(){
  var y = 0;
  if (window.pageYOffset) {
		y = window.pageYOffset;
	} else if (document.body && document.body.scrollTop) {
		y = document.body.scrollTop;
	}
			
	while (y > 0) {
		setTimeout("window.scrollBy(0, -10)", 10);
		y = y - 10;
	}
}
		
	
/* FontSizeStyleChanger */
var prefsLoaded = false;  	
var defaultFontSize = 70;
var currentFontSize = defaultFontSize;

function revertStyles(){

	currentFontSize = defaultFontSize;
	changeFontSize(0);

};

function changeFontSize(sizeDifference){
	currentFontSize = parseInt(currentFontSize) + parseInt(sizeDifference * 5);

	if(currentFontSize > 120){
		currentFontSize = 120;
	}else if(currentFontSize < 60){
		currentFontSize = 60;
	}

	setFontSize(currentFontSize);
};

function setFontSize(fontSize){
	var stObj = (document.getElementById) ? document.getElementById('layout_body') : document.all('layout_body');
	document.body.style.fontSize = fontSize + '%';
	
	//alert (document.body.style.fontSize);
};		

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
};

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
};

  /* im HTML Body */
  //window.onload = setUserOptions;

function setUserOptions(){
	if(!prefsLoaded){

		cookie = readCookie("fontSize");
		currentFontSize = cookie ? cookie : defaultFontSize;
		setFontSize(currentFontSize);
		
		prefsLoaded = true;
	}

}

window.onunload = saveSettings;

function saveSettings()
{
  createCookie("fontSize", currentFontSize, 365);
}


function openSlidebar (fadeout,fadein,slider){
			var sliderDiv = $(slider);			
			new Effect.BlindDown(sliderDiv,{duration: 0.5});
			new Effect.Fade(fadeout);
			Effect.Appear(fadein, {delay: 0.5});
	}
	
function closeSlidebar (fadeout,fadein,slider){
			var sliderDiv = $(slider);
			new Effect.BlindUp(sliderDiv,{duration: 0.5});
			new Effect.Fade(fadeout); 
			Effect.Appear(fadein, {delay: 0.5});
	}
	

