
/* Suchformular Ziel auswählen     */


function set_search_frm_dest()
	{

	
	 var dest_index =  document.getElementById("q_action").selectedIndex;


	 
	 
	 //alert(dest_index);
	

	if(dest_index==1) 
		{
		 dest = "http://www.belohn-dich-mal.de/shopfinder.html";
		}
	
	 else if(dest_index==2)
		{
		 dest = "http://www.belohn-dich-mal.de/lokalsuche.php";
		}
	 else
		{
		 dest = "http://www.belohn-dich-mal.de/suchen.html";
		}

/*

	if(dest_index==1) 
		{
		 dest = "http://localhost/bdm/shopfinder.html";
		}
	
	 else if(dest_index==2)
		{
		 dest = "http://localhost/bdm/lokalsuche.php";
		}
	 else
		{
		 dest = "http://localhost/bdm/suchen.html";
		}

*/



	// alert(dest);
	 	


	 document.getElementById("search_frm").action = dest;
	



	}




/***********************************/

var currentMenu = null;
var mytimer = null;
var timerOn = false;
var opera = window.opera ? true : false;

if (!document.getElementById)
document.getElementById = function() { return null; }

function initialiseMenu(menu, starter, root) {
// var menuId = menu.attributes(0).value;
var leftstarter = false;

if (menu == null || starter == null) return;
currentMenu = menu;

starter.onmouseover = function() {
if (currentMenu) {
if (this.parentNode.parentNode!=currentMenu) {
currentMenu.style.visibility = "hidden";


}



if (this.parentNode.parentNode==root) {
tempCurrentMenu = currentMenu
while (tempCurrentMenu.parentNode.parentNode!=root) {
tempCurrentMenu.parentNode.parentNode.style.visibility = "hidden";
tempCurrentMenu = tempCurrentMenu.parentNode.parentNode;
}
}
currentMenu = null;
this.showMenu();
}
}

menu.onmouseover = function() {
if (currentMenu) {
currentMenu = null;
this.showMenu();
}
} 

starter.showMenu = function() {
if (!opera) {
if (this.parentNode.parentNode==root) {
menu.style.left = this.offsetLeft + "px";
menu.style.top = this.offsetTop + this.offsetHeight + "px";
}
else {
menu.style.left = this.offsetLeft + this.offsetWidth + "px";
menu.style.top = this.offsetTop + "px";
}
}
else {
if (this.parentNode.parentNode==root) {
menu.style.left = this.offsetLeft + "px";
menu.style.top = this.offsetHeight + "px";
}
else {
menu.style.left = this.offsetWidth + "px";
menu.style.top = this.offsetTop + "px";
}

}
menu.style.visibility = "visible";
currentMenu = menu;
}

starter.onfocus = function() {
starter.onmouseover();
}

menu.onfocus = function() {
// currentMenu.style.visibility="hidden";
}

menu.showMenu = function() {
menu.style.visibility = "visible";
currentMenu = menu;
stopTime();
}

menu.hideMenu = function() {
if (!timerOn) {
mytimer = setInterval("killMenu('" + this.id + "', '" + root.id + "');", 500);
timerOn = true;
for (var x=0;x<menu.childNodes.length;x++) {
if (menu.childNodes[x].nodeName=="LI") {
if (menu.childNodes[x].getElementsByTagName("UL").length>0) {
menuItem = menu.childNodes[x].getElementsByTagName("UL").item(0);
menuItem.style.visibility = "hidden";
}
}
}
}
}

menu.onmouseout = function(event) {
this.hideMenu();
}

starter.onmouseout = function() {
for (var x=0;x<menu.childNodes.length;x++) {
if (menu.childNodes[x].nodeName=="LI") {
if (menu.childNodes[x].getElementsByTagName("UL").length>0) {
menuItem = menu.childNodes[x].getElementsByTagName("UL").item(0);
menuItem.style.visibility = "hidden";
}
}
}
menu.style.visibility = "hidden";
}
}
function killMenu(menu, root) {
var menu = document.getElementById(menu);
var root = document.getElementById(root);
menu.style.visibility = "hidden";
for (var x=0;x<menu.childNodes.length;x++) {
if (menu.childNodes[x].nodeName=="LI") {
if (menu.childNodes[x].getElementsByTagName("UL").length>0) {
menuItem = menu.childNodes[x].getElementsByTagName("UL").item(0);
menuItem.style.visibility = "hidden";
}
}
}
while (menu.parentNode.parentNode!=root) {
menu.parentNode.parentNode.style.visibility = "hidden";
menu = menu.parentNode.parentNode;
}
stopTime();
}


function stopTime() 
 {
  if (mytimer) 
    {
     clearInterval(mytimer);
     mytimer = null;
     timerOn = false;
    }
 } 





window.onload = function()
  {
   var root = document.getElementById("menuList");
   getMenus(root, root);
  }





function getMenus(elementItem, root) {
var selectedItem;
var menuStarter;
var menuItem;
for (var x=0;x<elementItem.childNodes.length;x++) {
if (elementItem.childNodes[x].nodeName=="LI") {
if (elementItem.childNodes[x].getElementsByTagName("UL").length>0) {
menuStarter = elementItem.childNodes[x].getElementsByTagName("A").item(0);
menuItem = elementItem.childNodes[x].getElementsByTagName("UL").item(0);
getMenus(menuItem, root);
initialiseMenu(menuItem, menuStarter, root);
}
}
}
}
