var url=window.location.href;
var	domainName="www.barclays.pt";
if (url.substr(0,4)=="http") {
	domainPath=url.substr(url.indexOf("//")+2,url.length);
	domainName=domainPath.substr(0,domainPath.indexOf("/"));
	if (domainName.indexOf(":")>0)
		domainName=domainName.substr(0,domainName.indexOf(":"));
	if (domainName.substr(0,8)=="barclays")
		domainName="www.barclays.pt";
}
// links para aplicacoes
function barclaysNet() {
	abrirPagina("https://"+domainName+"/barclaysnet/index.html", "Bnet", 1);
}
function barclaysNetEnglish() {
	abrirPagina("https://"+domainName+"/barclaysneting/index.html", "Bnet", 1);
}
function globalTrader() {
	abrirPagina("https://"+domainName+"/barclaysnet/index.html", "Bnet", 1);
//	abrirPagina("https://"+domainName+"/barclaysnet/globalTrader/indexGlobalTrader.jsp", "Bnet", 1);
}
function NetBusiness() {
	abrirPagina("https://"+domainName+"/business/index.html", "NetBusiness", 1);
}
function barclaysNet_adesao() {
	abrirPagina("https://"+domainName+"/barclaysnet/adesao/adesao.html", "Bnet", 1);
}
function descricao() {
	abrirPagina("https://"+domainName+"/barclaysnet/descricaoServico/descricao.htm", "Descricao", 1);
}
function Scoring() {
	abrirPagina("https://"+domainName+"/scoring/index.html", "Scoring", 1);
}
function simulador() {
	abrirPagina("https://"+domainName+"/creditohabitacao/index.html", "Simulador", 1);
}
function SimuladorE() {
	abrirPagina("https://"+domainName+"/creditohabitacaoexpatriados/index.html", "SimuladorE", 1);
}
function simuladorL() {
	abrirPagina("https://"+domainName+"/leasing/index.html", "SimuladorL", 1);
}
function simuladorCP() {
	abrirPagina("https://"+domainName+"/creditopessoal/index.html", "SimuladorCP", 1);
}
function promotores() {
	URL="https://"+domainName+"/promotores/index.html";
	document.location.href=URL;
}
function protocolos() {
	URL="https://"+domainName+"/protocolos/index.html";
	document.location.href=URL;
}
// iframes
function Indices(){
	document.write("<iframe width='175' height='100%' frameborder=0 marginheight=0 marginwidth=0 src='https://"+domainName+"/barclaysnet/publico/indices/main.jsp' scrolling='no'></iframe>");
}
function Noticias(){
	document.write("<iframe width='386' height='190' frameborder=0 marginheight=0 marginwidth=0 src='https://"+domainName+"/barclaysnet/publico/noticias/main.jsp' scrolling='no'></iframe>");
}
function carreiras() {
	document.write("<iframe width='100%' height='100%' frameborder=0 marginheight=0 marginwidth=0 src='https://"+domainName+"/carreiras/oportunidades/ListOportunidade.jsp'></iframe>");
}
function recrutamento() {
	abrirpag("https://"+domainName+"/erecruit/index.html", "recrutamento");
}

function provedoria() {
	document.write("<iframe width='100%' height='600' frameborder=0 marginheight=0 marginwidth=0 src='https://"+domainName+"/barclaysnet/publico/provedoria/main.jsp'></iframe>");
}
function provedoriaEn() {
	document.write("<iframe width='100%' height='600' frameborder=0 marginheight=0 marginwidth=0 src='https://"+domainName+"/barclaysnet/publico/provedoria/mainIng.jsp'></iframe>");
}
function callme_habitacao() {
	document.write("<iframe width='380' height='220' frameborder=0 marginheight=0 marginwidth=0 src='https://"+domainName+"/barclaysnet/publico/callme/callme_habitacao.htm'></iframe>");
}
function callme_leasing() {
	document.write("<iframe width='400' height='220' frameborder=0 marginheight=0 marginwidth=0 src='https://"+domainName+"/barclaysnet/publico/callme/callme_leasing_auto.htm'></iframe>");
}
function callme_business() {
	document.write("<iframe width='100%' height='220' frameborder=0 marginheight=0 marginwidth=0 src='https://"+domainName+"/barclaysnet/publico/callme/callme_classe_business.htm'></iframe>");
}
function callme_generico(assunto,empresas) {
	if (empresas==-1)
		document.write("<iframe width='100%' height='220' frameborder=0 marginheight=0 marginwidth=0 src='https://"+domainName+"/barclaysnet/publico/callme/call_me_generico.htm?assunto="+assunto+"'></iframe>");
	else
		document.write("<iframe width='100%' height='220' frameborder=0 marginheight=0 marginwidth=0 src='https://"+domainName+"/barclaysnet/publico/callme/call_me_generico.htm?assunto="+assunto+"&empresas="+empresas+"'></iframe>");
}
function callme_premier_prov (assunto,empresas) {
	if (empresas==-1)
		document.write("<iframe width='100%' height='220' frameborder=0 marginheight=0 marginwidth=0 src='https://"+domainName+"/barclaysnet/publico/callme/call_me_premier.htm?assunto="+assunto+"'></iframe>");
	else
		document.write("<iframe width='100%' height='220' frameborder=0 marginheight=0 marginwidth=0 src='https://"+domainName+"/barclaysnet/publico/callme/call_me_premier.htm?assunto="+assunto+"&empresas="+empresas+"'></iframe>");
}
function callme_premier (assunto,empresas) {
	document.write("<iframe width='100%' height='220' frameborder=0 marginheight=0 marginwidth=0 src='https://"+domainName+"/barclaysnet/publico/callme/call_me_premier.htm?assunto=Premier&empresas='></iframe>");
}

function superdep() {
	document.write("<iframe width='380' height='600' frameborder=0 marginheight=0 marginwidth=0 src='https://"+domainName+"/barclaysnet/publico/superDeposito/main.jsp'></iframe>");
}
// funcoes comuns
function Loadwindow(url,windowname) {
	var sWidth = (window.screen) ? screen.availWidth : 800;
	var sHeight = (window.screen) ? screen.availHeight-45 : 600;
	window.open(url, windowname, "height=" + sHeight +",width=" + sWidth + ",top=0,left=0,status=yes,toolbar=no,menubar=no,location=no,resizable=yes");
}
function abrirpag(ficheiro, nomepag) {
	var LeftPosition = (screen.width) ? (screen.width-800)/2 : 0;
	var TopPosition = (screen.height) ? (screen.height-600)/2 : 0;
	window.open(ficheiro, nomepag, "height=545,width=790,top=" + TopPosition + ",left=" + LeftPosition + ",status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes");
}
function abrirPagina(ficheiro, nomepag, scr) {
	var aWidth = (window.screen) ? screen.availWidth : 800;
	var aHeight = (window.screen) ? screen.availHeight : 600;
	var tWidth = (screen.width) ? (screen.width-screen.availWidth) : 0;
	var tHeight = (screen.height) ? (screen.height-screen.availHeight) : 0;
	var LeftPosition = tWidth;
	var TopPosition = tHeight;
	var wWidth = aWidth - tWidth - 12;
	var wHeight = aHeight - tHeight - 50;
	var swScroll = (scr==1) ? "yes" : "no";
	window.open(ficheiro, nomepag, "height=" + wHeight +",width=" + wWidth + ",top=" + TopPosition + ",left=" + LeftPosition + ",status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars="+swScroll);
}
