<!--
// Math.abs()

//	Alain Bellet - www.notdefined.net - FUNCTIONS
// ----------------------------------------------------------
// General functions
// ----------------------------------------------------------

function swapImage(img_name,swap_img){
	if (document.images){
		 document.images[img_name].src = swap_img;
	}
}

// solve IE MAC missing array.push ...
if (typeof((new Array()).push) == "undefined") {
 function push() {
     for (var i = 0 ; i < arguments.length ; i++) {
         this[this.length] = arguments[i];
        }
    } Array.prototype.push = push;
}

// make a "find position" in an array
function get_pos(id,the_array){
	for (i = 0; i < the_array.length; i++){
		the_id = (the_array[i]);
		if (the_id == id){
			return i;
		}
	}
	return -1;
}

// show-hide a div
function show_hide(the_div,vis){
	if (document.getElementById){
		document.getElementById(the_div).style.visibility = vis;
	}
	else if (document.all)
	{
		document.all[the_div].style.visibility = vis;
	}
}

// emulate an object
// used like toto = new getObj('div_toto');
function getObj(name)
{
  if (document.getElementById)
  {
        this.obj = document.getElementById(name);
        this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
        this.obj = document.all[name];
        this.style = document.all[name].style;
  }
  else if (document.layers)
  {
        this.obj = document.layers[name];
        this.style = document.layers[name];
  }
}

// find the x position of an object
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

// find the y position of an object
function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

// get the vertical position of the scroll in pixels
function get_scroll_pos(){
	if(typeof window.pageXOffset != 'undefined'){
        X = window.pageXOffset;
        Y = window.pageYOffset;
    }else{
        if((!window.document.compatMode)||
          (window.document.compatMode == 'BackCompat')){
            X = window.document.body.scrollLeft;
            Y = window.document.body.scrollTop;
        }else{
            X = window.document.documentElement.scrollLeft;
            Y = window.document.documentElement.scrollTop;
        }
    }
	return (Y);
}

// get the height of the window
function get_window_height() {
  var myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement &&( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return myHeight;
}

// ----------------------------------------------------------
// collapsable menu code
// ----------------------------------------------------------

var supported = (document.getElementById || document.all);
// var open_menu = new Array(); // to save all open Menus



// id : id of the obj.
// obj : object
// desire : the size of the open object (minimum) - used to force scroll


function newswapmenu(id,obj,desire,img){
	if (supported) {
		
		// check if already visible
		if (document.getElementById){
			var disp = document.getElementById(id).style.display;
		}
		else if (document.all)
		{
			var disp = document.all[the_div].style.display;
		}
		if (disp == 'block'){
			// CLOSE THE MENU //
			// hide the notizblock for better compatibility
			show_hide('tab','hidden');
			set_display(id,"none");

			if(img==true) swapImage('img_'+id,'img/close.gif');
			// refresh notizblock
			show_hide('tab','visible');
		}else{
			// OPEN THE MENU //
			show_hide('tab','hidden');
			set_display(id,"block");

			if(img==true) swapImage('img_'+id,'img/open.gif');
			// refresh notizblock
			show_hide('tab','visible');
			// call function to adjust scroll
			adjust_scroll(obj,desire);
		}
	}
}

function swapmenukunsthof(id,obj,desire,img,img_id,source){
	if (supported) {
		
		// check if already visible
		if (document.getElementById){
			var disp = document.getElementById(id).style.display;
		}
		else if (document.all)
		{
			var disp = document.all[the_div].style.display;
		}
		if (disp == 'block'){
			// CLOSE THE MENU //
			// hide the notizblock for better compatibility
			show_hide('content','hidden');
			set_display(id,"none");

			if(img==true) swapImage('img_'+id,'img/close.gif');
			// refresh notizblock
			show_hide('content','visible');
		}
		else
		{
			// OPEN THE MENU //
			// BILD LADEN
			var pfad = "img/archiv/";
			document.images[img_id].src = pfad + source;
			bild = new Image();
			bild.src = pfad + source;
			bild = new Image();
			bild.src =  pfad + source;
			
			show_hide('content','hidden');
			set_display(id,"block");

			if(img==true) swapImage('img_'+id,'img/open.gif');
			// refresh notizblock
			show_hide('content','visible');
			// call function to adjust scroll
			adjust_scroll(obj,desire);
		}
	}
}


// try to scroll to display the notizblock of the open menu
function adjust_scroll(clicked_obj,desired_scroll){
		click_pos =  findPosY(clicked_obj);
		scroll_y = get_scroll_pos();
		relative_position = click_pos-scroll_y;
		window_height = get_window_height();
		
		if (relative_position + desired_scroll > window_height) {
			to_move = (relative_position + desired_scroll) - window_height; 
			if (to_move > relative_position) {
				to_move = relative_position -50 ;
			}
			window.scroll(0, scroll_y+to_move);
		}
}

// set the style (display) to none or block - to collapse it
function set_display(div_id,disp){
	if (document.getElementById){
		document.getElementById(div_id).style.display = disp;
	}
	else if (document.all)
	{
		document.all[div_id].style.display = disp;
	}

}

// ----------------------------------------------------------
// bilder austauschen
// ----------------------------------------------------------

var next_img = 1;
var legende= Array();
legende[1] = "MALY SCHILLER"; 
legende[2] = "DORO SCHÜRCH";
legende[3] = "ANA ROLDAN";
legende[4] = "DANIEL MOUTHON";
legende[5] = "MATHIS ZWICK";
legende[6] = "KAREN GEYER";
legende[7] = "HANSJÖRG KÖFLER";
legende[8] = "KOEPPL/ZACEK";
legende[9] = "HEINRICH LÜBER";
legende[10] = "ANTON BRUHIN";
legende[11] = "MO DIENER";
legende[12] = "KATJA SCHENKER";
legende[13] = "GABRIELE RÉRAT";
legende[14] = "EDU HABENSAK";
legende[15] = "AL FATLAWI/AL AMERI";

function naechtesbildup(id,pfad,maxcount)
{
	var maxcount = maxcount;
	next_img++;

	if (next_img > maxcount)
	{
		next_img = 1;
	}
	if (next_img < 10)
	{
	document.images[id].src = pfad +"0" + eval(next_img) + ".jpg";
	bild = new Image();
	bild.src = pfad +"0" + eval(next_img) + ".jpg";
	bild = new Image();
	bild.src =  pfad +"0" + + eval(next_img) + ".jpg";
	document.getElementById("cur_count").childNodes[0].nodeValue = " " + next_img;
	}
	else
	{
	document.images[id].src = pfad + eval(next_img) + ".jpg";
	bild = new Image();
	bild.src = pfad + eval(next_img) + ".jpg";
	bild = new Image();
	bild.src =  pfad + eval(next_img) + ".jpg";
	document.getElementById("cur_count").childNodes[0].nodeValue = next_img;
	}
	document.getElementById("cur_artist").childNodes[0].nodeValue = legende[next_img];
}

function naechtesbilddown(id,pfad,maxcount)
{
	var maxcount = maxcount;
	next_img = next_img -1;

	if (next_img < 1)
	{
		next_img = 15;
	}
	if (next_img < 10)
	{
	document.images[id].src = pfad +"0" + eval(next_img) + ".jpg";
	bild = new Image();
	bild.src = pfad +"0" + eval(next_img) + ".jpg";
	bild = new Image();
	bild.src =  pfad +"0" + + eval(next_img) + ".jpg";
	document.getElementById("cur_count").childNodes[0].nodeValue = " " + next_img;
	}
	else
	{
	document.images[id].src = pfad + eval(next_img) + ".jpg";
	bild = new Image();
	bild.src = pfad + eval(next_img) + ".jpg";
	bild = new Image();
	bild.src =  pfad + eval(next_img) + ".jpg";
	document.getElementById("cur_count").childNodes[0].nodeValue = next_img;
	}
	document.getElementById("cur_artist").childNodes[0].nodeValue = legende[next_img];
}

function clearids()
{
	next_img = 1;
	document.getElementById("cur_count").childNodes[0].nodeValue = " 1";
	document.getElementById("cur_artist").childNodes[0].nodeValue = legende[1];
}
//-->