// +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +
// AUTOR : JOAO FIGUEIRA
// DESCRICAO : ABRE JANELA DOS PORTFOLIO
// ENTRADA : TIPO DE PORTFOLIO, ENDERECO FICHEIRO ASP, TAMANHO WIDTH , TAMANHO HEIGHT
// SAIDA : NOVA JANELA
// +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +

function JanelaPortfolio(tipo,endereco,w,h) {

  var tamanho_horizontal = w;
  var tamanho_vertical = h;
  var directorio;  
  var fazresize;
  
  if (tipo==1) {
  	directorio = "./portfolio_banners/";
	fazscroll = "no";
	fazresize = "no";
  }
  if (tipo==2) {
  	directorio = "./portfolio_nosmedia/";
	fazscroll = "yes";
	fazresize = "yes";
  }
  if (tipo==3) {
  	directorio = "./";
	fazscroll = "no";
	fazresize = "no";
  }

  //var url = directorio + endereco;
  var url = endereco;

  var ah = screen.availHeight;
  var aw = screen.availWidth;

  var local_esquerdo = parseInt((aw-tamanho_horizontal)/2);
  var local_topo = parseInt((ah-tamanho_vertical)/2);

  browserName = navigator.appName;
  if (browserName=="Netscape") {
	  var str_top = "screenX=";
	  var str_left = "screenY=";
  } else {
	  var str_top = "top=";
	  var str_left = "left=";  
  }	  	

  var features = "menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=" + fazscroll +",resizable=" + fazresize + ",dependent,titlebar=no,width=" + tamanho_horizontal + ",height=" + tamanho_vertical + "," + str_top + local_topo + "," + str_left + local_esquerdo;

  window.open(url, target="_blank", features);

}

// *****************************************************+

function BotaoOver() {
document.DADOS.VALIDAR.style.background = "#849CA2";
}
function BotaoOut() {
document.DADOS.VALIDAR.style.background = "#E6E5D7";
}

// *****************************************************+


// 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;
}


<!-- John Munn  (jrmunn@home.com) -->
<!-- Begin
 function PutFocus(formInst, elementInst) {
  if (document.forms.length > 0) {
   document.forms[formInst].elements[elementInst].focus();
  }
 }
//  End -->


function show(id){
	var ns4 = (document.layers);
	var ie4 = (document.all && !document.getElementById);
	var ie5 = (document.all && document.getElementById);
	var ns6 = (!document.all && document.getElementById);

	// Netscape 4
	if(ns4){
		document.layers[id].visibility = "show";
	}
	// Explorer 4
	else if(ie4){
		document.all[id].style.visibility = "visible";
		document.all[id].style.display = "block";
	}
	// W3C - Explorer 5+ and Netscape 6+
	else if(ie5 || ns6){
		document.getElementById(id).style.visibility = "visible";
		document.getElementById(id).style.display = "block";
	}
}

function hide(id){
	var ns4 = (document.layers);
	var ie4 = (document.all && !document.getElementById);
	var ie5 = (document.all && document.getElementById);
	var ns6 = (!document.all && document.getElementById);
	
	// Netscape 4
	if(ns4){
		document.layers[id].visibility = "hide";
	}
	// Explorer 4
	else if(ie4){
		document.all[id].style.visibility = "hidden";
		document.all[id].style.display = "none";
	}
	// W3C - Explorer 5+ and Netscape 6+
	else if(ie5 || ns6){
		document.getElementById(id).style.visibility = "hidden";
		document.getElementById(id).style.display = "none";
	}
}
