function MM_reloadPage(init) {
	if (init==true)
	with (navigator){
		if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
   			document.MM_pgW=innerWidth;
			document.MM_pgH=innerHeight;
			onresize=MM_reloadPage;
		}
	}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
		location.reload();
}
MM_reloadPage(true);

function MM_openBrWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}

function validaSelecaoProduto(){
	if(validaSelecaoProdutoForm.idProduto.value == 0){
		alert("Antes de comprar selecione o modelo do produto que deseja");
		validaSelecaoProdutoForm.idProduto.focus();
		return false;
	}
	if(validaSelecaoProdutoForm.defeitoProduto.value != ""){
		alert("Você esta ciente que esta comprando um produto de Saldão? \n Confirme se visualizou essas infomações: \n " + validaSelecaoProdutoForm.defeitoProduto.value + "");
		validaSelecaoProdutoForm.idProduto.focus();
	}
}

function amf2005_BecameCurrency(cur,len){
	n = '__0123456789';
	d = cur.value;
   	l = d.length;
   	r = '';
   	if (l > 0){
		z = d.substr(0,l-1);
		s = '';
		a = 2;
		for (i=0; i < l; i++){
			c = d.charAt(i);
			if (n.indexOf(c) > a){
				a = 1;
				s+=c;
			};
		};
		l = s.length;
		t = len-1;
		if (l > t){
			l = t;
			s = s.substr(0,t);
		};
		if (l > 2){
			r = s.substr(0,l-2)+','+s.substr(l-2,2);
		}
		else{
			if (l == 2){
				r = '0,'+s;
			}
			else{
				if (l == 1){
					r = '0,0'+s;
				};
			};
		};
		if (r == ''){
			r = '0,00';
		}
		else{
			l = r.length;
			if (l > 6){
				j = l%3;
				w = r.substr(0,j);
				wa = r.substr(j,l-j-6);
				wb = r.substr(l-6,6);
				if (j > 0){
					w+='.';
				};
				k=(l-j)/3-2;
				for (i=0; i < k; i++){
					w+=wa.substr(i*3,3)+'.';
				};
				r = w+wb;
			};
		};
	};
   	if (r.length <= len){
		cur.value = r;
   	}
   	else{
		cur.value = z;
   	};
   	return 'ok';
};
