/*
 * navigationtabs.js
 *
 * patrickh, KPN-770: Because of a patch for IE6, direct interaction with activeX controls that are loaded by EMBED, APPLET of OBJECT tags is blocked.
 * Therefore part of the javascript in ss_section-show_navigation_tabs_tr_rebranding_extra_kpn.tmpl has been extracted to this file.
 */

var menu1=new Array()
menu1[0]='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+protocol+'//fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="204" height="134" id="dropdown" align="middle"><param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="' + contextpath + '/static/dropdown.swf" /> <param name="menu" value="false" /> <param name="quality" value="high" /> <param name="wmode" value="transparent" /><embed src="' + contextpath + '/static/dropdown.swf" menu="false" quality="high" vmode="transparent" wmode="transparent" width="204" height="134" name="dropdown" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="'+protocol+'//www.macromedia.com/go/getflashplayer" /></object>'

var menu2=new Array()
menu2[0]='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+protocol+'//fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="204" height="134" id="dropdown" align="middle"><param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="' + contextpath + '/static/dropdown.swf" /> <param name="menu" value="false" /> <param name="quality" value="high" /> <param name="wmode" value="transparent" /><embed src="' + contextpath + '/static/dropdown.swf" menu="false" quality="high" vmode="transparent" wmode="transparent" width="204" height="134" name="dropdown" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="'+protocol+'//www.macromedia.com/go/getflashplayer" /></object>'

var menuwidth='204px'
var disappeardelay=100
var hidemenu_onclick="yes" 
var protocol = window.location.protocol

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){ var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop; var parentEl=what.offsetParent; while (parentEl!=null){ totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop; parentEl=parentEl.offsetParent; } return totaloffset; }

function showhide(obj, e, visible, hidden, menuwidth){ if (ie4||ns6) dropmenuobj.style.left=dropmenuobj.style.top=-500
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover") obj.visibility=visible; else if (e.type=="click") obj.visibility=hidden }

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body }

function clearbrowseredge(obj, whichedge){ var edgeoffset=0; if (whichedge=="rightedge"){ var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-100 : window.pageXOffset+window.innerWidth-100
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure) edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-100 : window.pageYOffset+window.innerHeight-100
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure) edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth)
{
    if (window.event) event.cancelBubble=true; else if (e.stopPropagation) e.stopPropagation();
    //Execute the click in the background, so the logging will detect it
    
    doBackgroundClick(pagelinkurl);

    clearhidemenu();
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)

if (ie4){
  dropmenuobj.x=event.x
  dropmenuobj.y=-17
}else{
  dropmenuobj.x=getposOffset(obj, "left")
  dropmenuobj.y=getposOffset(obj, "top") - 27}

dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}
function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

var xmlhttp = null;
  
function doBackgroundClick(url)
{
  if (window.XMLHttpRequest)
    {
    xmlhttp=new XMLHttpRequest();
    xmlhttp.onreadystatechange=xmlhttpChange;
    xmlhttp.open('GET', url, true);
    xmlhttp.send(null);
    }
  // code for IE
  else if (window.ActiveXObject)
  {
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
    if (xmlhttp)
    {
      xmlhttp.onreadystatechange=xmlhttpChange;
      xmlhttp.open("GET",url,true);
      xmlhttp.send();
    }
  }
}
  
function xmlhttpChange()
{}


