// JavaScript Document
//
//	Project 	:	Direktbank
//  Aangemaakt	: 	15-12-2008
//	Door		:	Youniq Reclame en Internet
//	Author		:	(Raymond)
//




function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    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(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}


/*  
###########################################

FUNCTIE VOOR DROPDOWNMENU IN IE6 EN IE7

###########################################
*/
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

sfHover = function() {
	var sfEls = document.getElementById("subnav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

/*  
###########################################

FUNCTIE VOOR VERGROTEN EN VERKLEINEN FONTS

Alleen text binnen de tags 'div' worden
vergroot en/of verkleind.

###########################################
*/

function fsize()
{
	var fontSize;
	if ((getCookie("fontSize") != null) &&  (getCookie("fontSize") != '')) {
		var fontSize = getCookie("fontSize");
	}else{
		setCookie("fontSize",12);
	}
	if (fontSize > 12) {
		increaseFontSize();
		setCookie("fontSize",13);
	}
	if (fontSize < 12) {
		decreaseFontSize();
		setCookie("fontSize",11);
	}
	if (fontSize == 12) {
		setFontSize();
		setCookie("fontSize",12);
	}
}

function setCookie(cookieName,cookieValue) {
	
	var today = new Date();
	var expire = new Date();
	expire.setTime(today.getTime() + 3600000*24*1000);
	document.cookie = cookieName + "="+escape(cookieValue)+";expires="+expire.toGMTString() +";path=/;domain=direktbank.nl";
}

function getCookie(cookieName) {
	var cookie = document.cookie;
	var index = cookie.indexOf(cookieName + "=");
	if (index == -1) return null;
	index = cookie.indexOf("=", index) + 1;
	var endstr = cookie.indexOf(";", index);
	if (endstr == -1) endstr = cookie.length;
	return unescape(cookie.substring(index, endstr));
}


//Verwijderen
function eraseCookie(name) {
    setCookie(name,12);
}



function increaseFontSize() {
	setCookie('fontSize',13);
	var h = document.getElementsByTagName('h1').item(0);
	var h2 = document.getElementsByTagName('h2');
   var p = document.getElementsByTagName('div');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s 	= parseInt(p[i].style.fontSize.replace("px",""));
		 if(h){
			 var hs	= parseInt(h.style.fontSize.replace("px",""));
		 }
      } else {
         var s 		= 12;
		 var hs 	= 14;
      }
      if(s!=7) {
         s 		= 13;
		 hs 	= 16;
		 setCookie('fontSize',13);
	  }
      p[i].style.fontSize = s+"px";
	  if(h){
	 	 h.style.fontSize = hs+"px";
	  }
   }   
   
   for(i=0;i<h2.length;i++) {
	 if(h2[i].style.fontSize) {
         var s = parseInt(h2[i].style.fontSize.replace("px",""));
      } else {
         var s = 14;
      }  
	  var s = 14;
	 h2[i].style.fontSize = s+"px";
   }
   
}

function setFontSize() {
	setCookie('fontSize',12);
   var p = document.getElementsByTagName('div');
   var h2 = document.getElementsByTagName('h2');
   var h = document.getElementsByTagName('h1').item(0);

   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
		 if(h){
		 	var hs	= parseInt(h.style.fontSize.replace("px",""));
		 }
      } else {
         var s = 12;
		  var hs = 14;
      }
      if(s!=7) {
         s = 12;
		  hs = 14;
      }
      p[i].style.fontSize = s+"px";
	  if(h){
	 	 h.style.fontSize = hs+"px";
	  }
   }  
   for(i=0;i<h2.length;i++) {
	 if(h2[i].style.fontSize) {
         var s = parseInt(h2[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }  
	  var s = 12;
	 h2[i].style.fontSize = s+"px";
   }
   
   
}
function decreaseFontSize() {
	setCookie("fontSize",11);
   var p = document.getElementsByTagName('div');
   var h = document.getElementsByTagName('h1').item(0);
   var h2 = document.getElementsByTagName('h2');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
		 if(h){
	 	  var hs	= parseInt(h.style.fontSize.replace("px",""));
	  	}
		
      } else {
         var s = 12;
		 var hs = 14;
      }
      if(s!=7) {
         s = 11;
		 hs = 13;
		 
      }
      p[i].style.fontSize = s+"px";
	  if(h){
	 	 h.style.fontSize = hs+"px";
	  }
   } 
   
   for(i=0;i<h2.length;i++) {
	 if(h2[i].style.fontSize) {
         var s = parseInt(h2[i].style.fontSize.replace("px",""));
      } else {
         var s = 11;
      }  
	  var s = 11;
	 h2[i].style.fontSize = s+"px";
   }
   
}

/*###########################################

VERKRIJG ANCHOR

###########################################*/

