// QualiBest
// Funcoes auxiliares
//---------------------------------------------------------------

// Nao deixa a pagina carregar dentro de um frame
if (top.frames.length != 0) {
	top.location = self.document.location;
}

// Abre uma nova janela
function novaJanela(sURL,top,left,w,h,scrollOn){
    newwindow=open(sURL,"QualiBest","top="+top+",left="+left+",scrollbars="+scrollOn+",titlebar=no,toolbar=no,directories=no,menubar=no,resizable=no,status=no,width="+w+",height="+h);
}
//-->

// Funcao que conta o numero de caracteres
function textCounter(campo, countcampo, maxlimit) {
    if (campo.value.length > maxlimit)
        campo.value = campo.value.substring(0, maxlimit);
    else
        countcampo.value = maxlimit - campo.value.length;
}
//-->

function janela_lembrarsenha() {
    newwindow=open("http://www.qualibest.com.br/cgi-bin/membros.cgi?lembrarsenha_form=1","LembrarSenha","top=200,left=210,scrollbars=0,titlebar=no,toolbar=no,directories=no,menubar=no,resizable=no,status=no,width=399,height=170");
}

function numbersonly(myfield, e, dec) {
    var key;
    var keychar;

    if (window.event)
        key = window.event.keyCode;
    else if (e)
        key = e.which;
    else
        return true;
    keychar = String.fromCharCode(key);

    // control keys
    if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) )
        return true;
    // numbers
    else if ((("0123456789").indexOf(keychar) > -1))
        return true;
    // decimal point jump
    else if (dec && (keychar == ".")) {
        myfield.form.elements[dec].focus();
        return false;
    }
    else
        return false;
}

function checkBrowser(){
	T=this
	b=navigator.appName
	v=navigator.appVersion
	u=navigator.userAgent
	if(b=='Netscape')T.b='ns'
	else if(b=='Microsoft Internet Explorer')T.b='ie'
	else T.b=b
	T.v=parseInt(v)
	T.ns=(T.b=='ns'&&T.v>=4)
	T.ns4=(T.b=='ns'&&T.v==4)
	T.ns5=(T.b=='ns'&&T.v==5)
	T.ns6=(T.b=='ns'&&T.v==5)
	T.ie=(T.b=='ie'&&T.v>=4)
	T.ie4=(u.indexOf('MSIE 4')>0)
	T.ie5=(u.indexOf('MSIE 5.0')>0)
	T.ie55=(u.indexOf('MSIE 5.5')>0)
	T.ie6=(u.indexOf('MSIE 6.0')>0)
	if(T.ie5)T.v=5
	if(T.ie55)T.v=5.5
	if(T.ie6)T.v=6
	T.min=(T.ns||T.ie)
	T.dom=(T.v>=5)
	T.win=(u.indexOf('Win')>0)
	T.mac=(u.indexOf('Mac')>0)
}

is = new checkBrowser()