

function dept_onchange(frmSelect) {
   frmSelect.submit();
}



function VerificaImagem(admin)

{

	if (frmSelect.ddlGuia.options[frmSelect.ddlGuia.selectedIndex].value > 0 && frmSelect.ddlEstrutura.options[frmSelect.ddlEstrutura.selectedIndex].value > 0)

	{

		CodGuia      = frmSelect.ddlGuia.options[frmSelect.ddlGuia.selectedIndex].value;

		CodEstrutura      = frmSelect.ddlEstrutura.options[frmSelect.ddlEstrutura.selectedIndex].value;

		document.getElementById("frmGuia").src = "ImagemGuia.asp?CodGuia=" + CodGuia + "&CodEstrutura=" + CodEstrutura

	}



	

	if (frmSelect.ddlMontagem.options[frmSelect.ddlMontagem.selectedIndex].value > 0 && frmSelect.ddlEstrutura.options[frmSelect.ddlEstrutura.selectedIndex].value > 0)

	{

		CodMontagem  = frmSelect.ddlMontagem.options[frmSelect.ddlMontagem.selectedIndex].value;

		document.getElementById("frmMontagem").src = "ImagemMontagem.asp?CodMontagem=" + CodMontagem + "&CodEstrutura=" + CodEstrutura

	}

	

	if (frmSelect.ddlEstrutura.options[frmSelect.ddlEstrutura.selectedIndex].value > 0)

	{

		CodEstrutura = frmSelect.ddlEstrutura.options[frmSelect.ddlEstrutura.selectedIndex].value;

		document.getElementById("frmEstrutura").src = "ImagemEstrutura.asp?CodEstrutura=" + CodEstrutura

			

	}





	if (frmSelect.ddlCurso != undefined && frmSelect.ddlPci != undefined && frmSelect.ddlPcs != undefined && frmSelect.ddlCurso.selectedIndex != -1 && frmSelect.ddlEstrutura.selectedIndex > 0 && frmSelect.ddlPci.selectedIndex > 0 && frmSelect.ddlPcs.selectedIndex > 0)

	{

		CodEstrutura      = frmSelect.ddlEstrutura.options[frmSelect.ddlEstrutura.selectedIndex].value;
                txtCodEstrutura   = frmSelect.ddlEstrutura.options[frmSelect.ddlEstrutura.selectedIndex].text;

		CodPcs            = frmSelect.ddlPcs.options[frmSelect.ddlPcs.selectedIndex].value;
		txtCodPcs         = frmSelect.ddlPcs.options[frmSelect.ddlPcs.selectedIndex].text;

		CodPci            = frmSelect.ddlPci.options[frmSelect.ddlPci.selectedIndex].value;
		txtCodPci         = frmSelect.ddlPci.options[frmSelect.ddlPci.selectedIndex].text;

		CodCurso          = frmSelect.ddlCurso.options[frmSelect.ddlCurso.selectedIndex].value;
		txtCodCurso       = frmSelect.ddlCurso.options[frmSelect.ddlCurso.selectedIndex].text;

		CodGuia           = frmSelect.ddlGuia.options[frmSelect.ddlGuia.selectedIndex].value;
		txtCodGuia        = frmSelect.ddlGuia.options[frmSelect.ddlGuia.selectedIndex].text;

		CodMontagem       = frmSelect.ddlMontagem.options[frmSelect.ddlMontagem.selectedIndex].value;
                txtCodMontagem    = frmSelect.ddlMontagem.options[frmSelect.ddlMontagem.selectedIndex].text;

		CodDimensao       = frmSelect.ddlDimensao.options[frmSelect.ddlDimensao.selectedIndex].value;
		txtCodDimensao       = frmSelect.ddlDimensao.options[frmSelect.ddlDimensao.selectedIndex].text;






		if (admin)

		{

			strCaminho = "UploadArquivos.asp?CodEstrutura=" + CodEstrutura + "&CodPcs=" + CodPcs + "&CodPci=" + CodPci + "&CodCurso=" + CodCurso + "&CodGuia=" + CodGuia + "&CodMontagem=" + CodMontagem + "&CodDimensao=" + CodDimensao

		}

		else

		{

			strCaminho = "ListarArquivos.asp?CodEstrutura=" + CodEstrutura + "&CodPcs=" + CodPcs + "&CodPci=" + CodPci + "&CodCurso=" + CodCurso + "&CodGuia=" + CodGuia + "&CodMontagem=" + CodMontagem + "&CodDimensao=" + CodDimensao + "&txtCodEstrutura=" + txtCodEstrutura + "&txtCodPcs=" + txtCodPcs + "&txtCodPci=" + txtCodPci + "&txtCodCurso=" + txtCodCurso + "&txtCodGuia=" + txtCodGuia + "&txtCodMontagem=" + txtCodMontagem + "&txtCodDimensao=" + txtCodDimensao

		}



		strCaminhoImagemJpg ="UploadJpg.asp?CodEstrutura=" + CodEstrutura + "&CodPcs=" + CodPcs + "&CodPci=" + CodPci + "&CodCurso=" + CodCurso + "&CodGuia=" + CodGuia + "&CodMontagem=" + CodMontagem + "&CodDimensao=" + CodDimensao + "&txtCodEstrutura=" + txtCodEstrutura + "&txtCodPcs=" + txtCodPcs + "&txtCodPci=" + txtCodPci + "&txtCodCurso=" + txtCodCurso + "&txtCodGuia=" + txtCodGuia + "&txtCodMontagem=" + txtCodMontagem + "&txtCodDimensao=" + txtCodDimensao



		<!-- Verifica se tem PFS -->

		if (frmSelect.ddlPfs != undefined)

		{

			if (frmSelect.ddlPfs.options[frmSelect.ddlPfs.selectedIndex].value > 0)

			{

				CodPfs    = frmSelect.ddlPfs.options[frmSelect.ddlPfs.selectedIndex].value;
                                txtCodPfs = frmSelect.ddlPfs.options[frmSelect.ddlPfs.selectedIndex].text;


				strCaminho = strCaminho + "&CodPfs=" + CodPfs + "&txtCodPfs=" + txtCodPfs

				strCaminhoImagemJpg = strCaminhoImagemJpg + "&CodPfs=" + CodPfs + "&txtCodPfs=" + txtCodPfs

			}

			else

			{

				<!-- Se nao tiver selecionado nenhum PFS sai (Nao aparece iframe para UPLOAD) -->

				return;

			}



		}





		<!-- Verifica se tem PFI -->

		if (frmSelect.ddlPfi != undefined)

		{

			if (frmSelect.ddlPfi.options[frmSelect.ddlPfi.selectedIndex].value > 0)

			{

				CodPfi = frmSelect.ddlPfi.options[frmSelect.ddlPfi.selectedIndex].value;

				strCaminho = strCaminho + "&CodPfi=" + CodPfi

				strCaminhoImagemJpg = strCaminhoImagemJpg + "&CodPfi=" + CodPfi

			}

			else

			{

				<!-- Se nao tiver selecionado nenhum PFI sai (Nao aparece iframe para UPLOAD) -->

				return;

			}



		}



		if(document.getElementById("frmUploadImagem") != null)

		{

			document.getElementById("frmUploadImagem").src = strCaminho

		}



		document.getElementById("frmImagemEstrutura").src = strCaminhoImagemJpg



	}







}



function ValidaForm(strFormName)

{

	blnErro = false;

	if (trim(strFormName.txtNome.value) == '')

	{

			ExibeId('vldNome');

			blnErro = true;

	}

	else

	{

		OcultaId('vldNome');

	}

		if (trim(strFormName.txtEmpresa.value) == '')

	{

			ExibeId('vldEmpresa');

			blnErro = true;

	}

	else

	{

		OcultaId('vldEmpresa');

	}

	

	if (trim(strFormName.txtDdd.value) == '')

	{

			ExibeId('vldDdd');

			blnErro = true;

	}

	else

	{

		OcultaId('vldDdd');

	}

	

	if (trim(strFormName.txtTelefone.value) == '')

	{

			ExibeId('vldTelefone');

			blnErro = true;

	}

	else

	{

		OcultaId('vldTelefone');

	}



	if (trim(strFormName.txtEmail.value) == '')

	{

			ExibeId('vldEmail');

			blnErro = true;

	}

	else

	{

		OcultaId('vldEmail');

	}

	

	if (trim(strFormName.txtEndereco.value) == '')

	{

			ExibeId('vldEndereco');

			blnErro = true;

	}

	else

	{

		OcultaId('vldEndereco');

	}

	

	if (trim(strFormName.txtComplemento.value) == '')

	{

			ExibeId('vldComplemento');

			blnErro = true;

	}

	else

	{

		OcultaId('vldComplemento');

	}

	

	if (trim(strFormName.txtCidade.value) == '')

	{

			ExibeId('vldCidade');

			blnErro = true;

	}

	else

	{

		OcultaId('vldCidade');

	}

		if (trim(strFormName.txtCep.value) == '')

	{

			ExibeId('vldCep');

			blnErro = true;

	}

	else

	{

		OcultaId('vldCep');

	}



	if (strFormName.ddlEstado.options[strFormName.ddlEstado.selectedIndex].value == 'Sel')	

	{

			ExibeId('vldEstado');

			blnErro = true;

	}

	else

	{

		OcultaId('vldEstado');

	}

	

		if (trim(strFormName.txtMensagem.value) == '')

	{

			ExibeId('vldMensagem');

			blnErro = true;

	}

	else

	{

		OcultaId('vldMensagem');

	}



	if (strFormName.ddlContato != undefined)

	{

			if (strFormName.ddlContato.options[strFormName.ddlContato.selectedIndex].value == 'Sel')

		{

				ExibeId('vldContato');

				blnErro = true;

		}

		else

		{

			OcultaId('vldContato');

		}

	}

	

	if (blnErro)

	{

		return false;

	}

	else

	{

		return true;

	}

	

}



// Removes leading whitespaces

function LTrim( value ) {



	var re = /\s*((\S+\s*)*)/;

	return value.replace(re, "$1");

	

}



// Removes ending whitespaces

function RTrim( value ) {

	

	var re = /((\s*\S+)*)\s*/;

	return value.replace(re, "$1");

	

}



// Removes leading and ending whitespaces

function trim( value ) {

	

	return LTrim(RTrim(value));



}



function ExibeId(strId)

{

		document.getElementById(strId).style.visibility='visible'

}



function OcultaId(strId)

{

		document.getElementById(strId).style.visibility='hidden'

}



function mascara_Numero(objCampo, intKeyCode)

{

		if(parseInt(intKeyCode) != 13)

		{

				if((parseInt(intKeyCode) < 48) || (parseInt(intKeyCode) > 57))

				{

					return false

				}

				else

				{

					return true

				}

		}

		else

		{

				return true

		}

}





