function popupWindow( mypage,myname,w,h,features)
{
	if(screen.width)
	{
		var winl = (screen.width-w)/2;
		var wint = (screen.height-h)/2;
	}
	else
	{
		winl = 0;wint =0;
	}
	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;
	var settings = 'height=' + h + ',';
	settings += 'width=' + w + ',';
	settings += 'top=' + wint + ',';
	settings += 'left=' + winl + ',';
	settings += features;
	win = window.open(mypage,myname,settings);
	win.window.focus();
}

function isNumeric( input )
{
		if ( parseInt(input, 10) != input ) return false;
		return true;
}

function isEmpty( input )
{
		if ( input == '' ) return true;
		return false;
}

function ConfirmRedirect ( question, positive_url )
{
	if ( confirm(question) )
	{
		this.window.location = positive_url;
	}
}

function showElement( eleName )
{
	
	solu_pickObject(eleName).style.display = '';
}

function hideElement( eleName )
{
	solu_pickObject(eleName).style.display = 'none';
}

var mousePosX = 0;
var mousePosY = 0;
function getMousePosition(e) 
{
	if (!e) var e = window.event;
	if (e.pageX || e.pageY)
	{
		mousePosX = e.pageX;
		mousePosY = e.pageY;
	}
	else if (e.clientX || e.clientY)
	{
		mousePosX = e.clientX + document.body.scrollLeft;
		mousePosY = e.clientY + document.body.scrollTop;
	}
	return true;
}
document.onmousemove = getMousePosition;

function showConfirmationMessage( title, message, but1, but2 )
{
	// inital position
	height = 140;
	width = 400;
	posTop = mousePosY - height;
	posLeft = mousePosX - width;
	
	// max left pos
	if ( posLeft > 600 ) posLeft = 600;

	// if values are minus (should never happend) set to zero
	if ( posTop < 0 ) posTop = 0;
	if ( posLeft < 0 ) posLeft = 0;

	solu_pickObject('iframe_popup_holder').style.display = '';
	var tmp = '<iframe ID="iframe1" marginheight="0" marginwidth="0" frameborder="no" scrolling="no" style="width:' + width + 'px;height:' + height + 'px;position:absolute;top:' + posTop + ';left:' + posLeft + ';border:0px" SRC="/admin/includes/confirmation_iframe.aspx?strTitle=' + title + '&amp;strMessage=' + message + '&amp;strButton1=' + but1 + '&amp;strButton2=' + but2 + '"/>';
	solu_pickObject('iframe_popup_holder').innerHTML = tmp;
}

function showOkMessage( title, message )
{
	showConfirmationMessage( title, message, '', 'Ok' );
}

function showErrorMessage( title, message )
{
	showConfirmationMessage( title, message, '', 'Ok' );
}

function popupLayer( url, width, height )
{
	// inital position
	posTop = mousePosY - height;
	posLeft = mousePosX - width;
	
	// max left pos
	if ( posLeft > 600 ) posLeft = 600;

	// if values are minus (should never happend) set to zero
	if ( posTop < 0 ) posTop = 0;
	if ( posLeft < 0 ) posLeft = 0;

	solu_pickObject('iframe_popup_holder').style.display = '';
	var tmp = '<iframe ID="iframe1" marginheight="0" marginwidth="0" frameborder="no" scrolling="no" style="width:' + width + 'px;height:' + height + 'px;position:absolute;top:' + posTop + ';left:' + posLeft + ';border:0px" SRC="' + url + '"/>';
	solu_pickObject('iframe_popup_holder').innerHTML = tmp;
}

function hidePopupLayer( )
{
	solu_pickObject('iframe_popup_holder').innerHTML = '';
	solu_pickObject('iframe_popup_holder').style.display = 'none';

	// re-activat mouse positioning
	this.document.onmousemove = getMousePosition;
}

function solu_pickObject(name) {
	// First let's test for the W3C DOM Level 1
	if (document.getElementById) {
		return document.getElementById(name)
	} // OK, back to DOM Level 0. Is it IE and similar ?
	else if (document.all) {
		return document.all[name]
	} // Still DOM 0, Is it Netscape and similar?
	else if (document.layers) {
		return document.layers[name]
	} // If none of these match then we return null
	else {
		return null
	}
}

