/**
***************************************************************************
*       @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="/images/ajax_ok.gif" width="16" height="16">';
	Effect.Fade('ajax_result_box');
}


function hideMsgWindow(){

	// show a X image
	msgContainer = $('ajax_result_box');
	msgContainer.innerHTML = '<img src="/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="/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';
}

