/* dropdown stuff for ie */

startList = function() {
	if (document.all && document.getElementById) {
		navRoot = document.getElementById("dropdown");
		for (i = 0; i < navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName == "LI") {
				node.onmouseover = function() {
					this.className += " over";
				}
				node.onmouseout = function() {
					this.className = this.className.replace(" over", "");
				}
			}
		}
	}
	verysign();
}

/* iframe for login */

function verysign() {
    var frm = '<' + 'iframe' + 
    ' src="https://www.portfolionet.ch/secured/logins.asp?Institution=KEND"' + 
    ' marginheight="0" marginwidth="0" frameborder="0"' + 
    ' scrolling="no" height="105" width="460" name="portfolio"' + 
    ' style="overflow: hidden;">' + '<' + '/iframe>';	
    
    $('verisign').update(frm);
}



window.onload = startList;

/* resizer class */
var contentResizer = Class.create();
contentResizer.prototype = {

  	initialize: function(element, type, params) {
 
        var opts = Object.extend({
            slave: false,
            correction: 0
        }, arguments[2] || {});    
    
		this.element = element;
		this.oldwinWidth = 0;
        this.oldwinHeight = 0;
		this.type = type;
		this.correction = opts.correction;
        this.slave = opts.slave;
        
		Event.observe(window, "resize", this.resize.bind(this) );
		this.resize();
  	},

  	getPosition: function(element) {
  		var el = $(element);
  		l = el.offsetLeft;
		t = el.offsetTop;
  		if(el.style.top){
  			t = parseInt(el.style.top);
  		}
  		if(el.style.left){
  			l = parseInt(el.style.left);
  		}
  		return {top:t,left:l};
  	},

  	getWindowSize: function(){
		if(Prototype.Browser.IE){
	    	var h = ( document.compatMode == "CSS1Compat" ) ? document.documentElement.clientHeight  : document.body.clientHeight ;
	    	var w = ( document.compatMode == "CSS1Compat" ) ? document.documentElement.clientWidth  : document.body.clientWidth ;
		}
		else{
			var h = window.innerHeight;
			var w = window.innerWidth;
		}
		return {w:w,h:h};
  	},

  	getCorrectionHeight: function(element){
		el = $(element);
  		var a = parseInt( el.getStyle('padding-top') );
  		var b = parseInt( el.getStyle('padding-bottom') );
        //box modell failure
        if(Prototype.Browser.IE){
            total = a + b;
            return total;
        }
  		var c = parseInt( el.getStyle('border-top-width') );
  		var d = parseInt( el.getStyle('border-bottom-width') );
  		total = a + b + c + d;
  		return total;
  	},

    getCorrectionWidth: function(element){
        el = $(element);
        var a = parseInt( el.getStyle('padding-left') );
        var b = parseInt( el.getStyle('padding-right') );
        //box modell failure
        if(Prototype.Browser.IE){
            total = a + b;
            return total;
        }
        var c = parseInt( el.getStyle('border-left-width') );
        var d = parseInt( el.getStyle('border-right-width') );
        total = a + b + c + d;
        return total;
    },
    
  	resize: function(){
  		var win = this.getWindowSize();

  		if(this.type == 'toBottom'){
	  		if(win.h == this.oldwinHeight){
			 	return;
			}
			var padding = this.getCorrectionHeight(this.element);
			var pos = this.getPosition(this.element);
			var h = (win.h - padding - pos.top) + parseInt(this.correction);

            
            
			$(this.element).setStyle({
				height: h + 'px'
			});
            
            if(this.slave && $(this.slave)) {
                $(this.slave).setStyle({
                    height: h + 'px'
                });           
            }
            
		}
        if(this.type == 'toRight'){
            if(win.w == this.oldwinWidth){
                return;
            }
            var padding = this.getCorrectionWidth(this.element);            
            var pos = this.getPosition(this.element);
            var w = (win.w - padding - pos.left) + parseInt(this.correction);


            $(this.element).setStyle({
                width: w + 'px'
            });
            
            if(this.slave && $(this.slave)) {
                $(this.slave).setStyle({
                    width: w + 'px'
                });           
            }
        }
  	}
}


var Bild2;
Bild2=new Image;
Bild2.src="/themes/kendris/images/button-private-on.gif";
var Bild3;
Bild3=new Image;
Bild3.src="/themes/kendris/images/button-corporate-on.gif";
var Bild4;
Bild4=new Image;
Bild4.src="/themes/kendris/images/button-login-on.gif";

function neuesButtonPrivate(){
window.document.private.src="/themes/kendris/images/button-private-on.gif";
};
function altesButtonPrivate(){
window.document.private.src="/themes/kendris/images/button-private-off.gif";
};


function neuesButtonCorporate(){
window.document.corporate.src="/themes/kendris/images/button-corporate-on.gif";
};
function altesButtonCorporate(){
window.document.corporate.src="/themes/kendris/images/button-corporate-off.gif";
};


function neuesButtonLogin(){
window.document.login.src="/themes/kendris/images/button-login-on.gif";
};
function altesButtonLogin(){
window.document.login.src="/themes/kendris/images/button-login-off.gif";
};




var Bild2;
Bild2=new Image;
Bild2.src="/files/elemente/button-private-on.gif";
var Bild3;
Bild3=new Image;
Bild3.src="/files/elemente/button-corporate-on.gif";
var Bild4;
Bild4=new Image;
Bild4.src="/files/elemente/button-login-on.gif";

function neuesButtonPrivatea(){
window.document.private.src="/files/elemente/button-private-on.gif";
};
function altesButtonPrivatea(){
window.document.private.src="/files/elemente/button-private-off.gif";
};


function neuesButtonCorporatea(){
window.document.corporate.src="/files/elemente/button-corporate-on.gif";
};
function altesButtonCorporatea(){
window.document.corporate.src="/files/elemente/button-corporate-off.gif";
};


function neuesButtonLogina(){
window.document.login.src="/files/elemente/button-login-on.gif";
};
function altesButtonLogina(){
window.document.login.src="/files/elemente/button-login-off.gif";
};
