function confirmSubmit(oForm, text)
{
	var yes=confirm(text);
	if (yes)
	oForm.submit();
	else
	return false ;
}

function SetAllCheckBoxes(FieldName, FormName, CheckValue)
{
	if(!document.forms[FormName]) {
		return;
	}
	
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	
	if(!objCheckBoxes) {
		return;
	}
	
	var countCheckBoxes = objCheckBoxes.length;
	
	if(!countCheckBoxes) {
		objCheckBoxes.checked = !objCheckBoxes.checked;
	} else {
		// set the check value for all check boxes
		first = true;
		check = false;
		for(var i = 0; i < countCheckBoxes; i++) {
			if(first) {
				check = !objCheckBoxes[i].checked;
				first = false;
			}
			objCheckBoxes[i].checked = check;
		}
	}
}


function openLocations(uid){
	window.open("locations.php?UserID=" + uid,"win","width=550,height=500,scrollbars=yes,resizable=no,screenX=0,screenY=0,left=0,top=0");
}

function openServices(uid){
	window.open("services.php?UserID=" + uid,"win","width=550,height=500,scrollbars=yes,resizable=no,screenX=0,screenY=0,left=0,top=0");
}

function showCity(elem, other, cityDiv) {
	elem = returnObjById(elem);
	other = returnObjById(other);
	cityDiv = returnObjById(cityDiv);
	city = returnObjById("regionCity");
	
	otherId = other.value;
	city.value = "";
	if(otherId.indexOf("," + elem.value + ",") >= 0) {
		cityDiv.style.display = "";
	} else {
		cityDiv.style.display = "none";
	}
}

function returnObjById( id )  { 
    if (document.getElementById) 
        var returnVar = document.getElementById(id); 
    else if (document.all) 
        var returnVar = document.all[id]; 
    else if (document.layers) 
        var returnVar = document.layers[id]; 
    return returnVar; 
} 
