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));
	}
}

function montaSWF(arquivo,largura,altura){
	var now = new Date();	
	var dia = now.getDay();
	var mes = now.getMonth();
	var ano = now.getFullYear();
	var hora = now.getHours();
	var mintuto = now.getMinutes();
	var segundo = now.getSeconds();
	var data = ano+""+mes+""+dia+""+hora;

	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="100%" height="225px">');
	document.write('<param name="movie" value="swf/'+ arquivo +'.swf?ieSux='+ data +'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="menu" value="false" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<embed wmode="transparent" menu="false" src="swf/'+ arquivo +'.swf?ieSux='+ data +'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="225px"></embed>');
	document.write('</object>');
}

function montaSWFBannerDHTML(arquivo,largura,altura){
	var now = new Date();	
	var dia = now.getDay();
	var mes = now.getMonth();
	var ano = now.getFullYear();
	var hora = now.getHours();
	var mintuto = now.getMinutes();
	var segundo = now.getSeconds();
	var data = ano+""+mes+""+dia+""+hora;

	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="'+largura+'" height="'+altura+'">');
	document.write('<param name="movie" value="swf/bannerdhtml/'+ arquivo +'.swf?ieSux='+ data +'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="menu" value="false" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<embed wmode="transparent" menu="false" src="swf/bannerdhtml/'+ arquivo +'.swf?ieSux='+ data +'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+largura+'" height="'+altura+'"></embed>');
	document.write('</object>');
}

function montaSWF1(arquivo, largura, altura) {
    var now = new Date();
    var dia = now.getDay();
    var mes = now.getMonth();
    var ano = now.getFullYear();
    var hora = now.getHours();
    var mintuto = now.getMinutes();
    var segundo = now.getSeconds();
    var data = ano + "" + mes + "" + dia + "" + hora;

    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="' + largura + '" height="' + altura + '">');
    document.write('<param name="movie" value="swf/' + arquivo + '.swf?ieSux=' + data + '" />');
    document.write('<param name="quality" value="high" />');
    document.write('<param name="menu" value="false" />');
    document.write('<param name="wmode" value="transparent" />');
    document.write('<embed wmode="transparent" menu="false" src="swf/' + arquivo + '.swf?ieSux=' + data + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + largura + '" height="' + altura + '"></embed>');
    document.write('</object>');
}

function fechaBannerDHTML(){
	document.getElementById('bannerDHTML').style.visibility="hidden";
}

Resize = function(n,w,h) {
    var img = n;
	var	iw = img.width;
	var	ih = img.height;
	
	if(iw > w || ih > h) {
		var nim = iw/w;
		
		if(ih / nim > h) {
			nim = ih/h;
		}
		
		w = Math.round(iw / nim);
		h = Math.round(ih / nim);
		
		img.setAttribute('width', w);
		img.setAttribute('height', h);
	}
	else {
		img.setAttribute('width', iw);
		img.setAttribute('height', ih);
	}
}

function acessaChat(f) {
	window.open('chat/chat0.asp?oname='+ f.txtNome.value +'','Chat','width=493,height=488');
	return false;
}

function pedido(n,i,p) {
    doRequest('server.aspx?Query=Carrinho&Codigo=' + n + '&Desconto=' + i + '&IDPedido=' + p,respostapedido);
}

function respostapedido(f) {
    window.location.href = "carrinho.aspx";
}

function boleto(idx,datad,datav,valor,nome) {
    window.open('boleto/bradesco.php?idx=' + idx + '&datad=' + datad + '&datav=' + datav + '&valor=' + valor + '&nome=' + unescape(nome),'boleto','width=800,height=600,scrollbars=yes,resizable=yes');
}