function btnHighLight(nWidth,nHeight,lHightLight)
{
	source=event.srcElement
	source.style.width=nWidth
	source.style.height=nHeight
	source.style.cursor="hand"
	source.style.borderLeft="1px"
	source.style.borderTop="1px "
	source.style.borderRight="1px"
	source.style.borderBottom="1px"
	source.style.borderColor="gray"
	if (lHightLight)
	{
		source.style.borderLeftStyle="solid";
		source.style.borderTopStyle="solid";
		source.style.borderRightStyle="solid";
		source.style.borderBottomStyle="solid";
	}
	else
	{
		source.style.borderLeftStyle="none";
		source.style.borderTopStyle="none";
		source.style.borderRightStyle="none";
		source.style.borderBottomStyle="none";
	}
	return;
}


function btnHighLight1(nWidth,nHeight,lHightLight)
{		
	//somente para tabelas
	source=event.srcElement
	source.style.cursor="hand"
	source.style.borderLeft="1px"
	source.style.borderTop="1px "
	source.style.borderRight="1px"
	source.style.borderBottom="1px"
	source.style.borderColor="white"
	if (lHightLight)
	{
		source.style.borderLeftStyle="solid";
		source.style.borderTopStyle="solid";
		source.style.borderRightStyle="solid";
		source.style.borderBottomStyle="solid";
	}
	else
	{
		source.style.borderLeftStyle="none";
		source.style.borderTopStyle="none";
		source.style.borderRightStyle="none";
		source.style.borderBottomStyle="none";
	}
	return;
}

function Procurar(CurPage)
{
	var DataIni="";
	var DataFim="";
	var cURL="";

	DataIni = DataIni + top.fraToc.Ano0.options[top.fraToc.Ano0.selectedIndex].text + ".";
	DataIni = DataIni + (top.fraToc.Mes0.selectedIndex+1) + ".";
	DataIni = DataIni + top.fraToc.Dia0.options[top.fraToc.Dia0.selectedIndex].text;

	DataFim=DataFim + top.fraToc.Ano1.options[top.fraToc.Ano1.selectedIndex].text + ".";
	DataFim=DataFim + (top.fraToc.Mes1.selectedIndex+1) + ".";
	DataFim=DataFim + top.fraToc.Dia1.options[top.fraToc.Dia1.selectedIndex].text;
	
	cUrl = "/LexMozambique/LexMozambique.asp?";
	cUrl = cUrl + "A001=M002" + "&";
	cUrl = cUrl + "Q001=" + txtPROCURAR.value + "&";
	cUrl = cUrl + "Q002=" + DataIni + "&";
	cUrl = cUrl + "Q003=" + DataFim + "&";
	cUrl = cUrl + "Q004=" + CurPage + "&";
	cUrl = cUrl + "Q006="+ chkPesquisaIntuitiva.checked + "&";
	cUrl = cUrl + "Q008="+ chkIgnorarDatas.checked + "&";
	cUrl = cUrl + "Q009=" + "&";
	cUrl = cUrl + "Q010=" + "&";
	cUrl = cUrl + "B001="+ chkLexCod.checked + "&";
	cUrl = cUrl + "B002="+ chkLexData.checked;
	top.fraToc.hiddenframeBusca.BuscaBody.document.body.innerHTML="";
	top.fraToc.hiddenframeBusca.BuscaBody.document.write('<html><body><table border="0" style="border-collapse: collapse" width="100%" id="table1"><tr><td width="1"><img border="0" src="/LexMozambique/Cenarios/JurinforLexMozambique/Generic/Default/Img/imgAguarde.gif" width="32" height="32"></td><td><font face="Verdana" size="1">Pesquisa em progresso.<br>Aguarde um momento por favor...</font></td></tr></table></body></html>');
	top.fraTocHeader.fnTabClick('2')
	top.fraToc.hiddenframeBusca.BuscaBody.location.replace(cUrl);
	return;	
}



//Procura por actos legislativos no LexData Iª série
function Procurar1(CurrPage)
{
	oriURL = "/LexMozambique/LexMozambique.asp?SEARCHSTRINGLD1=";
	oriURL = oriURL + "SEARCHACTO:" + top.fraToc.cmbLexDataActos.options[top.fraToc.cmbLexDataActos.selectedIndex].text + ";";
	oriURL = oriURL + "SEARCHNUMERO:" + top.fraToc.txtPROCURAR1.value + ";";
	oriURL = oriURL + "DATA1:" + data1 + ";";
	top.fraToc.hiddenframeBusca.BuscaBody.document.body.innerHTML="";
	top.fraToc.hiddenframeBusca.BuscaBody.document.write("Pesquisa em progresso. Aguarde um momento por favor...");
	top.fraTocHeader.fnTabClick('2')
//	top.fraToc.hiddenframeBusca.BuscaBody.location.replace(oriURL);
	return;
}


function emailCheck (emailStr)
{
	//The following pattern is used to check if the entered e-mail address fits the user@domain format.
	//It also is used to separate the username from the domain.
	var emailPat=/^(.+)@(.+)$/

	//The following string represents the pattern for matching all special characters.  We don't want to
	//allow special characters in the address.  These characters include ( ) < > @ , ; : \ " . [ ]    */
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]áàãâéèêíìóòõôúùÇçºªÑñ"

	//The following string represents the range of characters allowed in a  username or domainname.
	//It really states which chars aren't allowed.
	var validChars="\[^\\s" + specialChars + "\]"

	//The following pattern applies if the "user" is a quoted string (in which case, there are no
	//rules about which characters are allowed and which aren't; anything goes).
	//E.g. "jiminy cricket"@disney.com is a legal e-mail address.
	var quotedUser="(\"[^\"]*\")"

	//The following pattern applies for domains that are IP addresses, rather than symbolic names.
	//E.g. joe@[123.124.233.4] is a legal e-mail address. NOTE: The square brackets are required.
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/

	//The following string represents an atom (basically a series of non-special characters.)
	var atom=validChars + '+'
	
	//The following string represents one word in the typical username. For example,
	//in john.doe@somewhere.com, john and doe are words. Basically, a word is either an atom or quoted string.
	var word="(" + atom + "|" + quotedUser + ")"

	//The following pattern describes the structure of the user
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")

	//The following pattern describes the structure of a normal symbolic domain, as opposed to ipDomainPat, shown above.
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

	//Finally, let's start trying to figure out if the supplied address is valid.
	// Begin with the coarse pattern to simply break up user@domain into different pieces that are easy to analyze.
	var matchArray=emailStr.match(emailPat)
	if (matchArray==null)
	{
  		//Too many/few @'s or something; basically, this address doesn't even fit the general mould of a valid e-mail address.
		return ("ATENÇÂO: é necessário inserir o caracter <b>'@'</b> após o nome do utilizador (ex: novo.utilizador<b>@</b>domínio.pt)")

	}

	var user=matchArray[1]
	var domain=matchArray[2]

	// See if "user" is valid 
	if (user.match(userPat)==null)
	{
		// user is not valid
		return ("ATENÇÂO: o nome do utilizador contém caracteres incorrectos.")
	}

/*	//if the e-mail address is at an IP address (as opposed to a symbolic  host name) make sure the IP address is valid.
	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null)
	{
		// this is an IP address
		for (var i=1;i<=4;i++)
		{
			if (IPArray[i]>255)
			{
				return ("ATENÇÂO: o IP de destino está incorrecto (ex: novo.utilizador@<b>[123.124.233.4]</b>")
	    	}
    	}
	}
*/	

	//Domain is symbolic name
	var domainArray=domain.match(domainPat)
	if (domainArray==null)
	{
		return ("ATENÇÂO: o nome do domínio não está correcto. (ex: novo.utilizador@<b>Jurinfor.pt</b>)")
	}

	//domain name seems valid, but now make sure that it ends in a three-letter word (like com, edu, gov) or a two-letter word,
   //representing country (uk, nl), and that there's a hostname preceding the domain or country.

	//Now we need to break up the domain to get a count of how many atoms it consists of.
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	//Make sure there's a host name preceding the domain.
	if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3)
	{
		//the address must end in a two letter or three letter word.
		return ("ATENÇÂO: o e-mail tem de terminar com três letras (ex: com, edu, gov) ou com duas letras representando um país (ex: pt, sp, uk)<br>(ex: novo.utilizador@domínio.<b>pt</b>)");
	}

	if (len<2)
	{
		return ("ATENÇÂO: o nome do domínio não está correcto. (ex: novo.utilizador@<b>Jurinfor.pt</b>)")
	}
	//If we've gotten this far, everything's valid!
	return "";
}

function Str2Num(str,len)
{
	var cNewStr=""
	for(var i=0; i!=len; i++)	//Loop through each character
	{
		aChar=str.substring(i,i+1)	//Identifiy where to start
		if(aChar >= "0" && aChar <= "9")//Identify what is legal
			cNewStr=cNewStr+aChar	
	}
	return cNewStr
}

function MonthToString(theMonth,ReturnMonthShortName)
{
    if (theMonth=="1")
    {
        if (ReturnMonthShortName)
            return "Jan";
        else
            return "Janeiro";
    }

    if (theMonth=="2")
    {
        if (ReturnMonthShortName)
            return "Fev";
        else
            return "Fevereiro";
    }

    if (theMonth=="3")
    {
        if (ReturnMonthShortName)
            return "Mar";
        else
            return "Março";
    }

    if (theMonth=="4")
    {
        if (ReturnMonthShortName)
            return "Abr";
        else
            return "Abril";
    }

    if (theMonth=="5")
    {
        if (ReturnMonthShortName)
            return "Mai";
        else
            return "Maio";
    }

    if (theMonth=="6")
    {
        if (ReturnMonthShortName)
            return "Jun";
        else
            return "Junho";
    }

    if (theMonth=="7")
    {
        if (ReturnMonthShortName)
            return "Jul";
        else
            return "Julho";
    }

    if (theMonth=="8")
    {
        if (ReturnMonthShortName)
            return "Ago";
        else
            return "Agosto";
    }

    if (theMonth=="9")
    {
        if (ReturnMonthShortName)
            return "Set";
        else
            return "Setembro";
    }

    if (theMonth=="10")
    {
        if (ReturnMonthShortName)
            return "Out";
        else
            return "Outubro";
    }

    if (theMonth=="11")
    {
        if (ReturnMonthShortName)
            return "Nov";
        else
            return "Novembro";
    }

    if (theMonth=="12")
    {
        if (ReturnMonthShortName)
            return "Dez";
        else
            return "Dezembro";
    }
}

function BuildCmbPaises(oSrc,nOption2Select)
{
	if (nOption2Select=="")
		nOption2Select=114

	oSrc.options[0] = new Option("Albania")
	oSrc.options[1] = new Option("Algeria")
	oSrc.options[2] = new Option("American Samoa")
	oSrc.options[3] = new Option("Andorra")
	oSrc.options[4] = new Option("Angola")
	oSrc.options[5] = new Option("Anguilla")
	oSrc.options[6] = new Option("Antarctica")
	oSrc.options[7] = new Option("Antigua and Barbuda")
	oSrc.options[8] = new Option("Argentina")
	oSrc.options[9] = new Option("Armenia")
	oSrc.options[10] = new Option("Aruba")
	oSrc.options[11] = new Option("Australia")
	oSrc.options[12] = new Option("Austria")
	oSrc.options[12].tag = "002"
	oSrc.options[13] = new Option("Bahamas")
	oSrc.options[14] = new Option("Bahrain")
	oSrc.options[15] = new Option("Bangladesh")
	oSrc.options[16] = new Option("Barbados")
	oSrc.options[17] = new Option("Belarus")
	oSrc.options[18] = new Option("Belgium")
	oSrc.options[18].tag = "002"
	oSrc.options[19] = new Option("Belize")
	oSrc.options[20] = new Option("Bermuda")
	oSrc.options[21] = new Option("Bolivia")
	oSrc.options[22] = new Option("Bosnia/Herzegovina")
	oSrc.options[23] = new Option("Botswana")
	oSrc.options[24] = new Option("Brazil")
	oSrc.options[25] = new Option("Bulgaria")
	oSrc.options[26] = new Option("Burundi")
	oSrc.options[27] = new Option("Cambodia")
	oSrc.options[28] = new Option("Cameroon")
	oSrc.options[29] = new Option("Canada")
	oSrc.options[30] = new Option("Cape Verde")
	oSrc.options[31] = new Option("Cayman Islands")
	oSrc.options[32] = new Option("Chile")
	oSrc.options[33] = new Option("China")
	oSrc.options[34] = new Option("Colombia")
	oSrc.options[35] = new Option("Congo")
	oSrc.options[36] = new Option("Costa Rica")
	oSrc.options[37] = new Option("Croatia")
	oSrc.options[38] = new Option("Cyprus")
	oSrc.options[39] = new Option("Czech Republic")
	oSrc.options[40] = new Option("Denmark")
	oSrc.options[40].tag = "002"
	oSrc.options[41] = new Option("Dominica")
	oSrc.options[42] = new Option("Dominican Republic")
	oSrc.options[43] = new Option("East Timor")
	oSrc.options[44] = new Option("Ecuador")
	oSrc.options[45] = new Option("Egypt")
	oSrc.options[46] = new Option("El Salvador")
	oSrc.options[47] = new Option("Estonia")
	oSrc.options[48] = new Option("Ethiopia")
	oSrc.options[49] = new Option("Fiji")
	oSrc.options[50] = new Option("Finland")
	oSrc.options[50].tag = "002"
	oSrc.options[51] = new Option("France")
	oSrc.options[51].tag = "002"
	oSrc.options[52] = new Option("French Polynesia")
	oSrc.options[53] = new Option("Gambia")
	oSrc.options[54] = new Option("Georgia")
	oSrc.options[55] = new Option("Germany")
	oSrc.options[55].tag = "002"
	oSrc.options[56] = new Option("Ghana")
	oSrc.options[57] = new Option("Gibraltar")
	oSrc.options[58] = new Option("Greece")
	oSrc.options[58].tag = "002"
	oSrc.options[59] = new Option("Greenland")
	oSrc.options[60] = new Option("Grenada")
	oSrc.options[61] = new Option("Guadeloupe")
	oSrc.options[62] = new Option("Guam")
	oSrc.options[63] = new Option("Guatemala")
	oSrc.options[64] = new Option("Guinea")
	oSrc.options[65] = new Option("Guyana")
	oSrc.options[66] = new Option("Haiti")
	oSrc.options[67] = new Option("Honduras")
	oSrc.options[68] = new Option("Hong Kong")
	oSrc.options[69] = new Option("Hungary")
	oSrc.options[70] = new Option("Iceland")
	oSrc.options[71] = new Option("India")
	oSrc.options[72] = new Option("Indonesia")
	oSrc.options[73] = new Option("Ireland")
	oSrc.options[73].tag = "002"
	oSrc.options[74] = new Option("Israel")
	oSrc.options[75] = new Option("Italy")
	oSrc.options[75].tag = "002"
	oSrc.options[76] = new Option("Jamaica")
	oSrc.options[77] = new Option("Japan")
	oSrc.options[78] = new Option("Jordan")
	oSrc.options[79] = new Option("Kenya")
	oSrc.options[80] = new Option("Korea")
	oSrc.options[81] = new Option("Kuwait")
	oSrc.options[82] = new Option("Lao")
	oSrc.options[83] = new Option("Latvia")
	oSrc.options[84] = new Option("Lebanon")
	oSrc.options[85] = new Option("Liberia")
	oSrc.options[86] = new Option("Lithuania")
	oSrc.options[87] = new Option("Luxembourg")
	oSrc.options[87].tag = "002"
	oSrc.options[88] = new Option("Macau")
	oSrc.options[89] = new Option("Macedonia")
	oSrc.options[90] = new Option("Malaysia")
	oSrc.options[91] = new Option("Malta")
	oSrc.options[92] = new Option("Marshall Islands")
	oSrc.options[93] = new Option("Martinique")
	oSrc.options[94] = new Option("Mexico")
	oSrc.options[95] = new Option("Monaco")
	oSrc.options[96] = new Option("Mongolia")
	oSrc.options[97] = new Option("Morocco")
	oSrc.options[98] = new Option("Mozambique")
	oSrc.options[99] = new Option("Namibia")
	oSrc.options[100] = new Option("Nepal")
	oSrc.options[101] = new Option("Netherlands")
	oSrc.options[101].tag = "002"
	oSrc.options[102] = new Option("New Zealand")
	oSrc.options[103] = new Option("Nicaragua")
	oSrc.options[104] = new Option("Niger")
	oSrc.options[105] = new Option("Nigeria")
	oSrc.options[106] = new Option("Norfolk Island")
	oSrc.options[107] = new Option("Norway")
	oSrc.options[108] = new Option("Pakistan")
	oSrc.options[109] = new Option("Panama")
	oSrc.options[110] = new Option("Papua New Guinea")
	oSrc.options[111] = new Option("Paraguay")
	oSrc.options[112] = new Option("Peru")
	oSrc.options[113] = new Option("Philippines")
	oSrc.options[114] = new Option("Poland")
	oSrc.options[115] = new Option("Portugal")
	oSrc.options[115].tag = "001"
	oSrc.options[116] = new Option("Puerto Rico")
	oSrc.options[117] = new Option("Romania")
	oSrc.options[118] = new Option("Russian Federation")
	oSrc.options[119] = new Option("Rwanda")
	oSrc.options[120] = new Option("Saint Lucia")
	oSrc.options[121] = new Option("Samoa")
	oSrc.options[122] = new Option("São Tomé e Príncipe")
	oSrc.options[123] = new Option("Saudi Arabia")
	oSrc.options[124] = new Option("Senegal")
	oSrc.options[125] = new Option("Seychelles")
	oSrc.options[126] = new Option("Singapore")
	oSrc.options[127] = new Option("Slovakia")
	oSrc.options[128] = new Option("Slovenia")
	oSrc.options[129] = new Option("Solomon Islands")
	oSrc.options[130] = new Option("South Africa")
	oSrc.options[131] = new Option("Spain")
	oSrc.options[131].tag = "002"
	oSrc.options[132] = new Option("Sri Lanka")
	oSrc.options[133] = new Option("Sudan")
	oSrc.options[134] = new Option("Sweden")
	oSrc.options[134].tag = "002"
	oSrc.options[135] = new Option("Switzerland")
	oSrc.options[136] = new Option("Syrian Arab Republic&nbsp;")
	oSrc.options[137] = new Option("Taiwan")
	oSrc.options[138] = new Option("Tanzania")
	oSrc.options[139] = new Option("Thailand")
	oSrc.options[140] = new Option("Tokelau")
	oSrc.options[141] = new Option("Tonga")
	oSrc.options[142] = new Option("Trinidad and Tobago")
	oSrc.options[143] = new Option("Turkey")
	oSrc.options[144] = new Option("Uganda")
	oSrc.options[145] = new Option("Ukraine")
	oSrc.options[146] = new Option("United Arab Emirates")
	oSrc.options[147] = new Option("United Kingdom")
	oSrc.options[147].tag = "002"
	oSrc.options[148] = new Option("United States")
	oSrc.options[149] = new Option("Uruguay")
	oSrc.options[150] = new Option("Venezuela")
	oSrc.options[151] = new Option("Vietnam")
	oSrc.options[152] = new Option("Virgin Islands (British)")
	oSrc.options[153] = new Option("Virgin Islands (U.S.)")
	oSrc.options[154] = new Option("Yugoslavia")
	oSrc.options[155] = new Option("Zambia")
	oSrc.options[156] = new Option("Zimbabwe")
	oSrc.selectedIndex=nOption2Select
}

function BuildCmbGrau(oSrc,nOption2Select)
{
	if (nOption2Select=="")
		nOption2Select=0

	oSrc.options[0] = new Option("Título")
	oSrc.options[1] = new Option("1º Ten.")
	oSrc.options[2] = new Option("2º Ten.")
	oSrc.options[3] = new Option("Arq.")
	oSrc.options[4] = new Option("Cap.")
	oSrc.options[5] = new Option("Cmdt.")
	oSrc.options[6] = new Option("Cor.")
	oSrc.options[7] = new Option("Dr.")
	oSrc.options[8] = new Option("Dra.")
	oSrc.options[9] = new Option("Dras.")
	oSrc.options[10] = new Option("Drs.")	
	oSrc.options[11] = new Option("Eng.")
	oSrc.options[12] = new Option("Maj.")
	oSrc.options[13] = new Option("Prof.")
	oSrc.options[14] = new Option("Sarg.")
	oSrc.options[15] = new Option("Ten.")
	oSrc.options[16] = new Option("Enf.")
	oSrc.selectedIndex=nOption2Select
}

function BuildCmbProfissoes(oSrc,nOption2Select)
{
	if (nOption2Select=="")
		nOption2Select=0

	oSrc.options[0] = new Option("Escolher")
	oSrc.options[1] = new Option("Jurista")
	oSrc.options[2] = new Option("Advogado")
	oSrc.options[3] = new Option("Gestor")
	oSrc.options[4] = new Option("Estudante")	
	oSrc.selectedIndex=nOption2Select
}

function BuildCmbConhecimento(oSrc,nOption2Select)
{
	if (nOption2Select=="")
		nOption2Select=0

	oSrc.options[0] = new Option("Escolher")
	oSrc.options[1] = new Option("Internet")
	oSrc.options[2] = new Option("Imprensa escrita")
	oSrc.options[3] = new Option("Na rádio")
	oSrc.options[4] = new Option("Por artigo de opinião")
	oSrc.options[5] = new Option("Por conselho de colega/amigo")
	oSrc.options[6] = new Option("Outro")
	oSrc.selectedIndex=nOption2Select
}