//**************************************************************************************
// Input Control
//**************************************************************************************
var keybNumeric = new keybEdit('0123456789','Insira apenas numeros.');
var keybText = new keybEdit('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ΗηΑΓΐΒαγΰβΙικΝνΣΥΤσυτΪϊ-.!\"#$%&/()[]@£{}\'=+,_:;Ίͺ*<>? ','Caracter nγo Aceite.');
var keybTextHttp = new keybEdit('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ΗηΑΓΐΒαγΰβΙιΝνΣΥΤσυτΪϊ- /.:','Caracter nγo Aceite.');
var keybText2 = new keybEdit('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789- ','Caracter nγo Aceite.');

function keybEdit(strValid, strMsg) {
	var reWork = new RegExp('[a-z]','gi');		//	Regular expression\

	//	Properties
	this.valid = strValid;
	this.message = strMsg;

	//	Methods
	this.getValid = keybEditGetValid;
	this.getMessage = keybEditGetMessage;
	
	function keybEditGetValid() { return this.valid.toString();	}
	function keybEditGetMessage() {	return this.message; }
}

void function editKeyBoard(objForm, objKeyb) {

	strWork = objKeyb.getValid();
	strMsg = '';							// Error message
	blnValidChar = false;					// Valid character flag

	// Part 1: Validate input
	if(!blnValidChar)
		for(i=0;i < strWork.length;i++)
			if(window.event.keyCode == strWork.charCodeAt(i)) {
				blnValidChar = true;

				break;
			}

	// Part 2: Build error message
	if(!blnValidChar) {
		if(objKeyb.getMessage().toString().length != 0)
			alert('Erro: ' + objKeyb.getMessage());

		window.event.returnValue = false;		// Clear invalid character
		objForm.focus();						// Set focus
	}
}

void function setAdminIconEvents() 
{
	document.all._ItemDate.onkeypress = new Function('editKeyBoard(this,keybNumeric)');
	document.all._ItemHeader.onkeypress = new Function('editKeyBoard(this,keybText)');
//	document.all._ItemText.onkeypress = new Function('editKeyBoard(this,keybText)');
	document.all._ItemImageTitle.onkeypress = new Function('editKeyBoard(this,keybText)');
}

void function setAdminServicosEvents()
{
	document.all._ItemDate.onkeypress = new Function('editKeyBoard(this,keybNumeric)');
	document.all._ItemHeader.onkeypress = new Function('editKeyBoard(this,keybText)');
//	document.all._ItemText.onkeypress = new Function('editKeyBoard(this,keybText)');
	document.all._ItemDownloadTitle.onkeypress = new Function('editKeyBoard(this,keybText)');
}

void function setAdminLinksEvents() 
{
	document.all._LinksHeader.onkeypress = new Function('editKeyBoard(this,keybText)');
//	document.all._LinksText.onkeypress = new Function('editKeyBoard(this,keybText)');
	document.all._LinksLink.onkeypress = new Function('editKeyBoard(this,keybTextHttp)');
}

void function setAdminEditalEvents()
{
//	document.all._ItemDate.onkeypress = new Function('editKeyBoard(this,keybNumeric)');
	document.all._ItemDescricao.onkeypress = new Function('editKeyBoard(this,keybText)');
//	document.all._ItemNum.onkeypress = new Function('editKeyBoard(this,keybText2)');
}

void function setAdminConcursoEvents() 
{

	document.all._ItemDate.onkeypress = new Function('editKeyBoard(this,keybNumeric)');
	document.all._ItemDescricao.onkeypress = new Function('editKeyBoard(this,keybText)');
	document.all._ItemDateConclusao.onkeypress = new Function('editKeyBoard(this,keybNumeric)');
}

//**************************************************************************************
// End Input Control
//**************************************************************************************

function ChangeColor(iselectitem, myobject, flag )
{
	if( flag == 1 )
	{
		if( iselectitem == 1 )
		{
			myobject.className = "MenuOptionSelectedOver";
		}
		else
		{
			myobject.className = "MenuOptionOver";
		}
	}
	else
	{
		if( iselectitem == 1 )
		{
			myobject.className = "MenuOptionSelectedOut";
		}
		else
		{
			myobject.className = "MenuOptionOut";
		}
	}
}

function ChangeAlpha(iselectitem, myobject, flag )
{
	if( flag == 1 )
	{
		myobject.className = "IconsOver";
	}
	else
	{
		if( iselectitem == 1 )
		{
			myobject.className = "IconsNotSelectedOut";
		}
		else
		{
			myobject.className = "IconsOut";
		}
	}
}

function ChangeOption( iOption )
{
	document._Form.Option.value = iOption;
	document._Form.SubOption.value = "";
	document._Form.IconOption.value = "";
	document._Form.NewsCode.value = "";
	document._Form.ActividadesCode.value = "";
	document._Form.ServicosCode.value = "";
	document._Form.InfoGruposID.value = "";
	document._Form.submit();
}

function ChangeSubOption( iOption, iSubOption )
{
	document._Form.Option.value = iOption;
	document._Form.SubOption.value = iSubOption;
	document._Form.IconOption.value = "";
	document._Form.NewsCode.value = "";
	document._Form.ActividadesCode.value = "";
	document._Form.ServicosCode.value = "";
	document._Form.InfoGruposID.value = "";
	document._Form.submit();
}

function ChangeIcon( iOption )
{
	document._Form.Option.value = "";
	document._Form.SubOption.value = "";
	document._Form.IconOption.value = iOption;
	document._Form.NewsCode.value = "";
	document._Form.ActividadesCode.value = "";
	document._Form.ServicosCode.value = "";
	document._Form.InfoGruposID.value = "";
	document._Form.submit();
}

function ChangeIconLinkNews(  newscode )
{
	document._Form.Option.value = "";
	document._Form.SubOption.value = "";
	document._Form.IconOption.value = 1;
	document._Form.NewsCode.value = newscode;
	document._Form.ActividadesCode.value = "";
	document._Form.ServicosCode.value = "";
	document._Form.InfoGruposID.value = "";
	document._Form.submit();
}

function ChangeIconLinkActividades( actividadescode )
{
	document._Form.Option.value = "";
	document._Form.SubOption.value = "";
	document._Form.IconOption.value = 2;
	document._Form.NewsCode.value = "";
	document._Form.ActividadesCode.value = actividadescode;
	document._Form.ServicosCode.value = "";
	document._Form.InfoGruposID.value = "";
	document._Form.submit();
}

function ChangeIconLinkServicos( servicoscode )
{
	document._Form.Option.value = "";
	document._Form.SubOption.value = "";
	document._Form.IconOption.value = 3;
	document._Form.NewsCode.value = "";
	document._Form.ActividadesCode.value = "";
	document._Form.ServicosCode.value = servicoscode;
	document._Form.InfoGruposID.value = "";
	document._Form.submit();
}

function ChangeInfoGrupo( InfoGrupoID )
{
	document._Form.Option.value = "";
	document._Form.SubOption.value = "";
	document._Form.IconOption.value = "";
	document._Form.NewsCode.value = "";
	document._Form.ActividadesCode.value = "";
	document._Form.ServicosCode.value = "";
	document._Form.InfoGruposID.value = InfoGrupoID;
	document._Form.submit();
}

function ChangePage()
{
	document._Form.Option.value = "";
	document._Form.SubOption.value = "";
	document._Form.IconOption.value = "";
	document._Form.NewsCode.value = "";
	document._Form.ActividadesCode.value = "";
	document._Form.ServicosCode.value = "";
	document._Form.InfoGruposID.value = "";
	document._Form.submit();
}

function ValidateLinkSugestion()
{
 	if( document._Form._Link_Link.value.length == 0 )
	{
		alert("Link Invalido!");
		document._Form._Link_Link.focus();
		return(false);
	}
	if( document._Form._Link_Titulo.value.length == 0 )
	{
		alert("Titulo Invalido!");
		document._Form._Link_Titulo.focus();
		return(false);
	}
	if( document._Form._Link_Descricao.value.length == 0 )
	{
		alert("Descriηγo Invalida!");
		document._Form._Link_Descricao.focus();
		return(false);
	}
	alert("mensagem registada com sucesso!");
	document.getElementById("SendNewLinkSugestion").value = "do_it";
	document._Form.submit();
	return(true);
}

function ValidateFaleConnosco()
{
	if (window.RegExp)
	{
		var reg = new RegExp("^[-a-zA-Z0-9._]+@([-a-zA-Z0-9]+[.])+[a-zA-Z]?[a-zA-Z][a-zA-Z]$","g");
		if (!reg.test(document._Form._Fale_Email.value))
		{
			alert("introduza um email valido!");
			document._Form._Fale_Email.focus();
		 	return(false);
		}
	}
	alert("mensagem registada com sucesso!");
	document.getElementById("SendNewFaleConnosco").value = "do_it";
	document._Form.submit();
	return(true);
}


//--------------------------------------------------------------------------------------
//
// Administraηγo
//
//--------------------------------------------------------------------------------------
function ValidateFieldsConfig()
{		
	if( document._Form._NewsImagesPerLine.value.length == 0 )
	{
		alert("Imagens por Linha (Noticias) nao pode ser vazio!");
		document._Form._NewsImagesPerLine.focus();
		return(false);
	}

	if( document._Form._ActividadesImagesPerLine.value.length == 0 )
	{
		alert("Imagens por Linha (Actividades) nao pode ser vazio!");
		document._Form._ActividadesImagesPerLine.focus();
		return(false);
	}

	if (window.RegExp)
	{
		var reg = new RegExp("^[-a-zA-Z0-9._]+@([-a-zA-Z0-9]+[.])+[a-zA-Z]?[a-zA-Z][a-zA-Z]$","g");
		if (!reg.test(document._Form._AdminMail.value))
		{
			alert("introduza um email valido!");
			document._Form._AdminMail.focus();
		 	return(false);
		}
	}

	return(true);
	
}	

function SetUpdateNewsActividades( sCode )
{
	document._Form._Action.value = "update";
	document._Form._Code.value = sCode;
	document._Form._Status.value = "";
	document._Form.submit();
}

function SetDeleteNewsActividades( sCode )
{
	document._Form._Action.value = "delete";
	document._Form._Code.value = sCode;
	document._Form._Status.value = "";
	document._Form.submit();
}

function SetUpdateServicos( sCode )
{
	document._Form._Action.value = "update";
	document._Form._Code.value = sCode;
	document._Form._Status.value = "";
	document._Form.submit();
}

function SetDeleteServicos( sCode )
{
	document._Form._Action.value = "delete";
	document._Form._Code.value = sCode;
	document._Form._Status.value = "";
	document._Form.submit();
}

function SetUpdateConcursos( sCode )
{
	document._Form._Action.value = "update";
	document._Form._Code.value = sCode;
	document._Form._Status.value = "";
	document._Form.submit();
}

function SetDeleteConcursos( sCode )
{
	document._Form._Action.value = "delete";
	document._Form._Code.value = sCode;
	document._Form._Status.value = "";
	document._Form.submit();
}

function SetUpdateEditais( sCode )
{
	document._Form._Action.value = "update";
	document._Form._Code.value = sCode;
	document._Form._Status.value = "";
	document._Form.submit();
}

function SetDeleteEditais( sCode )
{
	document._Form._Action.value = "delete";
	document._Form._Code.value = sCode;
	document._Form._Status.value = "";
	document._Form.submit();
}

function SetUpdateLinks( sCode )
{
	document._Form._Action.value = "update";
	document._Form._LinksCode.value = sCode;
	document._Form._Status.value = "";
	document._Form.submit();
}

function SetDeleteLinks( sCode )
{
	document._Form._Action.value = "delete";
	document._Form._LinksCode.value = sCode;
	document._Form._Status.value = "";
	document._Form.submit();
}


function SetUpdateInfo( sCode )
{
	document._Form._Action.value = "update";
	document._Form._InfoCode.value = sCode;
	document._Form._Status.value = "";
	document._Form.submit();
}

function SetDeleteInfo( sCode )
{
	document._Form._Action.value = "delete";
	document._Form._InfoCode.value = sCode;
	document._Form._Status.value = "";
	document._Form.submit();
}

//--------------------------------------------------------------------------------------
//
// Validaηγo dos Icons: Novidades, Actividades
//
//--------------------------------------------------------------------------------------
function ValidateFields()
{		
	if( document._Form._ItemDate.value.length == 0 )
	{
		alert("O campo de data nao pode ser vazio!");
		document._Form._ItemDate.focus();
		return(false);
	}
	else
	{
		if( !checkCharacter( document._Form._ItemDate.value , "0123456789" ) )
		{
			alert("Insira apenas numeros.");
			document._Form._ItemDate.focus();
			return(false);
		}
	}
	
	if( document._Form._ItemHeader.value.length == 0 )
	{
		alert("O Cabeηalho nao pode ser vazio!");
		document._Form._ItemHeader.focus();
		return(false);
	}
	else
	{
/*		if( !checkCharacter( document._Form._ItemHeader.value , "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ΗηΑΓΐΒαγΰβΙικΝνΣΥΤσυτΪϊ-.!\"#$%&/()[]@£{}\'=+,_:;Ίͺ*<>? " ) )
		{
			alert("Caracter nγo ι aceite");
			document._Form._ItemHeader.focus();
			return(false);
		}
*/	}
	
	
	if( document._Form._ItemText.value.length == 0 )
	{
		alert("A Noticia tem que ter texto!");
		document._Form._ItemText.focus();
		return(false);
	}
	else
	{
/*		if( !checkCharacter( document._Form._ItemText.value , "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ΗηΑΓΐΒαγΰβΙικΝνΣΥΤσυτΪϊ-.!\"#$%&/()[]@£{}'=+,_:;Ίͺ*<>? " ) )
		{
			alert("Caracter nγo ι aceite.");
			document._Form._ItemText.focus();
			return(false);
		}
*/	}

	if( document._Form._ItemImageTitle.value.length > 0 )
	{
		if( !checkCharacter( document._Form._ItemImageTitle.value , "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ΗηΑΓΐΒαγΰβΙικΝνΣΥΤσυτΪϊ-.!\"#$%&/()[]@£{}'=+,_:;Ίͺ*<>? " ) )
		{
			alert("Caracter nγo ι aceite.");
			document._Form._ItemImageTitle.focus();
			return(false);
		}
	}
	
	var sFilesSelected = "";
	var Selectobject = document.getElementById("_ImageLinkSelected");

	for( var vciclo=0; vciclo<Selectobject.length; vciclo++ )
	{
		if(sFilesSelected.length > 0)
		{
			sFilesSelected = sFilesSelected + "§";
		}
		sFilesSelected = sFilesSelected + Selectobject.options[vciclo].innerText;
	}			
	document._Form._ItemImageLink.value = sFilesSelected;

	return(true);
}

//--------------------------------------------------------------------------------------
//
// Validaηγo dos Icons: Serviηos
//
//--------------------------------------------------------------------------------------
function ValidateFieldsServicos()
{		
	if( document._Form._ItemDate.value.length == 0 )
	{
		alert("O campo de data nao pode ser vazio!");
		document._Form._ItemDate.focus();
		return(false);
	}
	else
	{
		if( !checkCharacter( document._Form._ItemDate.value , "0123456789" ) )
		{
			alert("Insira apenas numeros.");
			document._Form._ItemDate.focus();
			return(false);
		}
	}
	
	if( document._Form._ItemHeader.value.length == 0 )
	{
		alert("O Cabeηalho nao pode ser vazio!");
		document._Form._ItemHeader.focus();
		return(false);
	}
	else
	{
/*		if( !checkCharacter( document._Form._ItemHeader.value , "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ΗηΑΓΐΒαγΰβΙικΝνΣΥΤσυτΪϊ-.!\"#$%&/()[]@£{}'=+,_:;Ίͺ*<>? " ) )
		{
			alert("Caracter nγo ι aceite.");
			document._Form._ItemHeader.focus();
			return(false);
		}
*/	}
	
	
	if( document._Form._ItemText.value.length == 0 )
	{
		alert("A Noticia tem que ter texto!");
		document._Form._ItemText.focus();
		return(false);
	}
	else
	{
/*		if( !checkCharacter( document._Form._ItemText.value , "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ΗηΑΓΐΒαγΰβΙικΝνΣΥΤσυτΪϊ-.!\"#$%&/()[]@£{}'=+,_:;Ίͺ*<>? " ) )
		{
			alert("Caracter nγo ι aceite.");
			document._Form._ItemText.focus();
			return(false);
		}
*/	}

	if( document._Form._ItemDownloadTitle.value.length > 0 )
	{
		if( !checkCharacter( document._Form._ItemDownloadTitle.value , "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ΗηΑΓΐΒαγΰβΙικΝνΣΥΤσυτΪϊ-.!\"#$%&/()[]@£{}'=+,_:;Ίͺ*<>? " ) )
		{
			alert("Caracter nγo ι aceite.");
			document._Form._ItemDownloadTitle.focus();
			return(false);
		}
	}
	
	var sFilesSelected = "";
	var Selectobject = document.getElementById("_ImageLinkSelected");

	for( var vciclo=0; vciclo<Selectobject.length; vciclo++ )
	{
		if(sFilesSelected.length > 0)
		{
			sFilesSelected = sFilesSelected + "§";
		}
		sFilesSelected = sFilesSelected + Selectobject.options[vciclo].innerText;
	}			
	document._Form._ItemDownloadLink.value = sFilesSelected;

	return(true);
}

//--------------------------------------------------------------------------------------
//
// Validaηγo dos Links
//
//--------------------------------------------------------------------------------------
function ValidateFieldsLinks()
{		

	if( document._Form._LinksHeader.value.length == 0 )
	{
		alert("O Cabeηalho nao pode ser vazio!");
		document._Form._LinksHeader.focus();
		return(false);
	}
	else
	{
		if( !checkCharacter( document._Form._LinksHeader.value , "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ΗηΑΓΐΒαγΰβΙικΝνΣΥΤσυτΪϊ-.!\"#$%&/()[]@£{}'=+,_:;Ίͺ*<>? " ) )
		{
			alert("Caracter nγo ι aceite.");
			document._Form._LinksHeader.focus();
			return(false);
		}
	}

	if( document._Form._LinksText.value.length == 0 )
	{
		alert("O link tem que ter texto!");
		document._Form._NewsText.focus();
		return(false);
	}
	else
	{
/*		if( !checkCharacter( document._Form._LinksText.value , "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ΗηΑΓΐΒαγΰβΙικΝνΣΥΤσυτΪϊ-.!\"#$%&/()[]@£{}'=+,_:;Ίͺ*<>? " ) )
		{
			alert("Caracter nγo ι aceite.");
			document._Form._LinksText.focus();
			return(false);
		}
*/	}
	
	if( document._Form._LinksLink.value.length == 0 )
	{
		alert("O campo de link nao pode ser vazio!");
		document._Form._LinksLink.focus();
		return(false);
	}
	else
	{
		if( !checkCharacter( document._Form._LinksLink.value , "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ΗηΑΓΐΒαγΰβΙικΝνΣΥΤσυτΪϊ-.!\"#$%&/()[]@£{}'=+,_:;Ίͺ*<>? " ) )
		{
			alert("Caracter nγo ι aceite.");
			document._Form._LinksLink.focus();
			return(false);
		}
	}
}

//--------------------------------------------------------------------------------------
//
// Validaηγo dos Editais
//
//--------------------------------------------------------------------------------------
function ValidateFieldsEditais()
{		
/*
	if( document._Form._ItemDate.value.length == 0 )
	{
		alert("O campo de data nao pode ser vazio!");
		document._Form._ItemDate.focus();
		return(false);
	}
	else
	{
		if( !checkCharacter( document._Form._ItemDate.value , "0123456789" ) )
		{
			alert("Insira apenas numeros.");
			document._Form._ItemDate.focus();
			return(false);
		}
	}
*/	
	if( document._Form._ItemDescricao.value.length == 0 )
	{
		alert("A Descriηγo nao pode ser vazia!");
		document._Form._ItemDescricao.focus();
		return(false);
	}
	else
	{
		if( !checkCharacter( document._Form._ItemDescricao.value , "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ΗηΑΓΐΒαγΰβΙικΝνΣΥΤσυτΪϊ-.!\"#$%&/()[]@£{}'=+,_:;Ίͺ*<>? " ) )
		{
			alert("Caracter nγo ι aceite.");
			document._Form._ItemDescricao.focus();
			return(false);
		}
	}
/*
	if( document._Form._ItemNum.value.length == 0 )
	{
		alert("O numero de edital nao pode ser vazio!");
		document._Form._ItemNum.focus();
		return(false);
	}
	else
	{
		if( !checkCharacter( document._Form._ItemNum.value , "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ΗηΑΓΐΒαγΰβΙικΝνΣΥΤσυτΪϊ-.!\"#$%&/()[]@£{}'=+,_:;Ίͺ*<>? " ) )
		{
			alert("Caracter nγo ι aceite.");
			document._Form._ItemNum.focus();
			return(false);
		}
	}
*/
	var sFilesSelected = "";
	var Selectobject = document.getElementById("_ImageLinkSelected");

	for( var vciclo=0; vciclo<Selectobject.length; vciclo++ )
	{
		if(sFilesSelected.length > 0)
		{
			sFilesSelected = sFilesSelected + "|";
		}
		sFilesSelected = sFilesSelected + Selectobject.options[vciclo].innerText;
	}			
	document._Form._ItemDownloadFile.value = sFilesSelected;

	return(true);
}

//--------------------------------------------------------------------------------------
//
// Validaηγo dos Concursos
//
//--------------------------------------------------------------------------------------
function ValidateFieldsConcursos()
{		
	if( document._Form._ItemDate.value.length == 0 )
	{
		alert("O campo de data nao pode ser vazio!");
		document._Form._ItemDate.focus();
		return(false);
	}
	else
	{
		if( !checkCharacter( document._Form._ItemDate.value , "0123456789" ) )
		{
			alert("Insira apenas numeros.");
			document._Form._ItemDate.focus();
			return(false);
		}
	}
	
	if( document._Form._ItemDescricao.value.length == 0 )
	{
		alert("A Descriηγo nao pode ser vazia!");
		document._Form._ItemDescricao.focus();
		return(false);
	}
	else
	{
		if( !checkCharacter( document._Form._ItemDescricao.value , "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ΗηΑΓΐΒαγΰβΙικΝνΣΥΤσυτΪϊ-.!\"#$%&/()[]@£{}'=+,_:;Ίͺ*<>? " ) )
		{
			alert("Caracter nγo ι aceite.");
			document._Form._ItemDescricao.focus();
			return(false);
		}
	}

	if( document._Form._ItemDateConclusao.value.length == 0 )
	{
		alert("O campo de data de conclusao nao pode ser vazio!");
		document._Form._ItemDateConclusao.focus();
		return(false);
	}
	else
	{
		if( !checkCharacter( document._Form._ItemDateConclusao.value , "0123456789" ) )
		{
			alert("Insira apenas numeros.");
			document._Form._ItemDateConclusao.focus();
			return(false);
		}
	}

	var sFilesSelected = "";
	var Selectobject = document.getElementById("_ImageLinkSelected");

	for( var vciclo=0; vciclo<Selectobject.length; vciclo++ )
	{
		if(sFilesSelected.length > 0)
		{
			sFilesSelected = sFilesSelected + "|";
		}
		sFilesSelected = sFilesSelected + Selectobject.options[vciclo].innerText;
	}			
	document._Form._ItemDownloadFile.value = sFilesSelected;

	return(true);
}


function ValidateFieldsInfo()
{
	if( document._Form._InfoTitle.value.length == 0 )
	{
		alert("O Titulo nao pode ser vazio!");
		document._Form._InfoTitle.focus();
		return(false);
	}

	if( document._Form._InfoText.value.length == 0 )
	{
		alert("O Texto nao pode ser vazio!");
		document._Form._InfoText.focus();
		return(false);
	}
}


//**************************************************************
//	do_function( theselect, thetext )
//
//   theselect ----- o nome do select que estamos a trabalhar
//   thetext ------- o nome da opηγo a tratar
//**************************************************************
function do_function(theselect, thetext)
{
	var Selectobject = document.getElementById(theselect);	

	if(thetext.length==0)
	{
		return;
	}
	
	for( vciclo=0; vciclo<Selectobject.length; vciclo++ )
	{
		if(Selectobject.options[vciclo].innerText==thetext)
		{
			alert("Already exist!");
			return;	
		}
	}

	new_option = new Option(thetext, false, false );   
	Selectobject[Selectobject.length] = new_option;			// adiciona a nova opηγo
	Selectobject.size = Selectobject.length; 				// actualiza a altura da select box
	Selectobject[Selectobject.length-1].selected = true;	//selecciona a ultima opηγo
}

//**************************************************************
//	actionselected( n_action, theselect )
//
//   n_action ------ tecla UP, tecla DOWN, tecla ADD, tecla DEL
//   theselect ----- o nome do select que estamos a trabalhar
//**************************************************************
function actionselected( n_action, theselect )
{
	var Selectobject = document.getElementById(theselect);	
	var new_option;

	selected_idx = Selectobject.selectedIndex //indice que esta selecionado (comeηa por 0)

	if( Selectobject.length == 0 ) // verificamos se existem opηυes na select box
	{
		return;
	}

	if( selected_idx >= 0 ) 	// so executa a funηγo no caso de termos alguma coisa seleccionada, isto ι se tivermos um indice
	{	
		if( n_action == 'add' )
		{
			do_function("_ImageLinkSelected",Selectobject.options[selected_idx].innerText); // adiciona a opηγo no outro select
			Selectobject[selected_idx] = null;										// apaga a opηγo no select corrente
		}

		else if( n_action == 'del' )
		{
			if(theselect=='_ImageLinkDefined')
			{
				Selectobject[selected_idx] = null;									// apaga a opηγo no select corrente
			}
			else
			{
				do_function("_ImageLinkDefined",Selectobject.options[selected_idx].innerText); // adiciona a opηγo no outro select
				Selectobject[selected_idx] = null;										// apaga a opηγo no select corrente
			}
		}
	}

	document._Form._ImageLinkDefined.size = 10;
	document._Form._ImageLinkSelected.size = 10;

}

//**************************************************************
//	checkCharacter
//**************************************************************
function checkCharacter( myString, MyvalidChars )
{
	for (var i=0; i < myString.length; i++) 
	{
		var letter = myString.charAt(i).toLowerCase();

		if (MyvalidChars.indexOf(letter) != -1)
		{
			continue;
		}
		else
		{
			return(false);
		}
	}

	return(true);
}

//**************************************************************
//	ShowInfo
//**************************************************************
function ShowInfo( myID )
{
	var objCurrentID = document.getElementById( "p" + myID );
	
	for( idx = 1; idx <13; idx++)
	{ 
		if( idx != myID )
		{
			document.getElementById( "p" + idx ).style.display = "none";
		}
	}
	
	if( objCurrentID.style.display == "none" ) 
	{ 
		objCurrentID.style.display = "block";
	}
	else
	{
		objCurrentID.style.display = "none";
	}
}	