﻿
function getconfirm()
{
	var bRet = false;
	if (confirm("Are you sure you want to delete this item?"))
		bRet = true;
	
	return bRet;
}
function ConfirmDelete()
{
	var bRet = false;
	if (confirm("คุณต้องการลบข้อมูลนี้หรือไม่ ?"))
		bRet = true;
	
	return bRet;
}
function ConfirmConvert()
{
	var bRet = false;
	if (confirm("Are you sure you want to convert this item?"))
		bRet = true;
	
	return bRet;
}

function MetaBuilders_RowSelectorColumn_SelectAll( parentCheckBox ) {
    if ( typeof( document.getElementById ) == "undefined" ) return;
    if ( parentCheckBox == null || typeof( parentCheckBox.participants ) == "undefined" ) {
        return;
    }
    var participants = parentCheckBox.participants;
    for ( var i=0; i < participants.length; i++ ) {
        var participant = participants[i];
        if ( participant != null ) {
            participant.checked = parentCheckBox.checked;
        }
    }
}
function MetaBuilders_RowSelectorColumn_Register( parentName, childName ) {
    if ( typeof( document.getElementById ) == "undefined" ) return;
    var parent = document.getElementById( parentName );
    var child = document.getElementById( childName );
    if ( parent == null || child == null ) {
        return;
    }
    if ( typeof( parent.participants ) == "undefined" ) {
        parent.participants = new Array();
    }
    parent.participants[parent.participants.length] = child;
}
function MetaBuilders_RowSelectorColumn_CheckChildren( parentName ) {
	if ( typeof( document.getElementById ) == "undefined" ) return;
    var parent = document.getElementById( parentName );
    if ( parent == null || typeof( parent.participants ) == "undefined" ) return;
    var participants = parent.participants;
    for ( var i=0; i < participants.length; i++ ) {
        var participant = participants[i];
        if ( participant != null && !participant.checked ) {
				parent.checked = false;
				return;
        }
    }
    parent.checked = true;
}

//*************  For HighLight DataGrid Record *************
var rowClicked;
var typeOfRowClicked;

function DataGridOver(theRow,type)
{
	if(type == 'AlternateItem')
	{
		theRow.className = DataGridAlternateOverItem;
	}
	else
	{
		theRow.className = DataGridOverItem;
	}
}

function DataGridOut(theRow, type)
{
	if( theRow.className != 'DataGridClick' )
	{	if(type == 'AlternateItem')
		{
			theRow.className = DataGridAlternateOutItem;
		}
		else
		{
			theRow.className = DataGridOutItem;
		}
	}
}

function DataGridClick(theRow, type)
{
	theRow.className = DataGridClick;
	
	// check old row click
	if (rowClicked)
	{	
		if (typeOfRowClicked == 'AlternateItem')
		{
			rowClicked.className = DataGridItem
		}
		else 
		{
			rowClicked.className = DataGridOverItem
		}
	}
	
	// set old row
	rowClicked = theRow;
	typeOfRowClicked = type;
	
}
