function unset( array, valueOrIndex )
{
	var output=[];
	for( i=0; i<array.length; i++ )
	{
		if ( i!=valueOrIndex )
		{
			output.push( array[i] );
		}
	}
	return output;
}


function getprices()
{
	for( i=0; i<nodeIds.length; i++ )
	{
		divTinyerpPrices = document.getElementById( 'tinyerp-prices-'+nodeIds[i] );
		if( divTinyerpPrices )
		{
			divTinyerpPrices.innerHTML = '<img src="/extension/sicksearch/design/standard/images/sicksearch_loading.gif" alt="loading"/>';
			
			var XHR = new XHRConnection();
			var url = '/engine/getprice/'+nodeIds[i];
			XHR.appendData( 'id', nodeIds[i] );
			XHR.setRefreshArea( 'tinyerp-prices-'+nodeIds[i] );
			XHR.sendAndLoad( url, "GET", '' );
		}
	}
}

var priceCallBackFunction = function( obj, elementId, nodeIds )
{
	elmSpanBox = document.getElementById( elementId );
	if( elmSpanBox )
	{
		elmSpanBox.innerHTML = obj.responseText;
	}

	if( nodeIds.length > 0 )
	{
		var XHR = new XHRConnection();
		var url = '/engine/getprice/'+nodeIds[0];
		XHR.appendData( 'id', nodeIds[0] );
		XHR.setRefreshArea( 'tinyerp-prices-'+nodeIds[0] );
		nodeIds = unset( nodeIds, 0 );
		XHR.setNodeIds( nodeIds );
		XHR.sendAndLoad( url, "GET", priceCallBackFunction );
	}
}

function getimages()
{
	for( i=0; i<nodeIds.length; i++ )
	{
		var XHR = new XHRConnection();
		var url = '/engine/getprice/'+nodeIds[i]+'/image/';
		if( document.getElementById('viewImageLimit') && document.getElementById('viewImageLimit').value == 36 )
		{
			url += 'little/';
		}
		XHR.appendData( 'id', nodeIds[i] );
		XHR.setRefreshArea( 'surimpression-image-'+nodeIds[i] );
		XHR.sendAndLoad( url, "GET", '' );
	}

}

var imageCallBackFunction = function( obj, elementId, nodeIds )
{
	elmSpanBox = document.getElementById( elementId );
	if( elmSpanBox )
	{
		elmSpanBox.innerHTML = obj.responseText;
	}

	if( nodeIds.length > 0 )
	{
		var XHR = new XHRConnection();
		var url = '/engine/getprice/'+nodeIds[0]+'/image/';
		nodeIds = unset( nodeIds, 0 );
		XHR.setNodeIds( nodeIds );
		if( document.getElementById('viewImageLimit') && document.getElementById('viewImageLimit').value == 36 )
		{
			url += 'little/';
		}
		XHR.appendData( 'id', nodeIds[0] );
		XHR.setRefreshArea( 'surimpression-image-'+nodeIds[0] );
		XHR.sendAndLoad( url, "GET", imageCallBackFunction );
	}
}

function showEntireDiv( divId )
{	
	new Effect.Move($(divId), { x: -sickSearchDivWidth, y: 0 });
	$('spanShow').style.display = 'none';
	$('spanMask').style.display = 'block';
}

function maskEntireDiv( divId )
{
	new Effect.Move($(divId), { x: sickSearchDivWidth, y: 0 });
	$('spanShow').style.display = 'block';
	$('spanMask').style.display = 'none';
}