/* 
    VERSiTE - 2008 - www.versite.com.br 
*/


/*############################################################################
 Muda tamanho da fonte
##############################################################################*/
function mudaFonte(elem, acao) {
    var tamInic = 12;
    var tamMin = 8;
    var tamMax = 18;
    if ($(elem).style.fontSize == "") {
        var tamFonte = tamInic;
    } else {
        var tamFonte = parseInt($(elem).style.fontSize);
    }
    switch (acao) {
      case "+":
        if (tamFonte < tamMax) {
            $(elem).style.fontSize = tamFonte + 1 + "px";
        }
        break;
      case "-":
        if (tamFonte > tamMin) {
            $(elem).style.fontSize = tamFonte - 1 + "px";
        }
        break;
      default:;
    }
}

                         // Função que fecha o pop-up ao clicar no botao fechar
                            function fechar(){
                            document.getElementById('modelo_protocolo').style.display = "none";
                            }
                         // Aqui definimos o tempo para fechar o pop-up automaticamente
                            function abrir(){
                            document.getElementById('modelo_protocolo').style.display = "block";
                            setTimeout ("fechar()", 3000);
                            }

// Firefox worked fine. Internet Explorer shows scrollbar because of frameborder
function resizeFrame(f) {
f.style.height = f.contentWindow.document.body.scrollHeight + "px";
}

  function IsAlphaNum( str ) {
              // Return immediately if an invalid value was passed in
              if (str+"" == "undefined" || str+"" == "null" || str+"" == "")	
              return false;
			  
              var isValid = true;
	            // convert to a string for performing string comparisons.
            	str += "";	
             	// Loop through length of string and test for any alpha numeric 
                // characters
            	for (i = 0; i < str.length; i++) {
            		// Alphanumeric must be between "0"-"9", "A"-"Z", or "a"-"z"
      	            if (!(((str.charAt(i) >= "a") && (str.charAt(i) <= "z")) ||
               			 ((str.charAt(i) >= "A") && (str.charAt(i) <= "Z")))){
				       isValid = false;
			    	   break;
		            }	
            	} 
            	return isValid;
              }
			  
			  function vejanum(){
				  if (document.proc.origem.value==""){
				     alert("FAVOR INFORMAR A ORIGEM DO PROCESSO. \n\n\Exemplo:\n\n23 - corresponde a processo dado entrada na SUCOM-BONOCÔ\n48 - corresponde a processo dado entrada no SAC-IGUATEMI\n47 - corresponde a processo dado entrada no SAC-EMPRESARIAL");
        		     document.proc.origem.focus();
					 return false;
				  }else{
				     if (IsAlphaNum(document.proc.origem.value)==true){
				        alert("FAVOR INFORMAR CONTEÚDO NÚMERICO");
  	 		 	        document.proc.origem.value="";	 
  	  		 	        document.proc.origem.focus();					 						
				        return false;   	 
					 }else{
					    return true;
					 }	
				  }
				}

function buscar() {
document.location.href=document.formServicos.buscaAssuntos.value;
}

function populate()
{

	var box = document.formServicos.buscaCategorias;
	var number = box.selectedIndex;
	if (!number) return;
	var list = assuntos[number];
	var box2 = document.formServicos.buscaAssuntos;
	box2.options.length = 0;
	for(i=0;i<list.length;i+=2)
	{
		box2.options[i/2] = new Option(list[i],list[i+1]);
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}