function showPopup(file,width,height,maxW,url)
{	file=file.src;	
	file=file.split("w__");
	file=file[1];
	
	newwidth=width;
	newheight=height;
	
	ratio=maxW/newwidth;
		
	if (newwidth>maxW)
	{	newwidth=maxW;
		newheight=height*ratio;
	}


	var x=window.open('', 'bigPrev', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+(newwidth)+',height='+(newheight));
	
	x.document.write("<html><head><title>Bild</title>");
	x.document.write('<style type="text/css">');
	x.document.write("html,body{margin:0;padding:0;overflow:hidden;}img{cursor:pointer;}");
	x.document.write("</style></head><body>");

	x.document.write('<img src="'+url+'index.php?rex_resize='+newwidth+'w__'+file+'" alt="" onclick="window.close();">');
	x.document.write("</body></html>");
	x.document.close();
	x.focus();
}


function showVideoPopup(file,w,h)
{	var x=window.open('', 'bigPrev', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+(w+10)+',height='+(h));
	x.document.write("<html><head><title>Bild</title>");
	x.document.write('<style type="text/css">');
	x.document.write("html,body{margin:0;padding:0;overflow:hidden;}img{cursor:pointer;}");
	x.document.write("</style></head><body>");
	
	x.document.write('<object type="video/x-ms-wmv" data="/files/'+file+'?autostart=true&loop=false" width="100%" height="100%"><param name="src" value="/files/'+file+'" /><param name="autostart" value="true" /><param name="controller" value="true" /><param name="loop" value="false" />Ihr Browser kann das Video leider nicht anzeigen!</object>');
	
	x.document.write("</body></html>");
	x.document.close();
	x.focus();
}


function switchPic(width,height,file,displaywidth,popupwidth,url)
{	img=document.getElementById('prodimage').getElementsByTagName('IMG')[0];
	
	img.src='index.php?rex_resize='+displaywidth+'w__'+file;
	img.onclick=function() {	showPopup(img,width,height,popupwidth,url+"/");	};
}



Behaviour.addLoadEvent 
(	function()
	{	// Suckerfish Hovers
		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"), "");
			}
		}
		
		
		// SEF
		sefs=document.getElementsBySelector('a.sef');
		for (i=0;i<sefs.length;i++)
		{	sefs[i].innerHTML="GN2 netwerk";
		}
		
	}
);

var Rules = {
    '.extern' : function(el)
	{	el.onclick = function()
		{    this.setAttribute('target','_blank');
		}
	}	
};

Behaviour.register(Rules);
