function deleteRecord( data )
{
	if (data.type == 'Location') {
		if (confirm('Are you sure to delete this location record?')) {
			window.location = '/process/do_UpdateLocation.php?process=DELETE&lid=' + data.id;			
		}

	} 
    else if (data.type == 'LocationCategory') {
		if (confirm('Are you sure to delete this location category record?')) {
			window.location = '/process/do_UpdateLocationCategory.php?process=DELETE&lcid=' + data.id;			
		}
    }
    else if (data.type == 'CuisineCategory') {
		if (confirm('Are you sure to delete this cuisine category record?')) {
			window.location = '/process/do_UpdateCuisineCategory.php?process=DELETE&ccid=' + data.id;
		}
    }
    else if (data.type == 'Cuisine') {
		if (confirm('Are you sure to delete this cuisine record?')) {
			window.location = '/process/do_UpdateCuisine.php?process=DELETE&cid=' + data.id;
		}
    }
    else if (data.type == 'RestaurantType') {
		if (confirm('Are you sure to delete this restaurant type record?')) {
			window.location = '/process/do_UpdateRestaurantType.php?process=DELETE&rtid=' + data.id;
		}
    }
    else if (data.type == 'Range') {
		if (confirm('Are you sure to delete this range record?')) {
			window.location = '/process/do_UpdateRange.php?process=DELETE&rangid=' + data.id;
		}
    }     
}

function autoSelect(selectorId, selectedValue)
{
    var selector = document.getElementById(selectorId);
    var selectorLength = selector.length;
    
    if (selector != undefined && selectedValue != undefined) {
        for(i=0; i<selectorLength; i++) {
            if (selector.options[i].value == selectedValue) {
                selector.selectedIndex = i;
            }
        }                    
    }
}

function init()
{
    var msgDiv = document.getElementById('SystemMessage-block');
    if (msgDiv.innerHTML == "") {
        msgDiv.style.display = 'none';
    }
    else {
        msgDiv.style.display = 'block';
    }
}


window.onload = init;
