function printer(div){
 conte=document.getElementById(div).innerHTML;
 
 pop=window.open("","print","width=670,height=500,scrollbars=1");
 pop.document.write('<link href="css.css" rel="stylesheet"/>');
 pop.document.write('<body leftmargin=0 topmargin=0 rightmargin=0 bottommargin=0>');
 pop.document.write('<center><table bgcolor=#ffffff><tr><td><img src=/imagens/estrutura/printTopo.jpg></td></tr><tr><td>');
 pop.document.write('<div style="width:100%">');

 pop.document.write(conte);
 pop.document.write('</div>');
 pop.document.write('</td></tr><tr><td><span style="cursor:pointer" onclick="window.print();"><font size=1 face=verdana>&nbsp;&nbsp;&nbsp;&nbsp;<br><div align="right"><img src="/imagens/estrutura/btImprimir.jpg"></div></font></span><br></td></tr></table></center></body>');
pop.document.close();
}



function f_ajax(p_div_id, p_url, p_params) {
 new Ajax.Updater(p_div_id, p_url, {
				  method: 'post', 
				  parameters:p_params});
} 

// Cadastro de newsletter
function cadNewsAjax(email,nome) {
  // Paremetros
  var params = "user_email="+email
             + "&user_nome="+nome;                   			 
  var url = '/scripts/cadastronews.php?'+params;
  new Ajax.Request(url, {
  method: 'get'
  });
}

function paginacao(url,div,param){
 new Ajax.Updater(div, url, {
				  method: 'post', 
				  parameters:param});
}


/***************************************************************
 LOCALIZAÇÃO													
***************************************************************/
function modalWindow(url,w,h,title){
	
	var link = document.createElement("A");
	link.ClassName = "modal";
	link.href = '/scripts/window.php?url='+url+'&w='+w+'&h='+h+'&title='+title;
	 
  m = new Control.Modal(link,{
   opacity: 0.6,
   width: w, 
   height: h

   });
   m.open();
}





function busca_endereco(endereco){
	modalWindow('/scripts/gmap/gmap.php?endereco='+endereco+'','488','400','Localização');
}


function fecha_modal() {
	m.close();	
}



/***************************************************************
 ABRE CATALOGO EM TELA CHEIA VERIFICANDO O ULTIMO cadastrado													
***************************************************************/

function abreCatalogo() {
	var url = '/flip/getUltimaRevista.php';
	var urlMag = '/flip/Main.php';
	new Ajax.Request(url, {
		method:'get',
		  onSuccess: function(transport) {
			if(transport.responseText != '') {
				//alert(transport.responseText);
				telacheia(urlMag+transport.responseText);
			}
		}
	});

}

/***************************************************************
 SETA GRAFICO DE SOJA													
***************************************************************/
function getGrafico(valor)
{
	f_ajax('cotacaoSoja', 'scripts/bannerSoja.php', 'cboMercadoria='+valor);
}

