
function centraliza(largura,altura){
	window.moveTo((window.screen.width-largura)/2,(window.screen.height-altura)/2);
}

function abreJanela(arquivo,nome,barra,largura,altura) {
	window.open(arquivo,nome,"resizable=no,toolbar=no,status=no,menubar=no,scrollbars="+barra+",width="+largura+",height="+altura);
}

function redimenciona(){
	var i=0;
	function resize() {
		if (navigator.appName == 'Netscape') i=40;
		if (document.images[0]) window.resizeTo(document.images[0].width +50, document.images[0].height+80-i);
		if (window.moveTo((window.screen.width-document.images[0].width)/2,(window.screen.height-document.images[0].height)/2));
	}
}
var css_browser_selector = function() {
	var 
		ua = navigator.userAgent.toLowerCase(),
		is = function(t){ return ua.indexOf(t) != -1; },
		h = document.getElementsByTagName('html')[0],
		b = (!(/opera|webtv/i.test(ua)) && /msie (\d)/.test(ua)) ? ((is('mac') ? 'ieMac ' : '') + 'ie ie' + RegExp.$1)
			: is('gecko/') ? 'gecko' : is('opera') ? 'opera' : is('konqueror') ? 'konqueror' : is('applewebkit/') ? 'webkit safari' : is('mozilla/') ? 'gecko' : '',
		os = (is('x11') || is('linux')) ? ' linux' : is('mac') ? ' mac' : is('win') ? ' win' : '';
	var c = b+os+' js';
	h.className += h.className?' '+c:c;
}();

function Pontua(i){
	var marc = new Array(".","/","-");
	
	if (i.value.length == 2 || i.value.length == 6) {
            i.value += marc[0];
        }
	if (i.value.length == 10) {
            i.value += marc[1];
        }
	if (i.value.length == 15) {
            i.value += marc[2];
        }
} 

function Print(tr,i,o)
{
	var Borwser = navigator.appName;
	if(Borwser == "Microsoft Internet Explorer")
	{
		cp = '#dddddd';
		cs = '#cccccc';
	}
	else
	{
		cp = 'rgb(221, 221, 221)';
		cs = 'rgb(204, 204, 204)';
	}
				
	switch (i){
		case 1:		
				if(document.getElementById(tr).style.backgroundColor != cp){ 
					document.getElementById(tr).style.backgroundColor = cs;
				}
		break;
		case 2:
				if(document.getElementById(tr).style.backgroundColor != cp)
				{
					document.getElementById(tr).style.backgroundColor = '';
				}
		break;
		case 3:
				if(document.getElementById(tr).style.backgroundColor == cp)
				{ 
					document.getElementById(tr).style.backgroundColor = '';
				}
				else
				{
					document.getElementById(tr).style.backgroundColor = cp;
					if(o)
					{
						document.getElementById("SETING").style.display = '';
						document.forms[0].SET.value = o;
						document.getElementById('idprd').innerHTML = o;
						document.getElementById('prd').style.display = 'none';
						document.getElementById('subm').style.display = 'none';
					}
				}				
		break;
	}
	return  document.getElementById(tr).style.cursor = 'pointer';
}

function SetingC()
{
	
			var frm = document.forms[0];
			var i;
			var continua = false;
			var alerta = "";
			var a = 0;
			var b = 1;
    
			for(i=0; i<frm.elements.length; i++){
				
				if(frm.elements[i].type == "radio"){
					 if(frm.elements[i].name == "BV"){
						 if(frm.elements[i].checked == true)
						 {
							 a = 2;
						 }
					 }
					 if(frm.elements[i].name == "FR"){
						 if(frm.elements[i].checked == true)
						 {
							 b = 2;
						 }
					 }
				}
			}
			
			if(a== 0 || b == 1){
				continua = false;
			}
			else
			{
				continua = true;
			}
			
			if(continua == false)
			{
				var ERR = new Array("¤ Tipo de BLINDAGEM/VEDAÇÃO\n","¤ Tipo de FOLGA RADIAL"," ");
				alert("ERRO\nOs itens abaixo devem ser selecionados\n\n"+ ERR[a] + ERR[b]);
				return false;
				
			}
				
			if(continua == true){
				for(i=0; i<frm.elements.length; i++){
					
					if(frm.elements[i].type == "radio"){
						frm.elements[i].checked = false;
					}
					if(frm.elements[i].type == "checkbox"){
						frm.elements[i].disabled = false;
						
					}
					
				}
				document.getElementById('prd').style.display = '';
				document.getElementById('subm').style.display = '';
				document.getElementById("SETING").style.display = 'none';
				return true;
			}
}

function Setar(C,V)
{
	cm = document.getElementById("SET").value + C;
	document.getElementById(cm).value = V;
}

function ZeroCool(e,i){
	
	switch (e){
	case 1:
		if(i.value <= 0){
			i.value = ''
		}
		break;
		
	case 2: 
		if(i.value <= 0 || i.value == ''){
			i.value = '0'; 
		}
		break;
	}
}

function Atualizar()
{
	document.forms[0].btnAtuali.style.background = "#FFFF00";
}


montaSWF = function (param1){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="149" height="352">');
	document.write('	<param name="movie" value="swf/menu.swf" />');
	document.write('	<param name="quality" value="high" />');
	document.write('	<param name="wmode" value="transparent" />');
	document.write('	<param name="FlashVars" value="action='+param1+'" />');
	document.write('	<embed FlashVars="action='+param1+'" wmode="transparent" src="swf/menu.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="149" height="352"></embed>');
	document.write('</object>');
}
