function stopError() {
return true;
}

window.onerror = stopError;
function clear_field(field){
if (field.value==field.defaultValue)    {    

field.value=''    }
}

function check_field(field){
   if (field.value=='' ||
   field.value==' ')    {
   field.value=field.defaultValue }
}

//FUNCAO BANNER FLASH
function objectSwf(swf,width,height) {
	document.write('<object type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" data="' + swf + '">');
	document.write('<param name="movie" value="' + swf + '" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="menu" value="false" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<embed src="' + swf + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" wmode="transparent"></embed>');
	document.write('</object>');
}

function objectYoutube(swf,width,height) {
	document.write('<object type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" data="' + swf + '">');
	document.write('<param name="movie" value="' + swf + '" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="menu" value="false" />');
	document.write('<param name="wmode" value="transparent" />');	
	document.write('<embed src="' + swf + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" wmode="transparent"></embed>');
	document.write('</object>');
}

function validaForm(formulario){

for(i=0;i<=formulario.length-1;i++){
	if ((formulario[i].type=="textarea")||(formulario[i].type=="file")||(formulario[i].type=="hidden")||(formulario[i].type=="text")||(formulario[i].type=="password")){
		if ((formulario[i].wmsg!="")&&(formulario[i].wmsg!=undefined)){
			if (formulario[i].email=="sim"){
				if((formulario[i].value=="")||(formulario[i].value.indexOf('@')==-1)||(formulario[i].value.indexOf('.')==-1)){
					alert(formulario[i].wmsg);
					try{
						formulario[i].focus();
					}
					catch(e){
						}				
				    return false
				}	
			}else{
				if(formulario[i].value==""){
					alert(formulario[i].wmsg);
					try{
						formulario[i].focus();
					}
					catch(e){

						}
				
					return false
				}
			}
		}
	}	
}
//Olá bem vindo ao meu artigo nele vou explicar como fazer uma validação inteligente de formulário, 
}

function abrir(foto,largura,altura) {

  var esquerda = ((screen.width - largura) / 2);
  var topo = ((screen.height - altura) / 2);

Popup = window.open('', 'Janela', 'width = ' + largura + ', height = ' + altura + ', top = ' + topo + ', left = ' + esquerda + ', scrollbars = yes, status = no, toolbar = no, location = no, directories = no, menubar = no, resizable = no, fullscreen = no');
Popup.document.open();
Popup.document.write("<html><head><title>");
Popup.document.write("Gal Ferreira");
Popup.document.write("</title>");
Popup.document.write('</scr' + 'ipt>');
Popup.document.write("</head><body leftmargin=0 topmargin=0>");
Popup.document.write('<center>');
Popup.document.write('<img src=\"' + foto + '\">');
Popup.document.write("</center>");
Popup.document.write("</body></html>");
Popup.document.close();
}