// JavaScript Document
var closebutton = "./images/icons/close.gif"; //Adress of image of the button

var popup, xtra, ytra;

function drag() {
	if (event.button!=1)return;	
	popup = eval("maildiv");
	temp1=popup.style.posLeft;
	temp2=popup.style.posTop;
	xpos=event.clientX;
	ypos=event.clientY;
	xtra = temp1-xpos;
	ytra = temp2-ypos;
	document.onmousemove=place;
}

function place() {
	if (event.button==1){
		popup.style.pixelLeft=event.clientX+xtra;
		popup.style.pixelTop=event.clientY+ytra;
		return false;
	}
}

function popupwindow_upload(inside, color, width, height, background) {
	titlecolor = "black";
	opacity = 90;
	if(!width) {
		width = 500;
		height = 325;
	}
	if(inside.indexOf(".htm") > inside.length -6) inside = "<iframe frameborder=0 name=\"popup\" width="+(width-10)+" height="+(height-30)+" src=\""+inside+"\" scrolling=\"no\" ></iframe>"; 
	if(!color) color = "silver";
	var thisspan = eval("maildiv.style")
	thisspan.pixelLeft = document.body.scrollLeft + 250;		
	thisspan.pixelTop =  document.body.scrollTop + 100;
	thisspan.visibility="visible";
	output = "<table cellpadding=0 cellspacing=0 width=" + width + " height=" + height + " border=3><tr>";
	output += "<td onmousedown='drag()' style='cursor:hand' onmouseup='javascript:document.onmousemove=\"\" ' bgcolor='"+color+"' style='filter:alpha(opacity="+opacity+");' width =" + width + " height=20></td>";
	output += "<td bgcolor="+color+">";
	output += "<input type='image' alt=\"Close\" onclick='closepopup()' src='"+closebutton+"'>";
	output += "</td></tr><tr>";
	output += "<td width=100% colspan=2><table "; 
	if(background)output += "style='background-image:url(\" " + background + "\")'";
	output += " width=100% height=100% style='filter:alpha(opacity="+opacity+");' bgcolor='"+color+"'>";
	output += "<tr><td height=100% width=100% >";
	output += inside;
	output += "</td></tr></table></td></tr>";
	maildiv.innerHTML = output;
}

function closepopup() {
	maildiv.style.visibility="hidden";
}

