﻿// JScript File
function Inv(Lar, Alt)
{
    document.write('<img src="Imagens/Site/Inv.gif" width="'+ Lar +'" height="'+ Alt +'" border="0">');
}
function MascaraTel(obj){
	if (obj.value.length == 4)
	{
	    obj.value = obj.value + '-';
	}
}
function MascaraCEP(obj){
	if (obj.value.length == 5)
	{
	    obj.value = obj.value + '-';
	}
}
/*Só aceita numeros*/
function SoNumeros(objeto){
  campo = eval(objeto);
  caracteres = '0123456789';

	if(caracteres.search(String.fromCharCode(window.event.keyCode))!=-1){
		campo.value = campo.value
	}else{ 
		event.returnValue = false;
	}
}

function RedimWin(Objeto){
    window.resizeTo(document.getElementById(Objeto).clientWidth, document.getElementById(Objeto).clientHeight);
    window.focus();
}

function PopImagem(IMG)
{
    window.open('PopImagem.aspx?ImagemGrande='+ IMG,'POP','width=400, height=400, top=0, left=0')
}

function OpenBoxGray(Titulo,width,height){
    document.write('<table cellpadding="5" cellspacing="0" border=0 style="border: 1px solid #E5E5E5;" width="'+ width +'" height="'+ height +'">');
    document.write('    <tr>');
    document.write('        <td height=21 background="Imagens/Site/TopBoxBGray.gif" class="TituloBox"><IMG SRC="Imagens/Site/icones/icoProdutos.gif" border=0 style="margin-right:5px" align="top">'+ Titulo +'</td>');
    document.write('    </tr>');
    document.write('    <tr valign=top>');
    document.write('        <td bgcolor="#FFFFFF">');
}

function CloseBoxGray(){
    document.write('        </td>');
    document.write('    </tr>');
    document.write('</table>');
}

function OpenBoxRed(Titulo,width,height)
{
    document.write('<table cellpadding="0" cellspacing="0" style="border: 1px solid #E5E5E5;" border=0 width="'+ width +'" height="'+ height +'">');
    document.write('    <tr>');
	document.write('        <td height=21 background="Imagens/Site/TopBoxBGray.gif" class="TituloBox">'+ Titulo +'</td>');
    document.write('    </tr>');
    document.write('    <tr valign=top>');
    document.write('        <td bgcolor="#FFFFFF">');
}
function CloseBoxRed()
{
    document.write('        </td>');
    document.write('    </tr>');
    document.write('</table>');
}
function OpenBoxGrayV2(width, height)
{
    document.write('<table cellpadding="0" cellspacing="0" border=0 align="center" width="'+ width +'" height="' + height +'" bgcolor="#E2E2E2">');
    document.write('    <tr valign=top>');
    document.write('        <td bgcolor="#FFFFFF" height="100%" style="border:solid 1px #E5E5E5;">');
}
function CloseBoxGrayV2()
{
    document.write('    </td>');
    document.write('</table>');
}


function BoxProduct(Titulo, CodProduto, NuCategoria, ImgP, ImgG, Width, Height)
{
    document.write('<table cellpadding="0" cellspacing="0" border=0 align="center" width="'+ Width +'" height="' + Height +'" style="border: 2px solid #E3E3E3;" bgcolor="#E2E2E2">');
	document.write('    <tr valign=top>');
	document.write('        <td align="left" bgcolor="#FFFFFF">');
    document.write('            <table width="50" cellpadding=0 cellspacing=0>');
    document.write('                <tr>');
    document.write('                    <td width="50" height="20" style="border-botton: solid 1px #E3E3E3; border-right: solid 1px #E3E3E3;" bgcolor="#E3E3E3" align="center"><b style="font-size:10px;">'+ CodProduto +'<b></td>');
    document.write('                </tr>');
    document.write('            </table>');
    document.write('		</td>');
    document.write('    </tr>');

    document.write('    <tr valign=top>');
    document.write('        <td bgcolor="#FFFFFF" height="90" align="center" valign="middle">');
    document.write('            <img src="Imagens/FotoPequena/'+ ImgP +'" alt="Cód. '+ CodProduto +' - '+ Titulo +'" title="Cód. '+ CodProduto +' - '+ Titulo +'" width="80" height="80" onclick="javascript:PopImagem(\''+ ImgG +'\');"  style="cursor:pointer;">');
	document.write('		</td>');
	document.write('    </tr>');
	document.write('    <tr valign=top>');
	document.write('        <td align="center" bgcolor="#FFFFFF">');
    document.write('            <table width="100" cellpadding=0 cellspacing=0 align="center">');
    document.write('                <tr>');
    document.write('                    <td colspan=2 style="border-top:solid 1px #96000B;" height=1><script>Inv(1,1);</script></td>');
    document.write('                </tr>');
    document.write('                <tr>');
    document.write('                    <td style="padding-left:5px; padding-top:5px;border-top:solid 1px #FFA0A0;"><img src="imagens/Site/Icones/icoLupa.gif" align=absmiddle onclick="javascript:PopImagem(\''+ ImgG +'\');"  style="cursor:pointer;"></td>');
    document.write('                    <td style="padding-right:5px; padding-top:5px;border-top:solid 1px #FFA0A0;" align="right"><a href="DetalheProduto.aspx?NuCategoria='+ NuCategoria +'&CodProduto='+ CodProduto +'" class="Cotar">ORÇAR</a></td>');
    document.write('                </tr>');
    document.write('            </table>');
    document.write('		</td>');
    document.write('    </tr>');
    document.write('</table>');
}
function Menu(obj, status, home)
{
    if(home == false)
    {
        if(status == '1')
            document.getElementById(obj).className = 'MenuTopoOff';
    
        if(status == '2')
            document.getElementById(obj).className = 'MenuTopoOn';
    }
    else
    {
        if(status == '1')
            document.getElementById(obj).className = 'MenuTopoHOff';
    
        if(status == '2')
            document.getElementById(obj).className = 'MenuTopoHOn';
    }
    
}