root = "/";

//Função Abre Janela
function abreJanela(url, largura, altura, resize, scrollbars) {
	window.open(url, "", "resizable=" + resize + ",scrollbars=" + scrollbars + ",toolbar=0,location=0,directories=0,status=1,left=0,top=0,width=" + largura + ",height=" + altura);
}
//Função Abre Janela

//Função Miha home página inicial
function MinhaHome(homeFASP, path){

	if (readCookie('minha_home') != homeFASP){
		if(confirm('Usando esse recurso, toda vez que você entrar no site da FASP, essa será sua Home FASP.')) {
			setCookie('minha_home', homeFASP, 150, path);
		}
	}
	else{
		if(confirm('Agora, toda vez que você entrar no site da FASP, a sua Home FASP será a original.')) {
			//delCookie('minha_home');
			setCookie('minha_home', '', 150, path);
		}
	}
}

function verificaMinhaHome(){
	var minhaHome = readCookie("minha_home");

	if(minhaHome != null){
		if(minhaHome == "GRADUACAO"){
			parent.location.href = root + 'graduacao/home_graduacao.php';
		}
		else if(minhaHome == "POSGRADUACAO"){
			parent.location.href = root + 'posgraduacao/home_posgraduacao.php';
		}
		else if(minhaHome == "PAP"){
			parent.location.href = root + 'pap/home_pap.php';
		}
		else if(minhaHome == "GTI"){
			parent.location.href = root + 'GTI/index.php';
		}
		else{
			parent.location.href = root + 'home.php';
		}
	}
	else{
		parent.location.href = root + 'home.php';
	}
}

function readCookie(name) {
	var eq = name + "=";
	var ca = document.cookie.split(';');

	if (!ca.length) return null;
	for(var i=0;i<ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(eq) == 0) return unescape(c.substring(eq.length,c.length));
	}
	return null;
}


function setCookie(nome_do_cookie, value, expiredays, path) { 
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
	document.cookie = nome_do_cookie + "=" + escape(value) + 
		((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString()) +
		((path == null) ? "" : "; path=" + path);
}

function delCookie (nome_do_cookie) { 
	if (readCookie(nome_do_cookie)) {
		document.cookie = nome_do_cookie + "=" + "minha_home; expires=Thu, 01-Jan-04 00:00:01 GMT";
	}

}
//Função Miha home página inicial

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

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 showHideLayers() { //v6.0
  var i,p,v,obj,args= showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

//Links Piscantes

var flashlinks=new Array()

function changelinkcolor(){
for (i=0; i< flashlinks.length; i++){
var flashtype=document.getElementById? flashlinks[i].getAttribute("flashtype")*1 : flashlinks[i].flashtype*1
var flashcolor=document.getElementById? flashlinks[i].getAttribute("flashcolor") : flashlinks[i].flashcolor
if (flashtype==0){
if (flashlinks[i].style.color!=flashcolor)
flashlinks[i].style.color=flashcolor
else
flashlinks[i].style.color=''
}
else if (flashtype==1){
if (flashlinks[i].style.backgroundColor!=flashcolor)
flashlinks[i].style.backgroundColor=flashcolor
else
flashlinks[i].style.backgroundColor=''
}
}
}

function init(){
var i=0
if (document.all){
while (eval("document.all.flashlink"+i)!=null){
flashlinks[i]= eval("document.all.flashlink"+i)
i++
} 
}
else if (document.getElementById){
while (document.getElementById("flashlink"+i)!=null){
flashlinks[i]= document.getElementById("flashlink"+i)
i++
}
}
setInterval("changelinkcolor()", 1000)
}

if (window.addEventListener)
window.addEventListener("load", init, false)
else if (window.attachEvent)
window.attachEvent("onload", init)
else if (document.all)
window.onload=init

// ////////FASP Internacional onmouseover imagens /////////

var dynimages=new Array()
dynimages[0]=["img/banners/banner_brasil.jpg", "#"]
dynimages[1]=["img/banners/banner_china.jpg", "#"]
dynimages[2]=["img/banners/banner_espanha.jpg", "#"]
dynimages[3]=["img/banners/banner_inglaterra.jpg", "#"]

//Preload images ("yes" or "no"):
var preloadimg="no"

//Set optional link target to be added to all images with a link:
var optlinktarget=""

//Set image border width
var imgborderwidth=0

//Optionally, change 1.0 and 0.7 below to affect Wipe gradient size and duration in seconds in IE5.5+:
var filterstring="progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=1.0 Duration=0.7)"

///////No need to edit beyond here/////

if (preloadimg=="yes"){
for (x=0; x<dynimages.length; x++){
var myimage=new Image()
myimage.src=dynimages[x][0]
}
}

function returnimgcode(theimg){
var imghtml=""
if (theimg[1]!="")
imghtml='<a href="'+theimg[1]+'" target="'+optlinktarget+'">'
imghtml+='<img src="'+theimg[0]+'" border="'+imgborderwidth+'">'
if (theimg[1]!="")
imghtml+='</a>'
return imghtml
}

function modifyimage(loadarea, imgindex){
if (document.getElementById){
var imgobj=document.getElementById(loadarea)
if (imgobj.filters && window.createPopup){
imgobj.style.filter=filterstring
imgobj.filters[0].Apply()
}
imgobj.innerHTML=returnimgcode(dynimages[imgindex])
if (imgobj.filters && window.createPopup)
imgobj.filters[0].Play()
return false
}
}
// ///////FASP Internacional onmouseover imagens///////