/**
***************************************************************************
*       @developed by 	Mediafamily SRL,
* 						web: http://www.mediafamily.ro
* 						email: office@mediafamily.ro
* 						address:	str Tudor Vladimirescu nr. 63/14, 540014, Targu Mures, Romania
*
*		This script make uses of prototype and scriptaculous JS libraries.
***************************************************************************
*/


function showCheckBoxResponse(response)
{
		var s = response.responseText;
		var res = s.split(",");
		var group = res[0];
		var id = res[1];
		var index = res[2];
		var message = res[3];

		showOkWindow();
}


function check_box_status_changed(group, id, e)
{

	// save the event position;
	getMousePosition(e);

	// show the waiting message window
	showSpinnerWindow();

	// get the checkbox status
	var status = $F('checkbox_'+group+'_'+id);
	status = (status == 1)?1:0;

	var url = "/direct-checkbox_ajax-save_checkbox-" + group + "-" + id + "-" + status + ".php";
	var myAjax = new Ajax.Request(
			url,
			{
				method: 'get',
				onComplete: showCheckBoxResponse,
				onFailure: hideMsgWindow,
				onException: hideMsgWindow
			});
}

function setimage_position(position,image_id,e){
	// save the event position;
	getMousePosition(e);

	// show the waiting message window
	showSpinnerWindow();

	var url = "/direct-formelements-updateimagepos.php";
	var myAjax = new Ajax.Request(
			url,
			{
				asynchronous: true, 
				method: 'post', 
				postBody: 'position='+position+'&id='+image_id+'',
				onComplete: showCheckBoxResponse,
				onFailure: hideMsgWindow,
				onException: hideMsgWindow
			});
}

function setvideo_title(title,image_id,e){

	// save the event position;
	getMousePosition(e);

	// show the waiting message window
	showSpinnerWindow();

	var url = "/direct-formelements-updatevideotitle.php";
	var myAjax = new Ajax.Request(
			url,
			{
				asynchronous: true, 
				method: 'post', 
				postBody: 'title='+title+'&id='+image_id+'',
				onComplete: showCheckBoxResponse,
				onFailure: hideMsgWindow,
				onException: hideMsgWindow
			});
}
