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.0
  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 && document.getElementById) x=document.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];}
}

///////////////////////
// Popup-Funktionsaufrufe
///////////////////////

function popupwin(url, xx, yy) {
      window.open(url,'akb','scrollbars=yes,menubar=no,toolbar=no,status=yes,width='+xx+',height='+yy);
}

function oka(newPage) {
  if (newPage == null ) { 
		newPage = 'https://www.akb.ch/akb/tools/quickform/quickform.aspx' 
	} else {
		newPage = 'https://www.akb.ch/akb/tools/quickform/quickform.aspx?page='+newPage;
	}
  kontoWindow = window.open(newPage, 'boerseWindow','width=510,height=580,scrollbars=yes,resizable=yes','');
  kontoWindow.focus();
}

function boerse(newPage) {
  if (newPage == null ) { newPage = 'https://agkb.inet.rolotec.ch/cgi-bin/parse/stock/page.layout?page=agkb.TOP.Uebersicht' };
  boerseWindow = window.open(newPage, 'boerseWindow','width=820,height=540,scrollbars=yes,resizable=yes','');
  boerseWindow.focus();
}


function bermodul(newPage) {
  if (newPage == null ) { newPage = 'http://www.kantonalbank.ch/bin/vskb/m/frame?XDZpJu2clySdZT82IKWZPrxEf7x0a3ChMAIIQF0kTecS1hiME95nKmKswdVb9VAAhmr2sOz9E0M8ueTnkSJ8CNUQ8pYvlzEmvYXP8o1O5kdMXkETYK9X5YvWbKv7IYrJ' };
  bermodulWindow = window.open(newPage, 'bermodulWindow','width=770,height=520,scrollbars=yes,resizable=yes','');
  bermodulWindow.focus();
}


function enews(newPage) {
 if (newPage == null ) { newPage = 'https://www.akb.ch/e-news/anmeldung.asp?d007=1' 
 } else {
   newPage = "https://www.akb.ch/e-news/anmeldung.asp?" + newPage;
 };
 enewsWindow = window.open(newPage, 'enewsWindow','width=760,height=520,scrollbars=yes,resizable=yes,status=yes,locationbar=no,menubar=no','');
 enewsWindow.focus();
}

function immochannel(newPage) {
 if (newPage == null ) { newPage = 'http://www.akb.ch/immo/immolink.html'};
 immoWindow = window.open(newPage,'ImmoChannel','toolbar=no,width=770,height=520,status=yes,scrollbars=false,resize=no,menubar=no,location=no','');
 immoWindow.focus();
}

function ibbs(newPage) {
 if (newPage == null ) { newPage = 'https://www.akb.ch/servlet/eserve/eserve/servlet/eserve4?METHOD=entry&workflow_id=akbEntry&entrypoint=akbEntry&isoLanguageCode=DE' }; 
 ibbsWindow = window.open(newPage,'IBBS','toolbar=no,width=770,height=520,status=yes,scrollbars=false,resize=no,menubar=no,location=no','');
 ibbsWindow.focus();
}

function ticker(newPage) {
 if (newPage == null ) { newPage = 'http://agkb.inet.rolotec.ch/cgi-bin/parse/ticker/ticker-akb.layout?page=ticker' }; 
 tickerWindow = window.open(newPage,'BorsentickerAKB','scrollbars=no,width=300,height=70','');
 tickerWindow.focus();
}

function sic(newPage) {
 if (newPage == null ) { newPage = 'http://www.sic.ch/de/tkicch_index/tkicch_onlineservices/tkicch_onlineservices_inquirybcnumber.htm' }; 
 sicWindow = window.open(newPage, 'Telekurs','width=785,height=560,scrollbars=yes,resizable=yes','');
 sicWindow.focus();
}

function kontakt(kategorie,thema) {
 if (kategorie == null ) {  
	 kontaktWindow = window.open('https://www.akb.ch/akb/formulare/form_kontaktPOPUP.asp', 'Kontakt','width=720,height=520,scrollbars=yes,resizable=yes,status=yes',''); 
	} 
	else { 
	 kontaktWindow = window.open('https://www.akb.ch/akb/formulare/form_kontaktPOPUP.asp?kategorie='+kategorie+'&thema='+thema, 'Kontakt','width=715,height=520,scrollbars=yes,resizable=yes,status=yes','');
	};
 kontaktWindow.focus();
}

function email(kube,thema,domain) {
 if (kube == null ) { newPage = 'https://www.akb.ch/akb/formulare/form_kontakt_weiterPOPUP.asp?sendto=sdev&thema=KeinAdressatimJS';
	

 } else { 
	
	if (domain == null ) {

		newPage = 'https://www.akb.ch/akb/formulare/form_kontakt_weiterPOPUP.asp?sendto='+kube+'&thema='+thema+'&domain=akb.ch';
		
	} else {

		newPage = 'https://www.akb.ch/akb/formulare/form_kontakt_weiterPOPUP.asp?sendto='+kube+'&thema='+thema+'&domain='+domain;
	}
 }


 kontaktWindow = window.open(newPage, 'Kontakt','width=720,height=520,scrollbars=yes,resizable=yes,status=yes',''); 

 kontaktWindow.focus();
}


function bewerbung(kube,stelle) {

	if (stelle == null) { stelle = "";}

	if (kube == null) { 
		newPage = 'https://www.akb.ch/akb/formulare/form_bewerbungsbogenPOPUP.asp?sendto=hrm&stelle='+stelle;
	} else {
		newPage = 'https://www.akb.ch/akb/formulare/form_bewerbungsbogenPOPUP.asp?sendto='+kube+'&stelle='+stelle;
	}
	
	bewerbungWindow = window.open(newPage, 'Bewerbung','width=720,height=520,scrollbars=yes,resizable=yes,status=yes',''); 
	bewerbungWindow.focus();
}

function hyprechner() {
	hyprechnerWindow = window.open('/akb/formulare/hyprechner/form_hyprechnerPOPUP.htm', 'Hypothekarrechner','width=639,height=520,scrollbars=yes,resizable=yes,status=yes',''); 
	hyprechnerWindow.focus();
}

function map(id) {
	filialWindow = window.open('http://filialfinder.akb.axinom.de/FinderPopup.aspx?poiID='+id+'&mid=1', 'Filialfinder','width=580,height=520,scrollbars=yes,resizable=yes,status=yes',''); 
	filialWindow.focus();
}	

function route(id) {
	if (id == 0) {
		newPage = "http://filialfinder.akb.axinom.de/FinderPopup.aspx?strasse="+document.Content.Strasse.value+"&plz="+document.Content.PLZ.value+"&ort="+document.Content.Ort.value+"&mid=1" ;
	} else {
		newPage = "http://filialfinder.akb.axinom.de/FinderPopup.aspx?poiID="+id+"&strasse="+document.Content.Strasse.value+"&plz="+document.Content.PLZ.value+"&ort="+document.Content.Ort.value+"&mid=1" ;
	}
	filialWindow = window.open(newPage, 'Filialfinder','width=580,height=520,scrollbars=yes,resizable=yes,status=yes',''); 
	filialWindow.focus();
}

// Random Picture für die Homepage ///////////////////////////////////////////////////
var i = 1
images = new Array;
links = new Array;
targets = new Array;

//Bilder und Links sind in randomImg.js aufgeführt


function picturerandom(){
var imagenumber = images.length - 1;
var randomnumber = Math.random() ;
var rand1 = Math.round( (imagenumber-1) * randomnumber) + 1;

var randimage = images[rand1];
var rlink = links[rand1];
var rtarget = targets[rand1];

document.randImg.src = randimage;
document.getElementById("randLink").href = rlink;
document.getElementById("randLink").target = rtarget;
i = rand1;
}

