/*
 * behaviours.js
 *
 * Hier sind Funktionen fuer die Seite enthalten, die fuer das Layout notwendig sind
 * Die Datei kommt vom externen Layouter
 *
 * 1.0.0        2007-09-14  Roman Strebe
 *                  - Versionierung eingefuehrt
 *                  - Pfade der Bilder angepasst: "/" vorangestellt
 *
 * @package     contentBLUE-VOEB
 * @subpackage  Javascript
 * @author      Roman Strebe <strebe@glamus.de>
 *
 */

/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/* optimierte getElementsByClassName (wp) */

document.getElementsByClassName = function(className) {
  var children = document.getElementsByTagName('*') || document.all;
  var elements = new Array();
  
  for (var i = 0; i < children.length; i++) {
    var child = children[i];
    var classNames = child.className.split(' ');
    for (var j = 0; j < classNames.length; j++) {
      if (classNames[j] == className) {
        elements.push(child);
        break;
      }
    }
  }
  
  return elements;
}



/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/* DOM Image Hovers beta  */

/* preload images: */
var a = new Array(
		"/img/btn_suchen_hover.gif",
		"/img/btn_suchenForm_hover.gif",
		"/img/btn_suchenForm_hover.gif",
		"/img/btn_eingabe_loeschen_hover.gif",
		"/img/btn_absenden_hover.gif",
		"/img/btn_einloggen_hover.gif" 
		);
		
		var b = new Array();
		var i;
		for (i = 0; i < a.length; i++) {
			b[i] = new Image();
			b[i].src = a[i];
} 

function hovr1() {

	var hvr1 = document.getElementById("hvr1");
	if (!hvr1) return false;

	hvr1.onmouseover = function() {
	this.src="/img/btn_suchen_hover.gif";
	};
	
	hvr1.onmouseout = function() {
	this.src="/img/btn_suchen.gif";
	};
	
	return true;	
}

function hovr2() {

	var hvr2 = document.getElementById("hvr2");
	if (!hvr2) return false;

	hvr2.onmouseover = function() {
	this.src="/img/btn_erweitertesuche_hover.gif";
	};
	
	hvr2.onmouseout = function() {
	this.src="/img/btn_erweitertesuche.gif";
	};
	
	return true;	
}

function hovr3() {

	var hvr3 = document.getElementById("hvr3");
	if (!hvr3) return false;

	hvr3.onmouseover = function() {
	this.src="/img/btn_einloggen_hover.gif";
	};
	
	hvr3.onmouseout = function() {
	this.src="/img/btn_einloggen.gif";
	};
	
	return true;	
}

function hovrFormEL() {
	var hovrFormEL = document.getElementById("hovrFormEL");
	if (!hovrFormEL) return false;
	hovrFormEL.onmouseover = function() {
	this.src="/img/btn_eingabe_loeschen_hover.gif";
	};
	hovrFormEL.onmouseout = function() {
	this.src="/img/btn_eingabe_loeschen.gif";
	};
	return true;	
}
function hovrFormAbsenden() {
	var hovrFormAbsenden = document.getElementById("hovrFormAbsenden");
	if (!hovrFormAbsenden) return false;
	hovrFormAbsenden.onmouseover = function() {
	this.src="/img/btn_absenden_hover.gif";
	};
	hovrFormAbsenden.onmouseout = function() {
	this.src="/img/btn_absenden.gif";
	};
	return true;	
}

function hovrFormSuchen() {
	var hovrFormSuchen = document.getElementById("hovrFormSuchen");
	if (!hovrFormSuchen) return false;
	hovrFormSuchen.onmouseover = function() {
	this.src="/img/btn_suchenForm_hover.gif";
	};
	hovrFormSuchen.onmouseout = function() {
	this.src="/img/btn_suchenForm.gif";
	};
	return true;	
}






function hovrMehr() {

	var linkMehr = document.getElementsByClassName("mehr");
	if (!linkMehr) return false;

	for(i=0; i < linkMehr.length; i++){

		linkMehr[i].onmouseover = function() {
		this.src="/img/icon_mehr_hover.gif";
		}
	
		linkMehr[i].onmouseout = function() {
		this.src="/img/icon_mehr.gif";
		}
	}
	
	return true;	
}




/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */
/* alle onload Funktionen hier eintragen */
window.onload = function(){
	hovr1();
	hovr2();
	hovr3();
	hovrMehr();	
	hovrFormEL();	
	hovrFormAbsenden();	
	hovrFormSuchen();
}
