var mystored_selection = '';
var post_cache    = new Array();
var ajax_loaded   = 1;
var ignore_cache  = new Array();
/*--------------------------------------------*/
// Ajax: action
/*--------------------------------------------*/
function ajax_action_for_post( action, ad_id, div_refresh )
{
	//----------------------------------
	// INIT
	//----------------------------------
	var url    = 'index.php?act=catsxmlout&do='+action+'&aid='+ad_id;
	var fields = new Array();
	//----------------------------------
	// Populate fields
	//----------------------------------
	fields['md5check'] = sdk_md5_check;
	fields['act']      = 'catsxmlout';
	fields['aid']      = ad_id;
	fields['do']       = action;
	/*--------------------------------------------*/
	// Main function to do on request
	// Must be defined first!!
	/*--------------------------------------------*/
	do_request_function = function()
	{
		//----------------------------------
		// Ignore unless we're ready to go
		//----------------------------------
		if ( ! xmlobj.readystate_ready_and_ok() )
		{
			xmlobj.show_loading();
			return;
		}
		xmlobj.hide_loading();
		//----------------------------------
		// INIT
		//----------------------------------
		var html = xmlobj.xmlhandler.responseText;
		if ( html != 'error' )
		{
			var result_html = html.split("|");
			if ( result_html[0] != 'error')
			{
				if ( (div_refresh) && document.getElementById( div_refresh ) )
				{
					document.getElementById( div_refresh ).innerHTML = html;
				}
			}
			else
			{
				document.getElementById( 'ajax-post-msg' ).innerHTML = result_html[1];
			}
		}
		else
		{
			document.getElementById( 'ajax-post-msg' ).innerHTML = html;
		}
	}
	//----------------------------------
	// LOAD XML
	//----------------------------------
	xmlobj = new ajax_request();
	xmlobj.onreadystatechange( do_request_function );
	var xmlreturn = xmlobj.process( url, 'POST', xmlobj.format_for_post(fields) );
	return false;
}

function check_selected_post( obj_sel, form )
{
	if( obj_sel.value == -1 )
	{
		alert( js_alert );
		obj_sel.selectedIndex = 0;
	}
	else{
		form.submit();
	}
} 

