/**
***************************************************************************
*       @developed by 	Mediafamily SRL,
* 						web: http://www.mediafamily.ro
* 						email: office@mediafamily.ro
* 						address:	str Tudor Vladimirescu nr. 63/14, 540014, Targu Mures, Romania
*
*		Displays the ajax status messages (loading, Ok, Error)
*		This script make uses of prototype and scriptaculous JS libraries.
***************************************************************************
*/

var mPosX, mPoxY;

function showOkWindow(){

	// display the ajax return message at the cursord position
	msgContainer = $('ajax_result_box');
	//msgContainer.style.display =  'block';
//	msgContainer.innerHTML = '<img src="/modules/cms_system/includes/images/ajax_ok.gif" width="16" height="16">';
	Effect.Fade('ajax_result_box');
}

function showOkWindow2(){

	// display the ajax return message at the cursord position
	msgContainer = $('ajax_result_box2');
//	msgContainer.style.display =  'block';
	//msgContainer.innerHTML = '<img src="/modules/cms_system/includes/images/ajax_ok.gif" width="16" height="16">';
	Effect.Fade('ajax_result_box2');
}

function hideMsgWindow(){

	// show a X image
	msgContainer = $('ajax_result_box');
	//msgContainer.innerHTML = '<img src="/modules/cms_system/includes/images/ajax_error.gif" width="16" height="16">';
	Effect.Fade('ajax_result_box');
}


function showSpinnerWindow(){

	// show a X image
	msgContainer = $('ajax_result_box');
//	msgContainer.style.display =  'block';
	//msgContainer.innerHTML = '<img src="/modules/cms_system/includes/images/spinner.gif" width="16" height="16">';
}

function getMousePosition(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;
	}

	mPosX = posx+15;
	mPosY = posy;

	// set the position of the message window
	msgContainer = $('ajax_result_box');
	msgContainer.style.left = mPosX  + 'px';
	msgContainer.style.top = mPosY  + 'px';
}

//barnib - test suite
function getMousePosition2(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;
	}

	mPosX = posx/2;
	mPosY = posy/2;

	// set the position of the message window
	msgContainer = $('ydetails');
	msgContainer.style.left = mPosX  + 'px';
	msgContainer.style.top = mPosY  + 'px';
}
