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 valida_cad_simples(){
	var Form
	Form = document.cadastrar
	if (Form.pf_nome.value.length == 0 ) {
		alert('Por favor, informe seu nome completo.');
		Form.pf_nome.focus();
		return false;
    }
	if(Form.pf_email.value.indexOf("@")==-1 || Form.pf_email.value.indexOf(".")==-1 || Form.pf_email.value==''){
		alert(' Verifique se o digitou corretamente seu e-mail.')
		Form.pf_email.focus();
		return false;
	}
	return true
}
function valida_contato(){
	var Form
	Form = document.form_fale
	if (Form.pf_nome.value.length == 0 ) {
		alert('Por favor, informe seu nome completo.');
		Form.pf_nome.focus();
		return false;
    }
	if(Form.pf_email.value.indexOf("@")==-1 || Form.pf_email.value.indexOf(".")==-1 || Form.pf_email.value==''){
		alert(' Verifique se o digitou corretamente seu e-mail.')
		Form.pf_email.focus();
		return false;
	}
	return true
}

function Amplia_Imagem_Livre(img,winName,width,height,features) { 
//1.1 kadazuro kadazuro@kardouz.com
	if(window.screen){
		per_ancho=(width/screen.width)*100;//porcentaje screen-ancho
		per_alto=(height/width)*100;//porcentaje de ancho-alto
		win_ancho=(screen.width*per_ancho)/100;//ancho de la ventana
		win_alto=(win_ancho*per_alto)/100;//alto de la ventana
		x=(screen.width-win_ancho)/2;//centra x
		y=(screen.height-win_alto)/2;//centra y
	}else{// si el buscador es 4-- queda todo igual :(
		x=0;
		y=0;
		win_ancho=w;
		win_alto=y;
	}
	winfeatures=("top="+y+",left="+x+",width="+win_ancho+",height="+win_alto+",scrollbars=no");
	window.open("mostra_img_gd.asp?imagem="+img+"",winName,winfeatures);
}

function tamanho_campo(objA, objP,tipo, tamanho) {
	var key = window.event.keyCode;	
  	if(tipo==0) {
				if (( key < 47 )||( key > 58 )) {
						window.event.returnValue = null; 
						return; 
     			}
 			}
	 caracter = String.fromCharCode(key); 
   	 palavra = objA.value +  caracter; 
	 if (palavra.length == tamanho) 
   		{
   			objA.value = palavra;
			window.event.returnValue = null;
			objP.focus();
			return;
   		}
   	 else
   		{ 
			if (palavra.length > tamanho) 
   				{
   					objA.value = palavra.substring(0, tamanho);
					window.event.returnValue = null;
					objP.focus();
					return;
   				}
   			else
   				{ 
	 	 			objA.focus(); 
	  			}
   		}
}
function valida_numero(s){
	if ( s != '' ) {
		var i;
		var dif = 0;
		for (i = 0; i < s.value.length; i++){
			var c = s.value.charAt(i);
			if (!((c >= '0') && (c <= '9'))){
				dif = 1;
			}
		}
		if (dif == 1){
			alert('Este campo deve ser numerico!');
			s.focus();	
			s.select();
			return false;
		}
	}
	return true;
}