// JavaScript Document

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

var IE = (document.all);
var NS = (document.getElementById && !document.all);
var FF = navigator.userAgent.match("Firefox");

function GB_Foc(){

document.f1.nome.focus();

}


function warn(){

if(document.layers){

alert('Você está utilizando uma versão antiga do Netscape\ne isto pode comprometer sua navegação neste site.\nBaixe a versão atualizada(7.0) gratuita em: www.netscape.com/downloads')

 }

}

function acha(){

teste = document.f1.login.value.match(/\W/);
if(teste) {
alert('Utilize apenas letras, números e \nsublinhado \"_\", \".\" ou \"-\", sem espaço entre os \ncaracteres.');
document.f1.login.value = "";
document.f1.login.focus();
}
}


function GB_IsValid2(ofor){	
df=ofor;
d1=df.nome.value;
de=df.email.value;
dr=df.tex.value;
t1=df.tel.value;

p1=de.indexOf(".")== -1;
z1=de.indexOf(" ")== -1;

  if(de==""||d1==""||dr=="") {
  alert('Todos os campos são obrigatórios, exceto "Telefone"');
  return false;
  }
  
  if(p1 || !z1) {
  alert('e-mail inválido');
  return false;
  }
  
  if(t1.match(/\D/)) {
  alert('Somente números no campo "Telefone"');
  return false;  
  } 
  
  if(d1.match(/\d/)) {
  alert('Somente letras no campo "Nome"');
  return false;  
  }  
}

function GB_Email(ofore){
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
//var filter2=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var ok = filter.test(ofore);
	if(!ok) {alert("e-mail inválido"); return false;}
	else {return true;}
}


function setiFrame(page,heith){
		theframe = document.getElementById("allsubs");
		theframe.src=page;
		theframe.style.height=heith;
}


function chd_allsubs(page,heith){
page+=".htm";
heith+="px";
// doc ta definido aqui no fim da pag. e o mesmo que theframe na func acima
	with(parent){
	doc.src=page;
	doc.style.height=heith;
	}
}

function call_contato(){
parent.document.location.href="contato.php";
}


function straightToFrame(addr){
location.href="http://www.osmag.com.br/"+addr;
}

function rez_window(doc,wid,hei){
	window.resizeTo(wid,hei);
	location.href=doc;
	}	