
// You can edit the following:



// the width of the window
var
 exc_width = 420;

// the height of the window
var exc_height = 290;

// the html file that will be loaded into the window
var exc_htmlfile = 'excwindow.html';

//the border color
var exc_bordercolor = '#CC0000';

///////////////////////////////////////////////////////
/////// DO NOT EDIT BELOW THIS LINE ///////////////////
///////////////////////////////////////////////////////

function getposxy(e)
{
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft	+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop 	+ document.documentElement.scrollTop;
	}
	exc_x = posx - exc_width/2;
	exc_y = posy - exc_height/2;
	if(exc_x < document.body.scrollLeft) exc_x = document.body.scrollLeft + 10;
	if(exc_y < document.body.scrollTop ) exc_y = document.body.scrollTop + 10;
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			exc_winW = window.innerWidth-16  + document.body.scrollLeft;
			exc_winH = window.innerHeight-16 + document.body.scrollTop;
		}
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			exc_winW = document.body.offsetWidth-20 + document.body.scrollLeft	+ document.documentElement.scrollLeft;
			exc_winH = document.body.offsetHeight-20 + document.body.scrollTop + document.documentElement.scrollTop;
		}
	}
}
function click(e)
{
	getposxy(e);
	if(
	(navigator.appName == 'Netscape') &&
	(e.which == 3)
	)
	{
		openWindow();
		return true;
	}
	else
	{
		if(navigator.appName == 'Microsoft Internet Explorer' && event.button==2)
		{
			openWindow();
			return true;
		}
	}
	return true;
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}

var excwind = null;
var exc_x = 100;
var exc_y = 100;
var exc_winH = 500;
var exc_winW = 700;

addLoadEvent(function() {
	if (document.layers) {
		document.captureEvents(Event.MOUSEDOWN);
	}
	document.onmousedown = click;
	document.oncontextmenu = function(){return false;};
	
	x = document.createElement('div');
	x.setAttribute('id','excwind');
	document.body.appendChild(x);
	xtext = "<div style='border:1px solid "+exc_bordercolor+" !important;text-align:right !important;background:#ffffff !important;padding:5px !important;'><a href='#' style='font-family:verdana !important;font-weight:bold !important;font-size:13px !important;color:#cc0000 !important;' onClick='closeWindow(); return false;'>[Close]</a></div>";
	xtext += "<iframe style='border:1px solid "+exc_bordercolor+";background:white;' oncontextmenu='return false;' id='exc_iframe' name='exc_iframe' border='0' src='"+exc_htmlfile+"' width='"+(exc_width-2)+"' height='"+(exc_height-30)+"'></iframe>";
	xtext += "";
	x.innerHTML = xtext;
	x.style.display = 'block';
	x.style.position = 'absolute';
	x.style.top = '-1000px';
	x.style.left = '-1000px';
	x.style.background = '#ffffff';
	x.style.width = exc_width+'px';
	x.style.height = exc_height+'px';
	excwind = x;
});

function openWindow()
{
	x = excwind;
	if(exc_x + exc_width > exc_winW) { exc_x = exc_winW - exc_width -5 };
	if(exc_y + exc_height > exc_winH) { exc_y = exc_winH - exc_height -5 };
	x.style.top = exc_y + 'px';
	x.style.left = exc_x + 'px';
	x.style.display = 'block';
	window.frames['exc_iframe'].document.oncontextmenu = function(){return false;};
	return false;
}
function closeWindow()
{
	excwind.style.display = 'none';
	return false;
}