//	Common Jscript functions

//returns string of first cell values, exepts first row, separated by ";" 

function onImageLoad( imgObj )
{
	if( imgObj.readyState == "complete" )
		clientFitImgToFrame( imgObj, 56, 42, 0 )
}


function tableIDList( tableID )
{
	var i, tableObj, rowID, resStr="";
	tableObj = document.getElementById(tableID)
	for( i=0; i<tableObj.rows.length; i++ ) {
		rowID = tableObj.rows[i].id
		if( document.getElementById( rowID + "in" ).checked )
			resStr += rowID.replace( /(\D)*/, "" ) + ";" ;
		}
	return resStr.substr( 0, resStr.length-1 );
}

var g_removeTableID, g_removeRowID
function changeProdState( tableID, selectedRowID, newState )
{
	var prodList = selectedRowID.replace('job_','')
	g_removeTableID = tableID
	g_removeRowID = selectedRowID
	if (typeof(clientBrowserType())=="undefined")
	{
		window.setTimeout('removeTableRowSelectedGlobal()',500);
	}
	else
	{
		removeTableRowSelectedGlobal()
	}
	clientFindFrameAnyLevel('publicActionResult').location.href='/Newsway/Versions/250/site/iway/gui/inc/productstatus.asp?prodList='+prodList+'&status='+newState;
}

function removeTableRowSelectedGlobal()
{
	var i, tableObj;
	tableObj = document.getElementById(g_removeTableID)
	for( i=0; i < tableObj.rows.length; i++ )
	{
		if( tableObj.rows[i].id == g_removeRowID ) 
		{
			try
			{
				tableObj.deleteRow( i );
			}
			catch (ex)	
			{
			}
			break;
		}
	}
}

function removeTableRowSelected( tableID, rowID )
{
	var i, tableObj;
	tableObj = document.getElementById(tableID)
	for( i=0; i < tableObj.rows.length; i++ )
	{
		if( tableObj.rows[i].id == rowID ) 
		{
			tableObj.deleteRow( i );
			break;
		}
	}		
}

function makeTableRowSelected( rowID, selectedRowID )
{
	var selectedRowObj = document.getElementById( selectedRowID )
	if ( selectedRowID != "" )
		if( selectedRowObj != null )
			selectedRowObj.className = "tableRow"
	
	var rowIDObj = document.getElementById( rowID )
	if ( rowID != "" ) {
		if(rowIDObj != null ) {
			rowIDObj.className = "tableSelectedRow"
			return rowID
			}	
		}
	return ""
}

function hideObj( obj )
{
	if( obj != null )
		obj.style.visibility = "hidden"
}

function showTag(obj)
{
	if( obj != null )
		obj.style.visibility = "visible"
}


