/* Verschiedene JavaScript Funktionen */

function swap(id,url) {
	document.getElementById(id).src = url;
}


var BildNr = 1;


function change(bild) {
	document.getElementById('produktbild').src = "images/produkte/" + bildnamen[bild];
}
		
function JumpMenu(sel) {
	self.location = sel.options[sel.selectedIndex].value;
	sel.selectedIndex = 0;
	this.focus();
}
		
function changeDisplay(bMakeVisible, sId) {
	obj = document.getElementById(sId);
	if (obj != null) {
		if(document.forms['add'].elements['land'].value == "US") {
			obj.style.display = (true) ? 'block' : 'none';
			return true;
		} else {
			obj.style.display = (bMakeVisible) ? 'block' : 'none';
			return true;
		}
	} else {
		return false;
	}
}	
				
function adjust_popup(){

        var w, h, fixedW, fixedH, diffW, diffH;

        if (document.all) {
                fixedW = document.body.clientWidth;
                fixedH = document.body.clientHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - document.body.clientWidth;
                diffH = fixedH - document.body.clientHeight;
        } else {
                fixedW = window.innerWidth;
                fixedH = window.innerHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - window.innerWidth;
                diffH = fixedH - window.innerHeight;
        }
        w = fixedW + diffW;
        h = fixedH + diffH;
        if (h >= screen.availHeight) w += 16;
        if (w >= screen.availWidth)  h += 16;
        w = Math.min(w,screen.availWidth);
        h = Math.min(h,screen.availHeight);
        window.resizeTo(w,h);
        window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);
}

	function show_Win(url,breite,hoehe){
 	x = (screen.width/2-breite/2); 
 	y = (screen.height/2-hoehe/2);
 	position='screenX='+x+',screenY='+y+',left='+x+',top='+y;
 	F1 = open(url,'ndhdfos','width='+breite+',height='+hoehe+',resizable=yes,scrollbars=yes,status=no,'+position);
	}

 sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

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

	Script		: Overlay
	Version		: 1.2
	Authors		: Samuel birch
	Desc		: Covers the window with a semi-transparent layer.
	Licence		: Open Source MIT Licence

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

var Overlay = new Class({

	getOptions: function(){
		return {
			colour: '#000',
			opacity: 0.7,
			zIndex: 11000,
			container: document.body,
			onClick: Class.empty
		};
	},

	initialize: function(options){
		this.setOptions(this.getOptions(), options);

		this.options.container = $(this.options.container);

		this.container = new Element('div').setProperty('id', 'OverlayContainer').setStyles({
			position: 'absolute',
			left: '0px',
			top: '0px',
			width: '100%',
			zIndex: this.options.zIndex
		}).injectInside(this.options.container);

		this.iframe = new Element('iframe').setProperties({
			'id': 'OverlayIframe',
			'name': 'OverlayIframe',
			'src': 'javascript:void(0);',
			'frameborder': 1,
			'scrolling': 'no'
		}).setStyles({
			'position': 'absolute',
			'top': 0,
			'left': 0,
			'width': '99.75%',
			'height': '100%',
			'filter': 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)',
			'opacity': 0,
			'zIndex': 11000
		}).injectInside(this.container);

		this.overlay = new Element('div').setProperty('id', 'Overlay').setStyles({
			position: 'absolute',
			left: '0px',
			top: '0px',
			width: '100%',
			height: '100%',
			zIndex: 11002,
			backgroundColor: this.options.colour
		}).injectInside(this.container);

		this.container.addEvent('click', function(){
			this.options.onClick();
		}.bind(this));

		this.fade = new Fx.Style(this.container, 'opacity').set(0);
		this.position();

		window.addEvent('resize', this.position.bind(this));
	},

	position: function(){
		if(this.options.container == document.body){
			var h = window.getScrollHeight()+'px';
			this.container.setStyles({top: '0px', height: h});
		}else{
			var myCoords = this.options.container.getCoordinates();
			this.container.setStyles({
				top: myCoords.top+'px',
				height: myCoords.height+'px',
				left: myCoords.left+'px',
				width: myCoords.width+'px'
			});
		}
	},

	show: function(){
		this.fade.start(0,this.options.opacity);
	},

	hide: function(){
		this.fade.start(this.options.opacity,0);
	}

});
Overlay.implement(new Options);

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


