// global functions

var picOn = new Image(15,15); picOn.src = "images/global/hart_on.gif";
var picOff = new Image(15,15); picOff.src = "images/global/hart_off.gif";

function vote(b,n,t){
	for(i=1;i<4;i++){
		var pic = document.getElementById(b+i);
		//alert(document.getElementById(v1));
		(i<=n)? pic.src = picOn.src : pic.src = picOff.src;
	}
	var texto = document.getElementById(b+"Txt");
	texto.innerHTML = t;
}

function ResetText(id, text) {
	var el = document.getElementById(id);
	if (el.value == text){
		el.value='';
	}
}

function WriteText(id, text) {
	var el = document.getElementById(id);
	if (el.value == ''){
		el.value=text;
	}
}

/* RadWindow */

function OpenRadWindow(url, id){ 
	window.radopen(url, id);
}

function GetRadWindow(){
    var oWindow = null;
    if (window.radWindow) oWindow = window.radWindow;
    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
    return oWindow;
} 

function OnClientClose(oWindow) { 
	oWindow.Close();
	oWindow.BrowserWindow.location.reload();
}

/* DropDown Listagem */

function Jump(name) {
	location.href="#" + name;
}

//Pesquisa

/*	wbBoxValidaPesquisa(obj_elemento_a_validar) -> boolean
Verifica se o inserido na caixa de diálogo está preenchido e se o o seu conteúdo não coincide
com o default existente aquando entrada inicial.
*/
function IsValidSearch(obj, texto, errorMsg) {
	if (Trim(obj.value).length < 3 || obj.value == texto) {
		alert(errorMsg);
		return false;
	}

	return true;
}
