function abrirJanela(arquivo, nome_janela, h, w) {
 window.open(arquivo,nome_janela,"height="+h+",width="+w+",scrollbars=no,status=yes,left=50,top=50");
}

function abrirProduto(h, w, imagem, nome, codigo, rs) {

  var altura_img = h - 29;

  Win = window.open("","","height="+h+",width="+w+",scrollbars=no,status=0,top=50px,left=50px,screenY=50px,screenX=50px");
  Win.document.write("<html>\n<head>\n");
  Win.document.write("<title>:: Klacya Biscuit - "+nome+" ::</title>\n");
  Win.document.write("<style type=\"text/css\">@import url(\"css/estilos.css\");</style>\n");
  Win.document.write("</head>\n<body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\n");
  Win.document.write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");
  Win.document.write("<tr>\n<td>\n<img src=\""+imagem+"\" width=\""+w+"\" height=\""+altura_img+"\"></td>\n</tr>\n");
  Win.document.write("<tr>\n<td height=\"29\" align=\"center\" valign=\"middle\" bgcolor=\"#000000\" class=\"pop\">\n");
  Win.document.write("<b>Nome: </b>"+nome);
  Win.document.write("<b> C&oacute;digo: </b>"+codigo);
  Win.document.write("<b> R$: </b>"+rs+"</td>\n");
  Win.document.write("</tr>\n</table>\n</body>\n</html>")
  Win.document.close();
}

function validarContato() {
var ValEsp = /^\s*$/
var ValMail = /^[\w-]+(\.[\w-]+)*@(([\w-]{2,63}\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/
var ValDDD = /^[0-9]{2}$/
var ValTel = /^[0-9]{3,4}\.?\-?[0-9]{4}$/

if (ValEsp.test(document.form1.nome.value)) {
document.form1.nome.style.borderColor = 'red';
return false;
}
if (!ValDDD.test(document.form1.ddd.value)) {
document.form1.ddd.style.borderColor = 'red';
return false;
}
if (!ValTel.test(document.form1.fone.value)) {
document.form1.fone.style.borderColor = 'red';
return false;
}
if (!ValMail.test(document.form1.email.value)) {
document.form1.email.style.borderColor = 'red';
return false;
}
if (document.form1.assunto.value == 1) {
document.form1.assunto.style.color = 'red';
return false;
}
if (ValEsp.test(document.form1.mensagem.value)) {
document.form1.mensagem.style.borderColor = 'red';
return false;
}
}

function mudarCor(elemento, tipo) {
    if (tipo == 'entrada') {
        elemento.style.borderColor = "#999999";
    }
    else if (tipo == 'saida') {
        elemento.style.borderColor = "#000000";
    }
}

