//
// HP Paid Ads Functions below here.
//
// Global Variables used.
IDReviews = new Array();
m_IndexReviews = 0;
m_CountReviews = 0;
myinterval = 15; 	/* number of secs between changes IF runOnLoadedPage = true */

function RunJobFishReviews( iCountReviews, strIDs )
	{
	var iReview, iPosStart, iPosNext, iLenSep;
	var strSep, strToken;
	var objReviews;


	// Set the separator information.
	strSep = ";";
	iLenSep = strSep.length;

	// Save the review count.
	m_CountReviews = iCountReviews;

	// Convert the IDs from a string representation to an array format.
	for (iReview = 0; iReview < iCountReviews; iReview++)
		{
		// Initialize: Start position indicator.
		if (0 == iReview)
			iPosStart = 0;
		else
			iPosStart = iPosNext + iLenSep;

		// Initialize: Next position indicator.
		if (1 == iCountReviews)
			iPosNext = strIDs.length;
		else
			{
			if (0 == iReview)
				iPosNext = strIDs.indexOf( strSep );
			else if (iReview < iCountReviews - 1)
				iPosNext = strIDs.indexOf( strSep, iPosStart );
			else
				iPosNext = strIDs.length
			}

		// Extract the token.
		strToken = strIDs.substring( iPosStart, iPosNext )
		IDReviews[iReview] = strToken;
		}

	// Get the object, where we will place the review.
	objReviews = document.getElementById('IDJobFishReviews');

	// Only execute this code once.
	if (RunJobFishReviews.started)
		return;

	// Cycle the banners.
	CycleJobFishReviews();

	// Set the interval to cycle the ads.
	mycycle = setInterval( 'CycleJobFishReviews()', myinterval * 1000 );
	}

function CycleJobFishReviews()
	{
	var IDReview;
	var objReviews;


	// We started the banner rotation.
	RunJobFishReviews.started = true;

	// Get the object, where we will place the banner.
	objReviews = document.getElementById('IDJobFishReviews');

	// Only continue, if reviews exist.
	if (0 == m_CountReviews)
		return;

	// Get the ID for the review to show.
	IDReview = IDReviews[m_IndexReviews];

	// Call the PHP function to handle the event.
	x_OnChangeReview( IDReview, ToAreaReview );

	// Get ready for the next banner.
	m_IndexReviews = (m_IndexReviews + 1) % m_CountReviews;
	}

