
// Check whether string s is empty.
function isEmpty(s) {
   return ((s == null) || (s.length == 0))
}


function isEmail(s)
{   

	//if (isEmpty(s)) 
   //    if (isEmail.arguments.length == 1) return false;
   //    else return (isEmail.arguments[1] == true);
   
    // is s whitespace?
    if (isEmpty(s)) return false;
    
    // there must be >= 1 character before @, so we
    // start looking at character position 1 
    // (i.e. second character)
    var i = 1;
    var sLength = s.length;

    // look for @
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }

    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;

    // look for .
    while ((i < sLength) && (s.charAt(i) != "."))
    { i++
    }

    // there must be at least one character after the .
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
}



// *****************************************************+

function BotaoOver() {
document.DADOS.VALIDAR.style.background = "#666666";
}
function BotaoOut() {
document.DADOS.VALIDAR.style.background = "#CC6600";
}


function loadImage(imgName, imgWidth, imgHeight, imgText)
{
	imgWidth += 12;
	imgHeight += 50;
	var myt = "newWin = window.open(\"\", \"\", \"height="+ imgHeight + ", width=" + imgWidth + ",resizable=yes\")";
	eval(myt);
	newWin.document.write("<html>");
	newWin.document.write("<head>");
	newWin.document.write("<title>Manjar da P&eacute;gola</title>");
	newWin.document.write("</head>");
	newWin.document.write("<body style=\"padding: 0px; margin: 0px;\">");
	newWin.document.write("<table width='100%' height='100%'>");
	newWin.document.write("<tr>");
	newWin.document.write("<td style=\"background-color: #FFFFFF; padding: 5px;\">");
	newWin.document.write("<img src=\"" + imgName + "\" border=\"0\">");
	newWin.document.write("</td>");
	newWin.document.write("</tr>");
	newWin.document.write("<!--<tr>");
	newWin.document.write("<td style=\"background-color: #CCCCCC; padding: 5px; font-family: Verdana, Arial, Helvetica, sans-serif;	font-size: 11px; color: #333333;\">");
	newWin.document.write(imgText);
	newWin.document.write("</td>");
	newWin.document.write("</tr> -->");	
	newWin.document.write("</table>");
	newWin.document.write("</body>");
	newWin.document.write("</html>");
	newWin.document.close();
}
