browser_name = navigator.appName;
browser_version = parseFloat(navigator.appVersion); 

if (browser_name == "Netscape" && browser_version >= 3.0) { 
	roll = 'true'; 
}
else if (browser_name == "Microsoft Internet Explorer" && browser_version >= 3.0) {
	 roll = 'true'; 
}
else { 
	roll = 'false'; 
}

function msover(img,ref) { 
	if (roll == 'true') {
		document.images[img].src = ref; 
	} 
}

function msout(img,ref)  { 
	if (roll == 'true') { 
		document.images[img].src = ref; 
	} 
}

function hideimg(img) {
	document.images[img].width = 0;
	document.images[img].height = 0;
}

function showimg(img,ref) {
	document.images[img].width = 59;
	document.images[img].height = 12;
}	 
			 
var imgslist = new Array("images/arrowl_black.gif","images/arrowr_black.gif");

var imgs=new Array();

if (document.images)
	for (x=0; x<imgslist.length; x++) {
		imgs[x] = new Image(); 
		imgs[x].src = imgslist[x];
	}
	
function getInnerWidth() {
	var innerWidth=0;
	/*
	if (navigator.appName=="Netscape") {
 		//innerWidth=frames['iFrame'].innerWidth;
 		innerWidth=document.getElementById('catalog').offsetWidth;
 	}
 	else {
 		//innerWidth=document.body.offsetWidth;
 		innerWidth=document.getElementById('catalog').offsetWidth;
 	}
 	*/
 	innerWidth=document.getElementById('catalog').offsetWidth;
 	//alert(innerWidth);
 	return parseInt(innerWidth/320) * 320;
}

function NachLinks() {
	var x=0;
	var innerWidth=0;
			
	innerWidth=getInnerWidth();
	while (x < innerWidth)	{
		window.setTimeout("document.getElementById('catalog').scrollLeft-=2",5);
		x = x + 3;
	}
}

function NachRechts() {
	var x=0;
 	var innerWidth=0;

	innerWidth=getInnerWidth()
 	while (x < innerWidth)	{
		window.setTimeout("document.getElementById('catalog').scrollLeft+=2",5);
		x = x + 3;
	}
}

function goUrlPos() {
	goPos(getUrlValue("pos"));
}

function goPos(iPos) {
	/*window.scrollBy(iPos,0);*/
	document.getElementById('catalog').scrollLeft=iPos;
}

function goParentUrlPos() {
	goPos(getParentUrlValue("pos"));
}

function getUrlValue(iKey) {
	var params = window.parent.location.search.slice(1).split("/");
	var pKey = "";
	var pVal = "0";
	
	for(var i = 0; i < params.length; i++) {
		pKey = params[i].slice(0, params[i].indexOf("="));
		if(pKey == iKey) {  
			pVal = params[i+1];
		}
	}		
	return pVal;		
}

function getUrlValue(iKey) {
	var params = window.location.search.slice(1).split("&");
	var pKey = "";
	var pVal = "";
	
	for(var i = 0; i < params.length; i++) {
		pKey = params[i].slice(0, params[i].indexOf("="));
		if(pKey == iKey) {  
			pVal = params[i].slice(params[i].indexOf("=") + 1);
		}
	}		
	return pVal;		
}

var myimages=new Array()

function preloadimages(){
	for (i=0;i<preloadimages.arguments.length;i++){
		myimages[i]=new Image()
		myimages[i].src=preloadimages.arguments[i]
	}
}

var px = 2;//mehr=schneller 
var timer; 

function scrollcatalog(val){ 
	clearTimeout(timer); 
	d = document.getElementById('catalog');
	x = d.scrollLeft; 
	if(val==1)x-=px; 
	if(val==2)x+=px; 
	if(x<=d.scrollWidth-d.offsetWidth+px&&x>=0-px){ 
		d.scrollLeft=x; 
		timer=setTimeout('scrollcatalog('+val+')',3); 
	} 
	if(x<0||x>d.scrollWidth-d.offsetWidth){ 
		clearTimeout(timer); 
	} 
} 

function showmenu($button, $menu) {
	var pos = getPosition($button);
	hidemenu('biedermeier');
	hidemenu('barock');
	hidemenu('sonderaktion');
	document.getElementById($menu).style.left=pos.x - 10 + 'px';
	document.getElementById($menu).style.top=pos.y + 25 + 'px';
	document.getElementById($menu).style.display='block';
}

function hidemenu($menu) {
	document.getElementById($menu).style.display='none';
}

function getPosition(objname) {
  var pos = { x:0, y:0 };
	obj = (document.getElementById(objname));
  do {
    pos.x += obj.offsetLeft;
    pos.y += obj.offsetTop;
  } while (obj = obj.offsetParent);

  return pos;
}