<!--

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function mudaImagem(objImagem,strSrc) {
	objImagem.src = strSrc;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}



function FormataCampo(Campo,teclapres,mascara){ 

	if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;

     //pegando o tamanho do texto da caixa de texto com delay de -1 no event 
    //ou seja o caractere que foi digitado não será contado. 
    strtext = Campo.value 
    tamtext = strtext.length 
    //pegando o tamanho da mascara 
    tammask = mascara.length 
    //criando um array para guardar cada caractere da máscara 
    arrmask = new Array(tammask)     
    //jogando os caracteres para o vetor 
    for (var i = 0 ; i < tammask; i++){ 
        arrmask[i] = mascara.slice(i,i+1) 
    }  
    //alert (teclapres.keyCode) 
    //começando o trabalho sujo 
    if (((((arrmask[tamtext] == "#") || (arrmask[tamtext] == "9"))) || (((arrmask[tamtext+1] != "#") || (arrmask[tamtext+1] != "9"))))){ 
        if ((teclapres.keyCode >= 37 && teclapres.keyCode <= 40)||(teclapres.keyCode >= 48 && teclapres.keyCode <= 57)||(teclapres.keyCode >= 96 && teclapres.keyCode <= 105)||(teclapres.keyCode == 8)||(teclapres.keyCode == 9) ||(teclapres.keyCode == 46) ||(teclapres.keyCode == 13)){ 
            Organiza_Casa(Campo,arrmask[tamtext],teclapres.keyCode,strtext)         
        } 
        else{ 
            Detona_Event(Campo,strtext) 
        } 
    } 
    else{//Aqui funcionaria a mascara para números mas eu ainda não implementei 
        if ((arrmask[tamtext] == "A"))    { 
            charupper = event.valueOf() 
            //charupper = charupper.toUpperCase() 
            Detona_Event(Campo,strtext) 
            masktext = strtext + charupper  
            Campo.value = masktext 
        } 
    } 
} 
function Organiza_Casa(Campo,arrpos,teclapres_key,strtext){ 
    if (((arrpos == "/") || (arrpos == ".") || (arrpos == ",") || (arrpos == ":") || (arrpos == " ") || (arrpos == "-")) && !(teclapres_key == 8)){ 
        separador = arrpos 
        masktext = strtext + separador 
        Campo.value = masktext 
    } 
} 
function Detona_Event(Campo,strtext){ 
    event.returnValue = false 
    if (strtext != "") { 
        Campo.value = strtext 
    } 
} 


  function $(id) {
    // Captura um elemento atraves do ID ou tagname dentro de um dos forms
		var result =null;
		try {
			result = document.getElementById(id);
		}
		catch(e) {
			result = null;
		}
		if (result == null)			
			try {
				for (var i=0, len = (forms = document.forms).length; i < len; i++)
					if ((elem = forms[i][id]) != null) {
						result = elem
						break;
					}
			}
			catch(e) {
				result = null;
			}
		return result;
  }


function WindowDiv(titulo, w, h, l, t, content) {
	if (titulo == null) {
      try {
        document.body.scroll = "yes";
		document.body.removeChild($('WindowDivIFrame'));
        document.body.removeChild($('WindowDivTitle'));
        document.body.removeChild($('WindowDivContent'));
		document.body.removeChild($('WindowDivArea'));
      }
      catch(e) {
		return false;
      } 
      return false;  
    }    
    content=!content?'':content;      
    var moz = !document.all; // Mozila
    if (!moz) {
      if ((l == -1) && (t == -1)) { //center 
        l = (document.body.offsetWidth/2.1)-(w/2);
        t = (document.body.offsetHeight/2.1)-(h/2) + (document.body.scrollTop);
      }  
    }
    else {  
      if ((l == -1) && (t == -1)) { //center 
        l = (document.body.clientWidth/2.1)-(w/2);
        t = (document.body.clientHeight/2.1)-(h/2) + (document.body.scrollTop);
      }  
    }  
    
    var topFrame = document.body.scrollTop;
    var leftFrame = document.body.scrollLeft;
    var iframe=document.createElement('iframe');	
    with(iframe) { 
      	id = "WindowDivIFrame";
      	style.position = "absolute";
      	style.background = "#FFFFFF";  		
      	style.MozOpacity = "0.1";
     	style.filter = "alpha(opacity=10)";
      	frameBorder = "no";
      	style.diplay = "";
      	style.top = topFrame;
  		style.left = leftFrame;
  		style.width = "100%";
  		style.height = "100%"; 
      	style.zIndex = "998";
    }	
    document.body.appendChild(iframe);

    var idivArea=document.createElement('div');	
    with(idivArea) {  	
      	id = "WindowDivArea";
      	style.position = "absolute";
      	style.background = "#FFFFFF";  		
     	style.MozOpacity = "0.3";
      	style.filter = "alpha(opacity=30)";
      	frameBorder = "no";
     	style.diplay = "";
      	style.top = topFrame;
  		style.left = leftFrame;
  		style.width = "100%";
  		style.height = "100%"; 
      	style.zIndex = "999";
		style.background = "black";
		//src="imagens/nome_imagem.jpg"
    }	
    document.body.appendChild(idivArea);
    
    var divTitle = document.createElement('div');	
    with(divTitle)	{		
      	id = "WindowDivTitle";
      	style.position = "absolute";
      	style.background = "#8BBDD6";
     	style.color = "black";
      	style.borderStyle = "solid";
      	style.borderColor = "black";
      	style.borderWidth  = "1";
      	style.fontFamily = "Arial";
      	style.fontSize = "13px";
     	style.padding = "2";
      	style.zIndex = "1000";
   		style.top = t;
  		style.left = l;
  		style.width = w;
  		style.height = 21;
      	innerHTML = titulo;    
    }	  
    document.body.appendChild(divTitle);
    
    var divContent=document.createElement('div');	
    with(divContent)	{		
      	id = "WindowDivContent";
      	style.position = "absolute";
      	style.background = "#F0F0F0";  		
      	style.borderStyle = "solid";
      	style.borderColor = "black";    
      	style.borderWidth  = "1";
      	style.fontFamily = "Arial";
      	style.fontSize = "13px";
      	style.padding = "2";    
      	style.zIndex = "1000";
   		if (moz)
        	style.top = t+25;
      	else
        	style.top = t+21;
  			style.left = l;
  			style.width = w;
  			style.height = h-22;
      		innerHTML = content;    
    }	
    document.body.appendChild(divContent);
    document.body.scroll = "no";
  	return;
  }   

//-->
