// script to preload and control navigation background images // var timeout_id value of the started timeout // var nav_pos stored image names without gif and id's of images in document // var images_arr preload array // var nohide_arr permanent shown images // function swap_image(docimg,imgarr) replace a preloaded image // function navhide_all() hides replaces all navigation background images except nohide_arr[] with transparent pix // function nav_mouse(docimg) replaces background transparent with navigation background, resets navigation and timeout // function nav_show(docimg) shows navigation background permanent // function nav_hide() starts timeout to hide_all in 2000mS // input docimg number of image in document array // input imgarr number of image in images array var timeout_id=0; // preload navigation backgrounds var nav_pos = new Array('profil','projekte','angebot','galerie'); var images_arr = new Array(); var nohide_arr = new Array(); // topnav for (i in nav_pos) { name = nav_pos[i]; nameover = name + "over"; nameout = name + "out"; nohide_arr[name]=false; images_arr[nameover]=new Image; images_arr[nameover].src= "../../_buttons/"+nav_pos[i]+"_over.gif"; images_arr[nameout]=new Image; images_arr[nameout].src="../..//_buttons/"+nav_pos[i]+"_out.gif"; } // define image swap function function swap_image (docimg,imgarr) { if (nn4) { document.layers["indinav"].document.images[docimg].src = images_arr[imgarr].src; } else { document.images[docimg].src = images_arr[imgarr].src; } } // hide all navigation function navhide_all () { if (timeout_id>0) { clearTimeout(timeout_id); timeout_id=0; } hide_layers("indinav"); for (i in nav_pos) { name = nav_pos[i]; nameover = name + "over"; nameout = name + "out"; namelay = "lay" + name; if (!nohide_arr[name]) { swap_image (name,nameout); } else { show_layer(namelay,"indinav"); } } } function nav_hide () { timeout_id = setTimeout ('navhide_all()','2000'); } // show navigation function nav_mouse (name) { // navhide_all (); if (timeout_id>0) { clearTimeout(timeout_id); timeout_id=0; } hide_layers("indinav"); nameover = name + "over"; namelay = "lay" + name; swap_image (name,nameover); show_layer(namelay,"indinav"); } // show navigation initial memory function nav_show (name) { nohide_arr[name] = true; nav_mouse (name); } function subnav_mouse () { if (timeout_id>0) { clearTimeout(timeout_id); timeout_id=0; } }