function validaBotao(oque,qual){
	if((oque=="" || oque==undefined) && (qual=="" || qual==undefined)){
		document.getElementById("botao").className = "habilitado";	
	} else {
		if(formatCamp(oque,qual)){
			document.getElementById("botao").className = "habilitado";	
			return true;
		} else {
			document.getElementById("botao").className = "";
			return false;
		}
	}
}
function mostraResposta(qual,tot){
	for(i=0;i<tot;i++){
		resp = "resp" +i;
		respId = document.getElementById(resp);
		try {
			if(i==qual) { 
				if(respId.className == "abre"){
					respId.className = "fecha"; 
				}
				else{
					respId.className = "abre";
				}
			}
			else{ 
				respId.className = "fecha"; 
			} 
				
			}
		catch(e) {
			break;									
		} 
	}
}

function mostra(qual,combo){
	combo = (combo==undefined || combo=='') ? false : combo;
	if(combo){
		document.getElementById(combo).className='esconde';
	}
	document.getElementById(qual).className = 'tooltip aberto';
}
function fecha(qual,combo){
	combo = (combo==undefined || combo=='') ? false : combo;
	if(combo){
		document.getElementById(combo).className='ComboValor';
	}
	document.getElementById(qual).className = 'tooltip';
}


//FUNÇÕES PARA ABERTURA DE LINKS
function random(r1,r2){return Math.round(Math.random()*(r2-r1))+ (r2>r1?r1:r2);}
function Win(w,h){this.width=w;this.height=h;this.top=0;this.left=0;}
function openLink(parms){
	if(parms=='')return;
	var rnd='',aP=parms.split(';'),ftr='titlebar=yes';
	r=random(1,10000);
	if(parms.indexOf('?')==-1){j='?'}else{j='&'}
	if((/\..*htm.*/.test(aP[0])||/\..*cgi.*/.test(aP[0])||/.\/$/.test(aP[0]))&&!/#/.test(aP[0]))rnd=j+'rnd='+r;
	if(aP.length==1){location.href=parms+rnd;return;}
	var prm=aP[1].split(',');
	switch(prm[0]){
		case 'ib':
			var w=new Win(790,523);
			w.status='yes';w.top='0';w.left='0';w.resizable=document.layers?'no':'yes';			
			r='';
			break;
		case 'app':
			var w=new Win(790,523);
			w.status='yes';w.top='0';w.left='0';w.resizable=document.layers?'no':'yes';			
			break;
		case 'app_s':
			var w=new Win(790,535);
			w.status='yes';w.top='0';w.left='0';w.resizable=document.layers?'no':'yes';	w.scrollbars='yes';
			break;
		case 'popup':
			w=new Win(prm[1],prm[2]);w.scrollbars='yes';
			w.resizable='yes';
			break;
		case 'opener':
			w=opener;
			w.location.replace(aP[0]+rnd);
			w.focus();
			return;
		case 'opener_f':
			w=parent.opener;
			w.location.replace(aP[0]+rnd);
			w.focus();
			return;
		case 'new':
			var w=new Win(790,400),rnd='';
			w.resizable='yes';w.menubar='yes';w.location='yes';w.scrollbars='yes';w.toolbar='yes';w.status='yes';
			break;
		case 'seguros':
			var w=new Win(797,414);
			w.location='no';w.status='yes';w.scrollbars='yes';w.resizable='yes';w.top='0';w.left='0';
			break;
		case 'hotsite':
			w=new Win(prm[1],prm[2]);
			break;
		case 'hotsite_st':
			w=new Win(prm[1],prm[2]);
			w.status='yes'
			break;
		case 'popup_st':
			w=new Win(prm[1],prm[2]);w.scrollbars='yes';w.status='yes';
			w.resizable='yes';
			break;
	}
	for(var i in w)ftr+=','+i+"="+ w[i];
	var jan=window.open(aP[0]+rnd,'HSBC'+r,ftr);
	return;
}

