// main navigation part

pics = new Array();
var activePic = '';
var objCount = 0; // number of (changing) images on web-page

sub_pics = new Array();
var sub_activePic = '';
var sub_objCount = 0;

function preload(name, first, second) {  

  // preload images and place them in an array

  if (browserOK) {     
    pics[objCount] = new Array(3);
    pics[objCount][0] = new Image();
    pics[objCount][0].src = first;
    pics[objCount][1] = new Image();
    pics[objCount][1].src = second;
    pics[objCount][2] = name;
    objCount++;
  }
}

function on(name){
  if (browserOK) {
	k3_hide();
    for (i = 0; i < objCount; i++) {
      if (document.images[pics[i][2]] != null)
        if ((name != pics[i][2]) & (document.images[pics[i][2]] != activePic)) { 
          // set back all other pictures
          document.images[pics[i][2]].src = pics[i][0].src;
		   hide(document.images[pics[i][2]].name + '_text');
		   hide(sub_activePic.name + '_deep'); 
        } else {
           // show the second image because cursor moves across this image
           document.images[pics[i][2]].src = pics[i][1].src;
		   hide(sub_activePic.name + '_text'); 
		   hide(activePic.name + '_text'); 
		   show(name + '_text'); 
        	}
    }
  }
}

function active(name){
  if (browserOK) {
     for (i = 0; i < objCount; i++) {
      if (document.images[pics[i][2]] != null) {
	  	if (name == pics[i][2])
			{
           document.images[pics[i][2]].src = pics[i][1].src; 
		   activePic = document.images[pics[i][2]];
		   if (document.getElementById(name + '_text')) {
			   document.getElementById(document.images[pics[i][2]].name + '_text').style.visibility = "visible"; 
			   }
		   }
	   }
    }
  }
off();
}

function off(){
  if (browserOK) {
     for (i = 0; i < objCount; i++) {
		// hide all text 
		hide(document.images[pics[i][2]].name + '_text'); 
      // set back all pictures
      if ((document.images[pics[i][2]] != null) & (document.images[pics[i][2]] != activePic))
        document.images[pics[i][2]].src = pics[i][0].src;
	// hide infotext
    }
  }
  if (activePic) {
	show(activePic.name + '_text'); 
  }
  if (sub_activePic) {
    hide(activePic.name + '_text'); 
	show(sub_activePic.name + '_deep'); 
  }
  k3_show();
}

// global functions
function hide(name) {
  if (document.getElementById(name)) document.getElementById(name).style.visibility = "hidden"; 
}

function show(name) {
  if (document.getElementById(name)) document.getElementById(name).style.visibility = "visible"; 
}

function k3_hide() {
	hide('k3_kaufe');	
	hide('k3_koste');
}

function k3_show() {
	show('k3_kaufe');	
	show('k3_koste');
}

function pop_boden(name) {
	popup = window.open('profile/' + name + '.php','hr_bodenpop','width=300,height=560,toolbar=0,location=0,directories=0,status=0,scrollbars=0,menubar=0,resizable=0');
}

function pop_boden_en(name) {
	popup = window.open('profile/en_' + name + '.php','hr_bodenpop','width=300,height=560,toolbar=0,location=0,directories=0,status=0,scrollbars=0,menubar=0,resizable=0');
}

