var raampje, xtra, ytra;

function sleepen()
{
	if (event.button != 1)
	{
		return;	
	}
	raampje = eval("maildiv");
	temp1 = raampje.style.posLeft;
	temp2 = raampje.style.posTop;
	xpos = event.clientX;
	ypos = event.clientY;
	xtra = temp1 - xpos;
	ytra = temp2 - ypos;
	document.onmousemove = plaats;
}

function plaats()
{
	if (event.button == 1)
	{
		raampje.style.pixelLeft = event.clientX + xtra;
		raampje.style.pixelTop = event.clientY + ytra;
		if (raampje.style.pixelLeft <= 0)
		{
			raampje.style.pixelLeft = 0;
		}
		if (raampje.style.pixelLeft >= 200)
		{
			raampje.style.pixelLeft = 200;
		}
		if (raampje.style.pixelTop <= 0)
		{
			raampje.style.pixelTop = 0;
		}
		return false;
	}
}

function raam(inside, color, width, height, background, title)
{		
	titlecolor = "#C70066"; 						

	if (!title)
	{
		title = "WIPEsoft";
	}
	
	if (!width) 
	{
		width = 500;            					
		height = 325;
	}								

	inside = "<iframe frameborder=0 name=\"raampje\" width=\"100%\" height=\"100%\" src=\""+inside+"\" scrolling=\"Auto\"></iframe>"; 

	maildiv.style.pixelLeft = document.body.scrollLeft + 20;	
	maildiv.style.pixelTop =  document.body.scrollTop + 20;
	maildiv.style.visibility = "visible";
	output = "";
	
	output += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-style:solid; border-width: 1px; border-color:#000000;\">\n";
	output += "<tr><td>\n";
	output += "<table cellpadding=\"0\" cellspacing=\"0\" width=\""+width+"\" height=\""+height+"\" border=\"0\">\n";
	output += "<tr style=\"cursor:hand\">\n";
	output += "<td style='font-size:10pt' onmousedown=\"sleepen()\" onmouseup=\"JavaScript:document.onmousemove=''\" bgcolor=\""+color+"\" width =\""+width+"\" height=\"25\"><font color='#ffffff'><b>&nbsp;"+title+"</b></font></td>\n";
	output += "<td bgcolor="+color+" style=\"cursor:hand\" nowrap><input type=\"image\" alt=\"sluiten\" onclick=\"closeraam();\" src=\"../layout/b_sluiten.gif\" width=\"15\" height=\"11\" align=\"absmiddle\"><span onclick=\"closeraam();\" style=\"color:#ffffff; font-size:11px;\" onmouseover=\"this.style.cursor='hand'\" onmouseout=\"this.style.cursor='default'\">Sluiten&nbsp;</span></td>\n";
	output += "</tr>\n";
	output += "<tr><td width=100% colspan=2><table ";   

	if (background) 
	{
		output += "style='background-image:url(\" " + background + "\")'";
	}

	output += " cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=100% height=100% bgcolor=\"#FFFFFF\"><tr><td height=100% width=100%>"+ inside+"</td></tr></table></td></tr></td></tr></table>";
//	alert(inside);
//	alert(output);
	maildiv.innerHTML = output;
}

function closeraam() 
{
	maildiv.style.visibility="hidden";
}

function popupintern(site,title,color)
{
	if (!color) 
	{
		color = "1C2977";
	}

	// Html die weergegeven dient te worden als geen input file is meegegeven.
	outp = "";
	outp += "<center><h2>404 error:</h2>";
	outp += "Waarschijnlijk is de pagina die je wil opvragen momenteel in bewerking en/of";
	outp += "is deze om bepaalde redenen weggehaald<br>";
	outp += "Probeer het later nogmaals.<br><br>";
	outp += "Vriendelijke groeten, WIPEsoft";

	// Roep de functie 'raam' aan met parameters html, achtergrondkleur, 
	// hoogte van de div, breedte van de div, en eventueel een achtergrond image
	raam(site, color, 500, 300, "", title);
}

function popupactueel(page)
{
	// Html die weergegeven dient te worden als geen input file is meegegeven.
	outp = "";
	outp += "<center><h2>404 error:</h2>";
	outp += "Waarschijnlijk is de pagina die je wil opvragen momenteel in bewerking en/of";
	outp += "is deze om bepaalde redenen weggehaald<br>";
	outp += "Probeer het later nogmaals.<br><br>";
	outp += "Vriendelijke groeten, WIPEsoft";

	// Roep de functie 'raam' aan met parameters html, achtergrondkleur, 
	// hoogte van de div, breedte van de div, en eventueel een achtergrond image
	raam(page, "#1C2977", 500, 300);
}

function refresh(page)
{
	parent.popupactueel(page);
}
