var ajax_url	= '/ajax-aff-news.cgi';

sendRPCDone = function ( text, currID ) {
	document.getElementById( 'AJAX_news' ).innerHTML = text;

	affNewsID = currID;
}

function vb () {
	var C = null;

	try {
		C = new ActiveXObject( 'Msxml2.XMLHTTP' )
	} catch( e ) {
		try {
			C = new ActiveXObject( 'Microsoft.XMLHTTP' )
		} catch( sc ) {
			C = null;
		}
	}

	if( !C && typeof XMLHttpRequest != 'undefined' ) {
		C = new XMLHttpRequest();
	}

	return C;
}

function AJAX ( affID, newsID ) {
	l 		= vb();
	full_url	= ajax_url + '?aff_id=' + affID + ';id=' + newsID;

	if ( l && l.readyState != 0 ) { l.abort(); } 

	if ( l ) {
		l.open( 'GET', full_url, true );

		l.onreadystatechange = function() {
			if( l.readyState == 4 && l.responseText ) {
				if( l.responseText.charAt(0) == '<' ) {
					//V--;
				} else {
					eval( l.responseText );
				}
			}
		};

		l.send( null );
	}
}

function Refresh_news() {
	setTimeout( "AJAX( affID, affNewsID ); Refresh_news();", 7000 );
}

setTimeout( "Refresh_news();", 7000 );

