var nieuwwindow=""

function makeNewWindow(URL,height,width) {
  if(!nieuwwindow || nieuwwindow.closed) {
  	if(height == null) {
		height = 540;
	}
	
	if(width == null) {
		width= 650;
	}
	
    nieuwwindow=window.open(URL,"","height="+ height +",width="+width+",alwaysRaised=yes,resizable=no,toolbar=no,scrollbars=yes,status=no,copyhistory=no,menubar=no,location=no")
	if(!nieuwwindow.opener) {
	  nieuwwindow.opener=window
	}
  } else {
    nieuwwindow.location=URL;
    nieuwwindow.focus();
  }
}
function ShowEnlarged(image,text) 
{
	var Content=CreateContent(image,text);
  if(nieuwwindow=="" || nieuwwindow.closed){
		var height = 540;
		var width= 626;
	
	  nieuwwindow=window.open("","","height="+ height +",width="+width+",alwaysRaised=yes,resizable=no,toolbar=no,scrollbars=no,status=no,copyhistory=no,menubar=no,location=no,titlebar=no")
		if(!nieuwwindow.opener) {
			nieuwwindow.opener=window;
			}
	}
  nieuwwindow.document.write(Content);
	nieuwwindow.document.close();
  nieuwwindow.focus();
}
function CreateContent(image,text)
{
	var img="images_groot/"+image;
	var Content="<html><head><title>";
	Content+=text;
	Content+="</title>";
	Content+="<link rel=\"stylesheet\" href=\"../styles/Styles.css\" type=\"text/css\">";
	Content+="</head>";
	Content+="<body onload=\"setTimeout('window.close()',20000)\" bgcolor=\"#FFFFFF\" text=\"#000000\">";
	Content+="<div id=\"main\" style=\"position:absolute; width:600px; height:300px; z-index:1; left: 5px; top: 5px\">";
	Content+="<table width=\"100%\" cellspacing=\"0\" cellpadding=\"1\" class=\"table_border\">";
	Content+="<tr><td align=\"center\" class=\"bgrechts\">";
	Content+="<img src=";
		Content+=img;
	Content+=">";
	Content+="<p align=\"center\" class=\"kop1\">";
		Content+=text;
	Content+="<br><a href=\"javascript:window.close()\" class=\"link\"> << sluiten >> </a></p>";
	Content+="</td></tr></table><p align=\"center\" class=\"smalltekst\">&copy;1998-2005 Sinus Software. Alle rechten voorbehouden.";
	Content+="</p></div></body></html>"
	return Content
}

function getDivStyle() 
{
	var divStyle="";
	if(NS4||NS6||IE4)
  {
    if(NS4) divStyle = document.divlarge.style;
    else if(NS6)
		{
			divStyle = document.getElementById("divlarge").style;
		}
    else if(IE4) divStyle = document.all.divlarge.style;
		if(NS4) 
		{
			return "";
		}
  }
	return divStyle;
}
function EnlargeImage(imgName, imgSrc) 
{
	divStyle=getDivStyle();
	if (divStyle=="")
		return;

	if (document.images)
  {
    if (imgSrc == "none" || EnlargeImage.arguments.length < 2) // hide
    {
	 	 divStyle.visibility = "hidden";
    }
		else
		{
			divStyle.visibility = "visible";
			//document.write(divStyle.top+" "+ document.body.scrollTop+" "+(document.body.clientHeight/2)+" divheight:"+divStyle.height+" 					"+window.innerHeight);
// Window dimensions:
		var theWidth, theHeight;
		if (window.innerWidth)
		theWidth=window.innerWidth;
		else if (document.documentElement && document.documentElement.clientWidth)
		theWidth=document.documentElement.clientWidth;
		else if (document.body)
		theWidth=document.body.clientWidth;
	
		if (window.innerHeight)
		theHeight=window.innerHeight;
		else if (document.documentElement && document.documentElement.clientHeight)
		theHeight=document.documentElement.clientHeight;
		else if (document.body)
		theHeight=document.body.clientHeight;
	
		// Window origin
		var originX, originY;
		if (window.innerHeight) {
		originX=screenX+(window.outerWidth-window.innerWidth);
		originY=screenY+(window.outerHeight-window.innerHeight);
		}
		else {
		originX=screenLeft;
		originY=screenTop;
		}
	
		var X = theWidth/2;
		var Y = theHeight/2;
	
//	if (NS4 ||NS6)
//				divStyle.top=10+document.body.scrollTop+window.innerHeight/2-300;// was 60+
//			else
//			{
//				divStyle.top=10+document.body.scrollTop+document.body.clientHeight/2-500;
//				if (divStyle.top<1) divStyle.top=1;//divStyle.top=10+(document.body.offsetHeight)/2;
//				document.write("client:"+document.body.clientHeight+" offset:"+document.body.offsetHeight);
//			}
				var scrollpos=0;
			if (document.documentElement && !document.documentElement.scrollTop)
				scrollpos=document.documentElement.scrollTop;
			// IE6 +4.01 but no scrolling going on
			else if (document.documentElement && document.documentElement.scrollTop)
				scrollpos=document.documentElement.scrollTop;
			// IE6 +4.01 and user has scrolled
			else if (document.body && document.body.scrollTop)
				scrollpos=document.body.scrollTop;
			
			// IE5 or DTD 3.2v
			var newImage="/productinfo/images_groot/"+imgSrc;
			//document.write("client:"+X+" offset:"+Y+"scrolltop"+scrollpos);
			divStyle.top=originY-100+scrollpos;
			document.images[imgName].src = newImage;
		}
	}
}
function HideEnlarge() 
{
	var divStyle=getDivStyle();
	if (divStyle!="")
	{
		divStyle.visibility="hidden";
	}
}
