function toggleDisplay(chkBox, divId){
	var show = chkBox.checked;
	var div1 = document.getElementById(divId)
	if (show == true) {
		div1.style.display = 'block'
	} else {
		div1.style.display = 'none'
	}
}

function ChangeValueOneZero(chkBox)
{
	var chkBoxValue = chkBox.value;
	if(chkBoxValue == 1)
		chkBoxValue = 0;
	else
		chkBoxValue = 1;
	chkBox.value = chkBoxValue;
}

function explode( delimiter, string, limit ) {
    // http://kevin.vanzonneveld.net
    // +     original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +     improved by: kenneth
    // +     improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +     improved by: d3x
    // +     bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: explode(' ', 'Kevin van Zonneveld');
    // *     returns 1: {0: 'Kevin', 1: 'van', 2: 'Zonneveld'}
    // *     example 2: explode('=', 'a=bc=d', 2);
    // *     returns 2: ['a', 'bc=d']
 
    var emptyArray = { 0: '' };
    
    // third argument is not required
    if ( arguments.length < 2
        || typeof arguments[0] == 'undefined'
        || typeof arguments[1] == 'undefined' )
    {
        return null;
    }
 
    if ( delimiter === ''
        || delimiter === false
        || delimiter === null )
    {
        return false;
    }
 
    if ( typeof delimiter == 'function'
        || typeof delimiter == 'object'
        || typeof string == 'function'
        || typeof string == 'object' )
    {
        return emptyArray;
    }
 
    if ( delimiter === true ) {
        delimiter = '1';
    }
    
    if (!limit) {
        return string.toString().split(delimiter.toString());
    } else {
        // support for limit argument
        var splitted = string.toString().split(delimiter.toString());
        var partA = splitted.splice(0, limit - 1);
        var partB = splitted.join(delimiter.toString());
        partA.push(partB);
        return partA;
    }
}

function isValidUsername (TxtBoxId, AlertMsg)
{
	var error = "";
	var fld = document.getElementById(TxtBoxId);
	if(AlertMsg.length == 0)
		AlertMsg = "This field contains illegal characters.\n";	
	
    var illegalChars = /\W/; // allow letters, numbers, and underscores
 
    if (illegalChars.test(fld.value)) {
        fld.style.background = 'Yellow';		
        alert(AlertMsg);
		fld.focus();
		return false;
    }
	else
	{
		fld.style.background = 'White';
		return true;
	}
}

function delResource()
{
	var answer = confirm("Are you sure you want to delete this?");
	return (answer);
}
