
	//DropDown Nav
	var activeMenu;
	var active = function(id) {
	var nav = document.getElementById(id);
	if (!nav){return;}
		var e = nav.getElementsByTagName("LI");
		for (var i=0; i<e.length; i++) {
			e[i].onmouseover=function() {
	    		if (activeMenu){activeMenu.onmouseout();
				}
	    		activeMenu = this;
					this.className+=" active";
					//alert(this.firstChild.id);
					//swHeader(this.firstChild.id);
				}
				e[i].onmouseout=function() {
					this.className=this.className.replace(/active/g, '');
					}
				}
			navFocus(id,true);
		//navSel(id);
	}


  


  
	//DropDown tab Focus
	var navFocus = function(id,mouseOverMenu){
	  var subnav = document.getElementById(id);
	  if (!subnav){return;}  
	  var list = subnav.getElementsByTagName("A");
	  for (var i = 0; i < list.length; i++){
	    var e = list[i];
	    if (e.parentNode.parentNode.id == id){
	  		if (mouseOverMenu){
	    		e.onfocus = function(){this.parentNode.parentNode.onmouseover();}
	  		}
	 	 	else {
	    			e.onfocus = function(){this.parentNode.parentNode.onclick();
				}
	  	}
		}
	}
	//DropDown Nav LastNodefocus
		if (list.length == 0){return;}
	  	var lastSub = list[list.length-1];
	  	if (lastSub.parentNode.parentNode.id == id){return;}
	  		lastSub.onblur = function(){
	    	this.parentNode.parentNode.parentNode.onmouseout();
	  	}
	}
	//StyleInputFields
	var setSearch = function(){
	var key = 'zoek in Orange';
	var j = document.getElementById('search');
	j.value=key;
	j.onfocus=function(){
	if(j.value==key)j.value='';j.style.color = "#000000";
		}
	j.onblur=function(){
	if(j.value=='')j.value=key;j.style.color = "";
	}	
	}	
	var setUser = function(){
	var key = '- jouw 06 nummer -';
	var j = document.getElementById('user');
	j.value=key;
	j.onfocus=function(){
	if(j.value==key)j.value='';j.style.color = "#000000";
		}
	j.onblur=function(){
	if(j.value=='')j.value=key;j.style.color = "";
	}	
	}	
	var setPswd = function(){
	var key = '- jouw wachtwoord -';
	var j = document.getElementById('pswd');
	j.value=key;
	j.onfocus=function(){
	if(j.value==key)j.value='';j.style.color = "#000000";
		}
	j.onblur=function(){
	if(j.value=='')j.value=key;j.style.color = "";
	}	
	}	
	//remove borders
	var setBorder = function(){
	var rbg = document.getElementsByTagName('input');
	for (var i = 0; i < rbg.length; i++) {
	if(rbg[i].getAttribute('type')=='radio' || rbg[i].getAttribute('type')=='checkbox'){
		rbg[i].style.border='none';
		rbg[i].style.width='auto';
		}
	}
	}
	//hover form buttons
	var setHover = function(){
	var hbg = document.getElementsByTagName('input');
	for (var i = 0; i < hbg.length; i++) {		
		if(hbg[i].getAttribute('type')=='submit' || hbg[i].getAttribute('type')=='reset' || hbg[i].getAttribute('type')=='button' || hbg[i].getAttribute('type')=='file') {
			hbg[i].onmouseover=function(){
				this.className = 'buttonhover';
			}
			hbg[i].onmouseout=function(){
				this.className = 'button';
			}
		}
	}
	}
  

// mdi
function getEl(el){
  if (!document.getElementById){
    return false;
  }
  return document.getElementById(el);
}


function FadeHeader(oArg){
  this.bodyId = oArg.bodyId;
  this.headerId = oArg.headerId;
  this.titleId = oArg.titleId;
  this.linkId = oArg.linkId;
  this.fadeSpeed = oArg.fadeSpeed;
  this.fadeTitleDelay = oArg.fadeTitleDelay;
  this.activeHeader = oArg.activeHeader ? oArg.activeHeader : false; 
  
  this.hashNum = fadeHeaderHash.length;
  fadeHeaderHash[this.hashNum] = this;
     
  this.header = [];
  this.fadeAmount = [];
  this.timer = [];
  
  this.add = function(oArg){
    this.header[oArg.name] = oArg;
  }
  this.setup = function (){
  }
  this.setHeader = function(name){
    if (this.activeHeader == name){
      return;
    }
    this.activeHeader = name;  
    getEl(this.bodyId).className = this.header[name].bodyClassName;
    getEl(this.linkId).href =  this.header[name].href;
    
    clearTimeout(this.timer[this.headerId]);
    this.fadeAmount[this.headerId] = 0;
    this.fadeIn(this.headerId);
    
    clearTimeout(this.timer[this.titleId]);
    this.fadeAmount[this.titleId] = 0;
    this.setOpacity(getEl(this.titleId),0);
    this.timer[this.titleId] = setTimeout('fadeHeaderHash[' + this.hashNum + '].fadeIn(\'' + this.titleId +'\')',this.fadeTitleDelay);
  }
  
  this.fadeIn = function(elId){
    this.fadeAmount[elId] += this.fadeSpeed;
    if (this.fadeAmount[elId] >= 100){
      this.fadeAmount[elId] = 100;
    }
    this.setOpacity(getEl(elId),this.fadeAmount[elId]);
    if (this.fadeAmount[elId] < 100){
       this.timer[elId] = setTimeout('fadeHeaderHash[' + this.hashNum + '].fadeIn(\'' + elId +'\')',50);
    }
  }
  this.setOpacity = function(el,opac){
    if (el.filters){
      el.filters.alpha.opacity=opac;
    }
    else {
      el.style.opacity=opac/101;
    }
  }
  
}
fadeHeaderHash = [];

function addEvent(obj, evType, fn, useCapture){
  if (obj.addEventListener){
    obj.addEventListener(evType, fn, useCapture);
    return true;
  }
  else if (obj.attachEvent){
    var r = obj.attachEvent("on"+evType, fn);
    return r;
  }
  else {
    alert("Handler could not be attached");
  }
}

  // browser sniffer
function Browser(){
  this.iE = navigator.appName.toLowerCase().indexOf('microsoft') != -1 ? 1 : 0;
  this.mac =  navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 1 : 0;
  this.win = navigator.userAgent.toLowerCase().indexOf('windows') != -1 ? 1 : 0;
  this.safari =  navigator.userAgent.toLowerCase().indexOf('safari') != -1 ? 1 : 0;
  this.opera =  navigator.userAgent.toLowerCase().indexOf('opera') != -1 ? 1 : 0;    
  this.mozilla = navigator.appName.toLowerCase().indexOf('netscape') != -1 && !this.safari ? 1 : 0;
  this.winMozilla = this.mozilla && this.win ? 1 : 0;
  this.winIE = this.iE && this.win && !this.opera ? 1 : 0;
  this.macIE = this.iE && this.mac ? 1 : 0;
}

var browser = new Browser();

function addStyle(selector,properties){
  if (document.styleSheets) {
    var s = document.getElementsByTagName('STYLE');
    if (s.length == 0){
      var sheet = document.createElement('style');
      sheet.setAttribute('type','text/css');
      document.getElementsByTagName('HEAD')[0].appendChild(sheet);
    }
    if (browser.winIE){
      var lastSheet = document.styleSheets[document.styleSheets.length - 1];
      lastSheet.addRule(selector, properties);
    }
    else {
      var lastSheet = s[0];
      lastSheet.appendChild(document.createTextNode(selector + ' { ' + properties + ' }'));
    }
  }
}

function setDefaultHeader(e){
  var target;
  if (window.event) {
    target = window.event.srcElement;
  }
  else if (e) {
    target = e.target;
  } 
  else {
    return;
  }
  while (target.tagName != 'BODY'){
    if (target.id == 'header'){
      return;
    }
    target = target.parentNode
  }
  header.setHeader('prive');
}


var header = new FadeHeader({bodyId:'framework',headerId:'headerVisual',titleId:'headerTitle',linkId:'headerTitle',fadeSpeed:10,fadeTitleDelay:500,activeHeader:'prive'});
header.add({name:'prive',bodyClassName:'fWPrive',href:'http://www.orange.nl/orange/producten/abonnement/orangenaarorange.php'});
header.add({name:'zakelijk',bodyClassName:'fWZakelijk',href:'http://www.orange.nl/zakelijk/mkb5_250/product/orange_mail.php'});
header.add({name:'orange',bodyClassName:'fWOrange',href:'http://www.orange.nl/overorange/index.php'});
header.add({name:'shop',bodyClassName:'fWShop',href:'https://shop.orange.nl/'});
header.add({name:'nieuws',bodyClassName:'fWNieuws',href:'https://shop.orange.nl/'});

addStyle('#titleImage','display:none;');
  
	window.onload = function(){
		//return;
	 if(document.getElementsByTagName('input')){setBorder();setHover();
	 	if(document.getElementById('search'))setSearch();
	  	//if(document.getElementById('user'))setUser();
	   //if(document.getElementById('pswd'))setPswd();
	   active('nav');
	 }
	 
   addEvent(getEl('framework'),'mouseover',setDefaultHeader);
   getEl('prive').onmouseover = getEl('zakelijk').onmouseover = getEl('orange').onmouseover = getEl('shop').onmouseover = function(){
     header.setHeader(this.id)
   }
   getEl('titleImage').style.display = 'block';
	 
  	if (document.forms.loginform && document.forms.loginform.login && document.forms.loginform.password) {
  		document.forms.loginform.login.onkeypress = document.forms.loginform.password.onkeypress = function (evt) {
  			var c = document.layers ? evt.which
  				: document.all ? event.keyCode
  				: evt.keyCode;
  			if (c == 13) storeLogin();
  		};
  	}   

  	if (document.forms.zoek && document.forms.zoek.words) {
  		document.forms.zoek.words.onkeypress = function (evt) {
  			var c = document.layers ? evt.which
  				: document.all ? event.keyCode
  				: evt.keyCode;
  			if (c == 13) zoek('');
  		};
  	}    
  }

