function hover(io){
   if(!io.src)io=document.images[io];if(io.src){if(!io.over){
   io.over=io.src.replace(/\.(gif|jpe?g|png)$/i,hover.suffix+".$1");
   io.out=io.src;}io.src=io.over!=io.src?io.over:io.out;}}

hover.suffix = "_on";

function popUp (url,width,height,scroll) {
	if(height>window.screen.height) { var height = window.screen.height-60; var width2 = parseInt(width); width2 += 16; width2 = width2.toString(); var scroll = 'yes'; }
	else { var width2 = width; if(!scroll) var scroll = 'no'; }
	var winl = (screen.width-width2)/2 - 4; var wint = (screen.height-height)/2 + 6;
	var popUp = window.open(url,popUp,"width=" + width2 + ",height=" + height + ",top=" + wint + ",left=" + winl + ",scrollbars=" + scroll + ",menubar=no,location=no,directories=no,resizable=no,status=no");
	popUp.focus();

	return false;
}

speed=1;
var dir;
x=false;
function rolle(e,d)
{
	if(d){if(e<0){dir=false;return;}dir=new Array(0,0);dir[e]=d*speed;	}
	if(e&&e<0){dir=false;}
	if(!dir){return;}
	subnavi = document.getElementById('subnavi');
	subnavi.scrollBy(dir[0],dir[1]);
	setTimeout("rolle()",10);
}


function popit(url,width,height,scroll) {
	var winl = (screen.width-width)/2 - 4;
	var wint = (screen.height-height)/2 + 6;

	if(scroll=="") var scroll = "auto";
	var pic = window.open(url,pic,"width=" + width + ",height=" + height + ",top=" + wint + ",left=" + winl + ",scrollbars=" + scroll + ",menubar=no,location=no,directories=no,resizable=no,status=no");
	pic.focus();
}


var Geladen = false;
var hidetime;
var hidetime2;


function hideMenu(menu){
	if(Geladen)
		document.getElementById(menu).style.visibility='hidden';
}

function showMenu(menu){
	if(Geladen){
		for(var i=1;i<10;++i){
			if(i!=menu && document.getElementById('subnav_'+i))
				hideMenu('subnav_'+i);
		}
		window.clearTimeout(hidetime);
		window.clearTimeout(hidetime2);
		document.getElementById(menu).style.visibility='visible';
	}
}

function menuTimer(menu,start){
	if(Geladen)
		hidetime = window.setTimeout("hideMenu('"+menu+"')",1000);
		if(start!="hurtz") hidetime2 = window.setTimeout("showMenu('akt')",1000);
}


ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
ns6 = (document.getElementById)? true:false

function Show(Divname) {
	if(ns4) document[Divname].visibility = "show";
	else if(ns6) document.getElementById(Divname).style.visibility = "visible";
	else if(ie4) document.all[Divname].style.visibility = "visible";
}

function Hide(Divname) {
	if(ns4) document[Divname].visibility = "hide";
	else if(ns6) document.getElementById(Divname).style.visibility = "hidden";
	else if(ie4) document.all[Divname].style.visibility = "hidden";
}
function Hideall() {
	for(var i=0;i<17;++i){
		if(ns4) document['box'+i].visibility = "hide";
		else if(ns6) document.getElementById('box'+i).style.visibility = "hidden";
		else if(ie4) document.all['box'+i].style.visibility = "hidden";
	}
}



var interval;
lauf = function(id_name, amount, direction) {
	if(interval) { clearInterval(interval); }
	interval = setInterval(function() {
		switch(direction) {
		case "right": move_right(); break;
		case "left": move_left(); break;
		case "down": move_down(); break;
		case "up": move_up(); break;
		}
	}, 10);
	function move_right() { document.getElementById(id_name).scrollLeft = document.getElementById(id_name).scrollLeft-amount; }
	function move_left() { document.getElementById(id_name).scrollLeft = document.getElementById(id_name).scrollLeft+amount; }
	function move_down() { document.getElementById(id_name).scrollTop = document.getElementById(id_name).scrollTop+amount; }
	function move_up() { document.getElementById(id_name).scrollTop = document.getElementById(id_name).scrollTop-amount; }
}
lauf_stop = function() { if(interval) { clearInterval(interval); }  }


var px = 5;//mehr=schneller

var timer;
function ScrollDiv(val){
	clearTimeout(timer);
	d=document.getElementById('subnaviscroller');
	y=d.scrollTop;
	h=d.scrollHeight;
	o=d.offsetHeight;
	if(val==1)y-=px;
	if(val==2)y+=px;
	if(val==3)y-=2*px;
	if(val==4)y+=2*px;
	if(y <= h-o+px && y >= 0-px){
		d.scrollTop=y;
		timer=setTimeout('ScrollDiv('+val+')',50);
	}
	if(y<0||y>d.scrollHeight-d.offsetHeight){
		clearTimeout(timer);
	}
}


var timer2;
function ScrollTopDiv(val){
	clearTimeout(timer2);
	d=document.getElementById('topscroller');
	y=d.scrollTop;
	h=d.scrollHeight;
	o=d.offsetHeight;
	if(val==1)y-=px;
	if(val==2)y+=px;
	if(val==3)y-=2*px;
	if(val==4)y+=2*px;
	if(y <= h-o+px && y >= 0-px){
		d.scrollTop=y;
		timer2=setTimeout('ScrollTopDiv('+val+')',50);
	}
	if(y<0||y>d.scrollHeight-d.offsetHeight){
		clearTimeout(timer2);
	}
}


var timer3;
function ScrollBottomDiv(val){
	clearTimeout(timer3);
	d2=document.getElementById('bottomscroller');
	y2=d2.scrollTop;
	h2=d2.scrollHeight;
	o=d2.offsetHeight;
	if(val==1)y2-=px;
	if(val==2)y2+=px;
	if(val==3)y2-=2*px;
	if(val==4)y2+=2*px;
	if(y2 <= h2-o+px && y2 >= 0-px){
		d2.scrollTop=y2;
		timer3=setTimeout('ScrollBottomDiv('+val+')',50);
	}
	if(y2<0||y2>d2.scrollHeight-d2.offsetHeight){
		clearTimeout(timer3);
	}
}


// popup fenster welches in der mitte des bildschirms zentriert,
// und falls zu gross für die entsprechende auflösung angepasst wird.
function PopThis(url,width,height,name,scroll){
	if(height>window.screen.height) { var height = window.screen.height-60; var width2 = parseInt(width); width2 += 16; width2 = width2.toString(); var scroll = 'yes'; }
	else { var width2 = width; if(!scroll) var scroll = 'no'; }
	if(!name) var name = 'popup';

	var winl = (screen.width-width2)/2 - 4; var wint = (screen.height-height)/2 + 6;
	var PopThis = window.open(url,name,"width=" + width2 + ",height=" + height + ",top=" + wint + ",left=" + winl + ",scrollbars=" + scroll + ",menubar=no,location=yes,directories=no,resizable=no,status=no");
	PopThis.focus();
}


function zoomFenster(ware_id){
	PopThis('zoom.php?ware_id='+ware_id+'&img_id='+img_id, '555', '740', 'artikel_detail');
}


