var VSReqSubmit;

function TAOOverrideSubmit(id)
{
	var cmd = document.getElementById(id);
	if(typeof(cmd) == "undefined") return;
	if(cmd == null) return;
	VSReqSubmit=cmd.onclick;
	cmd.onclick=TAOValidateSubmit;	
}

function TAOValidateSubmit(eventTarget,eventArgument)
{
	var val = ValidateOnSubmit();	

	if(val == true)
		VSReqSubmit(eventTarget,eventArgument);
	else
	{
		Page_BlockSubmit = true;
		Page_IsValid = false;
		//alert("Error al validar los datos.");
	}
}
/*
function DisableControlsAddress(chk, ctlId)
{
		var oType = GetById('[sType]');
		var oStreet = GetById('[sStreet]');
		var oNumber = GetById('[sNumber]');
		var oZipCode = GetById('[sZipCode]');
		var oCity = GetById('[sCity]');
		var oCountry = GetById('[sCountry]');
		var oState = GetById('[sState]');
		var oBlock = GetById('[sBlock]');
		var oStair = GetById('[sStair]');
		var oDoor = GetById('[sDoor]');
		var oFloor = GetById('[sFloor]');
		var oNumber2 = GetById('[sNumber2]');
		var oZipCode = GetById('[sZipCode]');
		var oDupli1 = GetById('[sDupli1]');
		var oDupli2 = GetById('[sDupli2]');
		if (oBlock != null){ oBlock.disabled =false; }
		if (oStair != null){ oStair.disabled =false; }
		if (oDoor != null){ oDoor.disabled =false; }
		if (oFloor != null){ oFloor.disabled =false; }
		if (oNumber2 != null){ oNumber2.disabled =false; }
		if (oZipCode != null){ oZipCode.disabled =false; }
		if (oDupli1 != null){ oDupli1.disabled =false; }
		if (oDupli2 != null){ oDupli2.disabled =false; }
		if (oType != null){
			oType.disabled =!chk;
			oType.selectedIndex = 0;
		}
		if (oStreet != null){
			oStreet.disabled =!chk;
			oStreet.value = '';
		}
		if (oNumber != null){
			oNumber.disabled =!chk;
			oNumber.value = '';
		}
		if (oZipCode != null){
			oZipCode.disabled =!chk;
			oZipCode.value = '';
		}
		if (oCity != null){
			oCity.disabled =!chk;
			oCity.value = '';
		}
		if (oCountry != null){
			oCountry.disabled =!chk;
			oCountry.value = '';
		}
		if (oState != null){
			oState.disabled =!chk;
			oState.value = '';
		}
}
*/
/*
function DisableControlsAddress(chk, clientId)
{
	alert();
	var oType = GetById(clientId + '_StreetType');
	var oStreet = GetById(clientId + '_StreetName');
	var oNumber = GetById(clientId + '_AdNumber');
	var oZipCode = GetById(clientId + '_ZipCode');
	var oCity = GetById(clientId + '_City');
	var oCountry = GetById(clientId + '_Country');
	var oState = GetById(clientId + '_State');
	var oBlock = GetById(clientId + '_Block');
	var oStair = GetById(clientId + '_Stair');
	var oDoor = GetById(clientId + '_Door');
	var oFloor = GetById(clientId + '_Floor');
	var oNumber2 = GetById(clientId + '_AdNumber2');
	var oZipCode = GetById(clientId + '_ZipCode');
	var oDupli1 = GetById(clientId + '_Dupli1');
	var oDupli2 = GetById(clientId + '_Dupli2');
	var oButton = GetById(clientId + '_Button');

	if (oBlock != null){ oBlock.disabled = false; }
	if (oStair != null){ oStair.disabled = false; }
	if (oDoor != null){ oDoor.disabled = false; }
	if (oFloor != null){ oFloor.disabled = false; }
	if (oNumber2 != null){ oNumber2.disabled = false; }
	//if (oZipCode != null){ oZipCode.disabled =false; }
	if (oDupli1 != null){ oDupli1.disabled = false; }
	if (oDupli2 != null){ oDupli2.disabled = false; }
	
	if (oType != null){
		//oType.readOnly=! chk;
		oType.selectedIndex = 0;
	}
	if (oStreet != null){
		//oStreet.readOnly=! chk;
		oStreet.value = '';
	}
	if (oNumber != null){
		//oNumber.disabled =! chk;
		oNumber.value = '';
	}
	if (oZipCode != null){
		//oZipCode.disabled =! chk;
		oZipCode.value = '';
	}
	if (oCity != null){
		//oCity.disabled =! chk;
		oCity.value = '';
	}
	if (oCountry != null){
		//oCountry.disabled =! chk;
		oCountry.value = '';
	}
	if (oState != null){
		//oState.disabled =! chk;
		oState.value = '';
	}
	if(oButton != null){
		if (chk)
			oButton.style.display = "none";
		else
			oButton.style.display = "";
	}
}
*/

function DisableControlsAddress(chk, clientId)
{
		var oType = GetById(clientId + '_StreetType');
		var oStreet = GetById(clientId + '_StreetName');
		var oNumber = GetById(clientId + '_AdNumber');
		var oZipCode = GetById(clientId + '_ZipCode');
		var oCity = GetById(clientId + '_City');
		var oCountry = GetById(clientId + '_Country');
		var oState = GetById(clientId + '_State');
		var oBlock = GetById(clientId + '_Block');
		var oStair = GetById(clientId + '_Stair');
		var oDoor = GetById(clientId + '_Door');
		var oFloor = GetById(clientId + '_Floor');
		var oNumber2 = GetById(clientId + '_AdNumber2');
		var oZipCode = GetById(clientId + '_ZipCode');
		var oDupli1 = GetById(clientId + '_Dupli1');
		var oDupli2 = GetById(clientId + '_Dupli2');
		var oButton = GetById(clientId + '_Button');
		var oAddressId = GetById(clientId + '_AddressId');

		if (oBlock != null){ oBlock.readOnly = false; }
		if (oStair != null){ oStair.readOnly = false; }
		if (oDoor != null){ oDoor.readOnly = false; }
		if (oFloor != null){ oFloor.readOnly = false; }
		if (oNumber2 != null){ oNumber2.readOnly = false; }
		if (oZipCode != null){ oZipCode.readOnly = false; }
		if (oDupli1 != null){ oDupli1.readOnly = false; }
		if (oDupli2 != null){ oDupli2.readOnly = false; }
		
		var sDisabled = chk? false : true;

		if (oType != null)
		{
			oType.readOnly = sDisabled;
			oType.selectedIndex = 0;
		}
		if (oStreet != null)
		{
			oStreet.readOnly = sDisabled;
			oStreet.value = '';
		}
		if (oNumber != null)
		{
			oNumber.readOnly = sDisabled;
			oNumber.value = '';
		}
		if (oZipCode != null)
		{
			oZipCode.readOnly = sDisabled;
			oZipCode.value = '';
		}
		if (oCity != null)
		{
			oCity.readOnly = sDisabled;
			oCity.value = '';
		}
		if (oCountry != null)
		{
			oCountry.readOnly = sDisabled;
			oCountry.value = '';
		}
		if (oState != null)
		{
			oState.readOnly = sDisabled;
			oState.value = '';
		}
		
		if(oButton != null)
		{
			if (chk)
				oButton.style.display = "none";
			else
				oButton.style.display = "";		
		}
		
		if(!sDisabled) oAddressId.value = "";
		
		
}

