
function _submit(action,_id,del) {
	var not_submit;
	if(del) {
		if(!confirm('')) not_submit = 1;
	}
	switch(action) {
	case 'save' :   document.form1.target="_self";
					document.form1.action.value="_edit";
					break;
	case 'close' :  document.form1.target="_self";
					document.form1.action.value="";
					break;
	default :		document.form1.target="_self";
					document.form1.action.value=action;
					if(document.form1.sub_id) document.form1.sub_id.value=_id;
					break;
	}
	if(!not_submit)document.form1.submit();
}


// SWITCH CATEGORY WIDTH SELECT
	function select_cat_id_func() {
		document.select_cat.submit();
	}

//// RICO LOAD
	var onloads = new Array();
	function bodyOnLoad() {
	for ( var i = 0 ; i < onloads.length ; i++ )
	onloads[i]();}

	
onloads.push( registerAjaxStuff );

	onloads.push(registerAjaxStuff);
	// REGISTER		
	function registerAjaxStuff() {
			ajaxEngine.registerRequest('get_DepEdit','http://www.volta.it/admin/inc/get_DepEdit.php' );
			ajaxEngine.registerRequest('change_status','http://www.volta.it/admin/inc/change_status.php' );
			ajaxEngine.registerRequest('get_UserEdit','http://www.volta.it/admin/inc/get_UserEdit.php' );
			ajaxEngine.registerRequest('get_ProProLink','http://www.volta.it/admin/inc/get_ProProLink.php' );
			ajaxEngine.registerRequest('set_sort','http://www.volta.it/admin/inc/set_sort.php' );
			ajaxEngine.registerRequest('get_DelUser','http://www.volta.it/admin/inc/get_DelUser.php' );
			ajaxEngine.registerRequest('get_UserInfo','http://www.volta.it/admin/inc/get_UserInfo.php' );
			ajaxEngine.registerRequest('show_info','http://www.volta.it/inc/showInfo.php' );
	}

	// FUNCTIONS
	var send1="";
	var send2="";
	var send3="";
	var send4="";
	var send5="";
	var container = "";
	function send_req(req,container,send1,send2,send3,send4,send5) {
		var not_submit;
		onover = 1;
		ajaxEngine.registerAjaxElement(container);
		if(send1.substr(0,6)=="delete") {
			if(!confirm('')) not_submit = 1;
		}
		
		if(!not_submit) {
			if(send5)		ajaxEngine.sendRequest(req,send1,send2,send3,send4,send5);
			else if(send4)		ajaxEngine.sendRequest(req,send1,send2,send3,send4);
			else if(send3)		ajaxEngine.sendRequest(req,send1,send2,send3);
			else if(send2)	ajaxEngine.sendRequest(req,send1,send2);
			else if(send1)	ajaxEngine.sendRequest(req,send1);
			else 			ajaxEngine.sendRequest(req); 
		}
	}

	// AJAX SITE FUNCTIONS
	siteA = null;
	var title = "";
	var onover = 0;
	function update_A_site() {
		if (siteA != null) {
			siteA.style.left = (m_x + 20) + "px";
			siteA.style.top = (m_y + 20) + "px";
		}
	}
	function showA(req,title,container,send1,send2,send3) {
		document.getElementById('a_site_content').innerHTML="loading...";
		document.getElementById('a_site_title').innerHTML='<a href="javascript:closeA();"><img src="img/close.png" border="0" alt=""/></a>'+title;
		siteA = document.getElementById('a_site');
		siteA.style.display = "block"
		if(req) send_req(req,container,send1,send2,send3);
		update_A_site();
	}
	function closeA(req,send1,send2,send3) {
		if(req) send_req(req,send1,send2,send3);
		siteA.style.display = "none";
		document.getElementById('a_site_content').innerHTML="loading...";
	}
	
// TOOLTIP
	wmtt = null;
	var position='1';
	function showT(c,position) {
		if(!position) position = 1;
		wmtt = document.getElementById('tooltip'+position);
		wmtt.style.display = "block"
			wmtt.style.left = (m_x + 20) + "px";
			wmtt.style.top = (m_y + 20) + "px";
		wmtt.innerHTML = '<img src="http://www.volta.it/admin/img/info.png" style="margin-right:5px;" align="left">'+c;
	}
	function hideT() {
		onover = 0;
		if(wmtt) {
			wmtt.style.display = "none";
			wmtt.innerHTML = "";
		}
	}
/// GET X AND Y MAUS
	document.onmousemove = updateMousePosition;
	function updateMousePosition(e) {
		m_x = (document.all) ? window.event.clientX + document.documentElement.scrollLeft : e.pageX;
		m_y = (document.all) ? window.event.clientY + document.documentElement.scrollTop  : e.pageY;
		if (wmtt != null) {
				wmtt.style.left = (m_x + 20) + "px";
				wmtt.style.top 	= (m_y + 20) + "px";
		}
	}
/// SEARCH RESULT SHOW INFO
	function showInfo(img) {
		if(onover) showT('<img src="'+img+'" />');
	}
	
/////////////
/// DELETE ROW
	function del_row(s_id) {
		s_row = document.getElementById('row_'+s_id);
		s_row.style.display="none";	
	}
