document.writeln('<script language="javascript" type="text/javascript" src="lista.js"></script>');

function writeFooter(){
	data = new Date(); 
	document.write('&copy;2005-'+data.getFullYear()+' <b>Tumelero Com&eacute;rcio de Bebidas</b>&nbsp;&nbsp;&nbsp;&nbsp;Fone (54)3228-2288&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.planetpropaganda.com.br" target="_blank" class="link_00">Planet House</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.invexis.com.br" target="_blank" class="link_00">Invéxis</a>&nbsp;&nbsp;&nbsp;&nbsp;');
}

function listaVinicolas(p_regiaoID, p_tipo) {
    var myObject = new Object();
	vArray = new Array();
	colCounter = 0;
	
	while (myObject = lista.shift()) {
		if (myObject.regiaoID != null) { 
			if (myObject.regiaoID == p_regiaoID && myObject.tipo == p_tipo)  {
				vArray[myObject.vinicolaID] = myObject.nomeVinicola;
			}
		}
	}
	
	document.writeln('<table width="299"  border="0" cellpadding="0" cellspacing="0">');
	
	for (var ref in vArray) {
		if (colCounter == 0) document.writeln('<tr>');
		
		document.writeln('<td width="30"><a href="lista.htm?vinicola=' + ref + '&tipo=' + p_tipo + '"><img src="media/ic_00.gif" width="27" height="97" border="0"></a></td>');
		document.writeln('<td width="69" style="padding-right: 5px;"><a href="lista.htm?vinicola=' + ref + '&tipo=' + p_tipo + '" class="link_01">' + vArray[ref] + '</a></td>');
		
		if (colCounter == 2) {
			document.writeln('</tr>');
			document.writeln('<tr><td colspan="6">&nbsp;</td></tr>');
		}
		
		colCounter++;
		if (colCounter == 3) colCounter = 0;
	}
	
	if (colCounter == 1) document.writeln('<td width="30" align="center"></td><td width="69" align="center"></td><td width="30" align="center"></td><td width="69" align="center"></td></tr>');
	else if (colCounter == 2) document.writeln('<td width="30" align="center"></td><td width="69" align="center"></td></tr>');
	else document.write("</tr>");
	
	document.writeln('</table>');
}




function listaProdutos(p_tipo, p_filtro) {

    var myObject = new Object();
	colCounter = 0;

	document.writeln('<table width="294" border="0" cellpadding="0" cellspacing="0">');
	
    while (myObject = lista.shift()) {
        if (myObject.tipo == p_tipo) {
            if ((myObject.vinicolaID == p_filtro)||(myObject.tipoEspumanteId == p_filtro)||(p_tipo == 'sucos')||(p_tipo == 'presentes')){
                if (colCounter == 0) document.writeln('<tr>');
                document.writeln('<td width="50%" valign="top" align="center" style="padding-top:10px">');
                document.writeln('<table border="0" cellspacing="0" cellpadding="0">');
                document.writeln('<tr><td align="center" valign="bottom"><a href="produto.htm?id=' + myObject.id + '"><img src="media/produtos/' + myObject.id + '.gif" alt="' + myObject.nome + '" border="0"></a></td></tr>');
                document.writeln('<tr><td align="center" valign="bottom" style="padding: 5px 15px 20px 15px"><b><a href="produto.htm?id=' + myObject.id + '" class="link_01">' + myObject.nome + '</a></b></td></tr>');
                document.writeln('</table></td>');
                if (colCounter == 1) document.writeln('</tr>');
                colCounter++;
                if (colCounter == 2) colCounter = 0;
            }
        }
    }
    if (colCounter == 1) document.writeln('<td width="50%"></td></tr>');
    document.writeln('</table>');
}




function traduzURL() {
	aux = window.location.toString();
	aux = aux.split("?");
	
	if (aux.length > 1) {
		vars = aux[1].split("&");
		
		if (vars.length != null) {	
			parts = null;
			
			for (x=0; x < vars.length; x+=1) {
				parts = vars[x].split("=");
				eval(parts[0] + '="' + parts[1] + '"');
			}
		}
	}
}
