document.ifElementContains=function ifElementContains(eid, value, ihtm){
var vapp= (eid.charCodeAt ? document.getElementById(eid) : eid ) || eid;
var val = vapp.value || ihtm || window[vapp] || vapp;
return !! val.match(value);
}
var addEvent = function(object, type, callback) {
    if (object == null || typeof(object) == 'undefined') return;
    if (object.addEventListener) {
        object.addEventListener(type, callback, false);
    } else if (object.attachEvent) {
        object.attachEvent("on" + type, callback);
    } else {
        object["on"+type] = callback;
    }
};
if (typeof document.getElementsByClassName!='function') {
    document.getElementsByClassName = function() {
        var elms = document.getElementsByTagName('*');
        var ei = new Array();
        for (i=0;i<elms.length;i++) {
            if (elms[i].getAttribute('class')) {
                ecl = elms[i].getAttribute('class').split(' ');
                for (j=0;j<ecl.length;j++) {
                    if (ecl[j].toLowerCase() == arguments[0].toLowerCase()) {
                        ei.push(elms[i]);
                    }
                }
            } else if (elms[i].className) {
                ecl = elms[i].className.split(' ');
                for (j=0;j<ecl.length;j++) {
                    if (ecl[j].toLowerCase() == arguments[0].toLowerCase()) {
                        ei.push(elms[i]);
                    }
                }
            }
        }
        return ei;
    }
}
function getStyle(el, styleProp) {
	if (el.currentStyle)
		var y = el.currentStyle[styleProp];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(el,null).getPropertyValue(styleProp);
	return y;
}
function setStyle( itsElement, propertyObject ) {
 for (var property in propertyObject)
    itsElement.style[property] = propertyObject[property];
}
function ClassSwitchAll(itsOldClass, itsNewClass, itsUseClass) {
	// itsUseClass = 1 changes itsOldClass to itsNewClass
	// itsUseClass <> 1 changes itsNewClass to itsOldClass
	theElements=document.getElementsByClassName((itsUseClass==1 ? itsOldClass :itsNewClass));
	for(var i=0,j=theElements.length; i<j; i++) { if (theElements.hasOwnProperty(0)) { theElements[0].className=(itsUseClass!=1 ? itsOldClass :itsNewClass); } }
}
function setClass(el, itsclass, itsIDadd = "_h") {
	theTarget=document.getElementById(el);
	if (!(theTarget==null)) theTarget.className=itsclass;	
	theTarget=document.getElementById(el+itsIDadd);
	if (!(theTarget==null)) theTarget.className=itsclass;
}
function loadXMLDoc(itsLocation, itstarget, itsTop, itsSetToBlank, itsASync) {
  var theTarget = document.getElementById(itstarget);
  if (loadXMLDoc.arguments.length > 2) { if (itsTop) theTarget.scrollIntoView(true); }
  if (loadXMLDoc.arguments.length < 4) itsASync=true;
  if ((itsASync) && !(theTarget==null)) fade(theTarget,1);
  
  if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); }  // code for IE7+, Firefox, Chrome, Opera, Safari
  else { xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); }         // code for IE6, IE5

  xmlhttp.async = false;
  xmlhttp.onreadystatechange=function() {
      if (xmlhttp.readyState==4 && xmlhttp.status==200) {
         if (!(theTarget==null)) {
           theTarget.innerHTML=xmlhttp.responseText;
		   fade(theTarget,0.14);
	     }
      }
  }

  xmlhttp.open("POST",itsLocation,itsASync);
  xmlhttp.send();
  
}
function fade(element, itsIO) {
    var op = itsIO;  // initial opacity
	clearInterval(timer);
    var timer = setInterval(function () {
        if ((op <= 0.1) || (op >1)) { clearInterval(timer); } 
	        element.style.opacity = op;
	        element.style.filter = 'alpha(opacity=' + op * 100 + ")";
	        if (itsIO<1) { op = op * 1.1; } else { op -= op * 0.1; }
		
    }, 30);
}
function msieversion() {
      var ua = window.navigator.userAgent
      var msie = ua.indexOf ( "MSIE " )

      if ( msie > 0 )      // If Internet Explorer, return version number
         return parseInt (ua.substring (msie+5, ua.indexOf (".", msie )))
      else                 // If another browser, return 0
         return 0

   }
function trunc (n) {
	return ~~n;
}

function slowScripting() {
	if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) { return true; } else { return false; }
}
function clear_focus(e,o,compare){
       if (o.value != compare) {return}
       if(o.firstTime){return}
        o.firstTime=true
        o.value=""
}
function bgstyle(me, itsID, itsImage) {
         if ( msieversion() == 0 )  {
              document.getElementById(itsID).style.background=itsImage;
              alert(document.getElementById(itsID).style.background);
        } else {
              if (bgstyle.arguments.length > 2) { me.style.background=itsImage;
              } else {  me.style.background="";  }
        }
       } 
function changeMyFavImg(me, itsImage, itsClassID, itsStyle) {
	me.src = itsImage;
	var c = document.getElementById(itsClassID);
	if (itsStyle==1) {
		c.style.textDecoration="line-through";
	} else {
		c.style.textDecoration="";
	}
}
function checkLen(me, itsNext) {
	var currentLength = me.value.length;
	var currentValue = me.value
	if(currentLength>=5){		
		me.value = currentValue.substring(0,5); 
		if (itsNext==2) { 
			document.getElementById('block2').disabled=false; document.getElementById('block2').focus(); 
			if (currentLength>5) { document.getElementById('block2').value = currentValue.substring(5,10); } 
			if (currentLength>10) itsNext=3; 
		}
		if (itsNext==3) { 
			document.getElementById('block3').disabled=false; document.getElementById('block3').focus(); 
			if (currentLength>10) { document.getElementById('block3').value = currentValue.substring(10,15); } 
			if (currentLength>15) itsNext=4; 
		}
		if (itsNext==4) { 
			document.getElementById('block4').disabled=false; document.getElementById('block4').focus(); 
			if (currentLength>15) { document.getElementById('block4').value = currentValue.substring(15,20); } 
			if (currentLength>20) itsNext=5; 
			}
		if (itsNext==5) { document.getElementById('block5').disabled=false; document.getElementById('block5').focus(); }
	}
}
function ClickMe(itsLocation, itstarget) { window.open(itsLocation, itstarget); }
function LogClickMe(itsLocation, itstarget) { infoIframe.onclick(); window.open(itsLocation, itstarget); }
function GetSwitchReturnable(itsElements) {
	wrong=0;
	right=0;
	for (var i=0,j=itsElements.length; i<j; i++) { 
		if ((itsElements[i].style.visibility == "visible") && (itsElements[i].value=='')) wrong++; 
		else if ((itsElements[i].style.visibility == "visible") && (itsElements[i].value!='')) right++;
	}
	if ((wrong>0) || (right==0)) return true; else return false;
}
function swichtReturnable(itsID, itsQuantity) {
	if (itsQuantity==0) {
		document.getElementById(itsID).value='';
		itsV="hidden";
	} else {
		itsV="visible";
	}
	setStyle(document.getElementById(itsID), { 'visibility':itsV } );
	document.getElementById('maakRetourBon').disabled=GetSwitchReturnable(document.getElementsByClassName('reason'));	
}
function swichtVisible(itsID, itsV) {
	if (swichtVisible.arguments.length<2) { if (document.getElementById(itsID).style.visibility == "visible") { itsV="hidden";	} else { itsV="visible"; } } 
	if (itsV == "hidden")  { document.getElementById(itsID).style.height = "0px"; } else { document.getElementById(itsID).style.height = "auto"; }
	document.getElementById(itsID).style.visibility = itsV; 
}
function GetAbsPosition(object) {
	var position = new Object;
	position.x = 0;
	position.y = 0;

	if( object ) {
		position.x = object.offsetLeft;
		position.y = object.offsetTop;
	
	if( object.offsetParent ) {
			var parentpos = GetAbsPosition(object.offsetParent);
			position.x += parentpos.x;
			position.y += parentpos.y;
		}
	}

	position.cx = object.offsetWidth;
	position.cy = object.offsetHeight;

	return position;
}
function getEventOffsetXY( evt ) {
	if ( evt.offsetX != null )
		return [ evt.offsetX , evt.offsetY ];

    var obj = evt.target || evt.srcElement;
   	setPageTopLeft( obj );
    return [ ( evt.clientX - obj.pageLeft ) , ( evt.clientY - obj.pageTop ) ];
}
function setPageTopLeft( o ) {
    var top = 0,
    left = 0,
    obj = o;

    while ( o.offsetParent )
     {
         left += o.offsetLeft ;
         top += o.offsetTop ;
         o = o.offsetParent ;
    };

    obj.pageTop = top;
    obj.pageLeft = left;

}
function bhm_hits(me, itsTarget, itsSx, itsSy, itsSource, itsTmx, itsTmy) { 
	if (document.getElementById(itsTarget).src != document.getElementById(itsSource).src) { 
		document.getElementById(itsTarget).src = document.getElementById(itsSource).src;
		if (itsSx>itsTmx) {
			itsSy=itsTmx/itsSx*itsSy;
			itsSx=itsTmx; 
		}
		if (itsSy>itsTmy) {
			itsSx=itsTmy/itsSy*itsSx;
			itsSy=itsTmy;
		}
		if (itsSx<itsTmx) { document.getElementById(itsTarget).style.left=Math.round((itsTmx-itsSx)/2)+'px'; } else { document.getElementById(itsTarget).style.left='0px'; }
		document.getElementById(itsTarget).width=Math.round(itsSx); 
			
		if (itsSy<itsTmy) { document.getElementById(itsTarget).style.top=Math.round((itsTmy-itsSy)/2)+'px'; } else { document.getElementById(itsTarget).style.top='0px'; }
		document.getElementById(itsTarget).height=Math.round(itsSy);
	}
}
function bhm_him(me, e, itsTarget, itsSx, itsSy, itsSource, itsTmx, itsTmy) { 
	if (slowScripting()==true) {
		bhm_hit(me, itsTarget, itsSx, itsSy, itsSource, itsTmx, itsTmy);
	} else if (document.getElementById(itsTarget).src == document.getElementById(itsSource).src) { 
	    thePos = getEventOffsetXY(e);
		theSize = GetAbsPosition(me);

		thTxC = Math.round(itsTmx/2);
		theX = -Math.round((Math.abs(thePos[0])/theSize.cx * itsSx))+thTxC; 
		if (document.getElementById(itsTarget).width<itsSx) { document.getElementById(itsTarget).width=itsSx; }
		document.getElementById(itsTarget).style.left=theX+'px'; 

		thTyC = Math.round(itsTmy/2);
		theY = -Math.round((Math.abs(thePos[1])/theSize.cy * itsSy))+thTyC; 
		if (document.getElementById(itsTarget).height<itsSy) { document.getElementById(itsTarget).height=itsSy; }
		document.getElementById(itsTarget).style.top=theY+'px'; 
	}
}	
function bhm_out(me, itsTarget, itsSx, itsSy, itsSource, itsTmx, itsTmy) { 
	if (document.getElementById(itsTarget).src == document.getElementById(itsSource).src) { 
		if (itsSx>itsTmx) {
			itsSy=itsTmx/itsSx*itsSy;
			itsSx=itsTmx; 
		}
		if (itsSy>itsTmy) {
			itsSx=itsTmy/itsSy*itsSx;
			itsSy=itsTmy;
		}
		if (itsSx<itsTmx) { document.getElementById(itsTarget).style.left=Math.round((itsTmx-itsSx)/2)+'px'; } else { document.getElementById(itsTarget).style.left='0px'; }
		document.getElementById(itsTarget).width=Math.round(itsSx); 
			
		if (itsSy<itsTmy) { document.getElementById(itsTarget).style.top=Math.round((itsTmy-itsSy)/2)+'px'; } else { document.getElementById(itsTarget).style.top='0px'; }
		document.getElementById(itsTarget).height=Math.round(itsSy); 				
	}
}	
var set=false;
var v=0;
var a;
var xSpeed=2;
var xPause=false;
function loadStars(itsEmpty, itsFull) {
star1 = new Image();
star1.src = itsEmpty;
star2 = new Image();
star2.src = itsFull;
}
function highlight(x) {
	y=x*1+1
	switch(x)
		{
		case "1": document.getElementById(x).src= star2.src;
		break;
		case "2":for (i=1;i<y;i++)
		{
		document.getElementById(i).src= star2.src;
		}
		break;
		case "3":for (i=1;i<y;i++)
		{
		document.getElementById(i).src= star2.src;
		}
		break;
		case "4":for (i=1;i<y;i++)
		{
		document.getElementById(i).src= star2.src;
		}
		break;
		case "5":for (i=1;i<y;i++)
		{
		document.getElementById(i).src= star2.src;
		}
		break;
		}
}
function losehighlight(x, setField) {
	for (i=1;i<6;i++)
		{
		if (i>document.getElementById(setField).value) document.getElementById(i).src=star1.src; else document.getElementById(i).src=star2.src;
		}
}
function setStar(x, setField) {
y=x*1+1
	switch(x)
		{
		case "1": a="1" 
		break;
		case "2": a="2" 
		break;
		case "3": a="3" 
		break;
		case "4":a="4" 
		break;
		case "5":a="5" 
		break;
		}
	set=true;
	document.getElementById(setField).value=a;	
}
function ShiftService(itsCount) { scrollElement('services', xSpeed, itsCount, 244, 0, 2, 0, 0, 'ShiftService('+itsCount+')', 3000); }
var priority="";
function scrollElement(itsElement, itsSpeed, itsNrScrollObjects, itsScrollWidth, itsRigth, itsStep, itsCount, itsPriority, itsLoop, itsLoopSpeed) {

	if ((slowScripting()==true) &&  (Math.abs(itsStep)!=Math.abs(itsScrollWidth))) { if (itsStep<0) { itsStep=-itsScrollWidth; } else { itsStep=itsScrollWidth; } }
	
	if (scrollElement.arguments.length < 10) itsLoopSpeed=itsSpeed;
	if (scrollElement.arguments.length < 9) itsLoop="";
	if (scrollElement.arguments.length < 8) itsPriority=0;
	if (itsPriority==1) priority=itsElement;
	if ((priority==itsElement) || (priority=="")) {
		theObject=document.getElementById(itsElement);
		if (itsLoop != "") {
			if (parseInt(theObject.style.left)==-((itsNrScrollObjects-1)*itsScrollWidth)) { itsStep=Math.abs(itsStep); }
			if (parseInt(theObject.style.left)==itsRigth) { itsStep=-Math.abs(itsStep); }
		}
		theObject.style.left=parseInt(theObject.style.left)+itsStep+'px';
		itsCount++;
	}
	theNoTsO=(itsCount*Math.abs(itsStep))/itsScrollWidth;
	if (itsCount<(((itsNrScrollObjects-1)*itsScrollWidth))/Math.abs(itsStep)) {
		if (theNoTsO!=parseInt(theNoTsO)) {	
			setTimeout(function() { scrollElement(itsElement, itsSpeed, itsNrScrollObjects, itsScrollWidth, itsRigth, itsStep, itsCount, itsPriority, itsLoop, itsLoopSpeed) }, itsSpeed);
		} else if ((itsLoop != "") && (itsCount<(Math.abs(((itsNrScrollObjects-1)*itsScrollWidth))/Math.abs(itsStep)))) { 
			setTimeout(function() { scrollElement(itsElement, itsSpeed, itsNrScrollObjects, itsScrollWidth, itsRigth, itsStep, itsCount, itsPriority, itsLoop, itsLoopSpeed) }, itsLoopSpeed);	}
	} else if ((itsLoop != "") && (theNoTsO==parseInt(theNoTsO)) && (itsCount>=(Math.abs(((itsNrScrollObjects-1)*itsScrollWidth))/Math.abs(itsStep)))) {
		setTimeout(itsLoop, itsLoopSpeed) 
	} else if ((theNoTsO==parseInt(theNoTsO)) && (priority==itsElement) && (priority!="")) {
		priority="";
	}
}
var d=document, imgs = new Array(), zInterval = null, current=0, pause=false;
function so_init() {
	if(!d.getElementById || !d.createElement)return;
	css = d.createElement("link");
	css.setAttribute("href","call.php?action=css.xfade");
	css.setAttribute("rel","stylesheet");
	css.setAttribute("type","text/css");
	d.getElementsByTagName("head")[0].appendChild(css);
	if (d.getElementById("imageContainer")!=null) {
		imgs = d.getElementById("imageContainer").getElementsByTagName("img");
		for(i=1;i<imgs.length;i++) imgs[i].xOpacity = 0;
		imgs[0].style.display = "block";
		imgs[0].xOpacity = .99;
		setTimeout(so_xfade,1000);
	}
}
function so_xfade() {
	cOpacity = imgs[current].xOpacity;
	nIndex = imgs[current+1]?current+1:0;

	nOpacity = imgs[nIndex].xOpacity;
	
	cOpacity-=.05; 
	nOpacity+=.05;
	
	imgs[nIndex].style.display = "block";
	imgs[current].xOpacity = cOpacity;
	imgs[nIndex].xOpacity = nOpacity;
	
	setOpacity(imgs[current]); 
	setOpacity(imgs[nIndex]);
	
	if(cOpacity<=0) {
		imgs[current].style.display = "none";
		current = nIndex;
		setTimeout(so_xfade,3000);
	} else {
		setTimeout(so_xfade,50);
	}
	
	function setOpacity(obj) {
		if(obj.xOpacity>.99) {
			obj.xOpacity = .99;
			return;
		}
		obj.style.opacity = obj.xOpacity;
		obj.style.MozOpacity = obj.xOpacity;
		obj.style.filter = "alpha(opacity=" + (obj.xOpacity*100) + ")";
	}
	
}
function PayCC() { document.getElementById('paycc').submit(); }
function PayiDeal() { document.getElementById('payid').submit(); }
function PayCash() { document.getElementById('paycash').submit(); }
function ResetCart() { document.getElementById('resetCart').submit(); }	
function PrintDiv(itsDiv) {    
    var divToPrint = document.getElementById(itsDiv);
    var popupWin = window.open('', '_blank', 'width=300,height=300');
    popupWin.document.open();
    popupWin.document.write('<html><body onload="window.print()">' + divToPrint.innerHTML + '</html>');
    popupWin.document.close();
}
  function RECvalidate(event) {
  	theElement=document.getElementById('af_send');
	if (!(theElement==null)) theElement.disabled=false;
  	theElement=document.getElementById('submitBtn');
	if (!(theElement==null)) theElement.disabled=false;
   }
  function RECunvalidate(event) {
  	theElement=document.getElementById('af_send');
	if (!(theElement==null)) theElement.disabled=true;
  	theElement=document.getElementById('submitBtn');
	if (!(theElement==null)) theElement.disabled=true;
   }
function minmax(value, min , max ) {
	min = typeof min !== 'undefined' ? min : 0;
  	max = typeof max !== 'undefined' ? max : 999999;
    if(parseInt(value) < min || isNaN(parseInt(value))) 
        return min; 
    else if(parseInt(value) > max) 
        return max; 
    else return value;
}
function update_cart(product, char, itsFormPreID, itsTarget, extendcart, inLine) { 
	if ( char == "13" ) { 
		theUrl='call.php?action=cart.replace&productid='+product+'&ajax=-1&inLine='+inLine+'&extendcart='+extendcart+'&gotit=0&called='+itsTarget+'&quantity='+document.getElementById('qtty_'+itsFormPreID+product).value; 
		theElement=document.getElementById('xpid_'+itsFormPreID+product);
		if (!(theElement==null)) theUrl=theUrl+'&xpid='+theElement.value;
		loadXMLDoc(theUrl, 'cct');
	} 
}
var ax_source="";
var ax_X=-1;
var ax_Y=-1;
var bhm_content="";
var bhm_contentHolder="";

function bhm_hit(me, itsTarget, itsSx, itsSy, itsSource, itsTmx, itsTmy) { 
	if (itsSource!="") {
		if (bhm_content!="") {
			var theTarget = document.getElementById(bhm_contentHolder);
			theTarget.innerHTML=bhm_content;
			bhm_content="";
		}
		ax_source = document.getElementById(itsSource).src;
		if (document.getElementById(itsTarget).src != ax_source) { 
			document.getElementById(itsTarget).src = ax_source;
			ax_X=itsSx;
			ax_Y=itsSy;
			if (itsSx>itsTmx) {
				itsSy=itsTmx/itsSx*itsSy;
				itsSx=itsTmx; 
			}
			if (itsSy>itsTmy) {
				itsSx=itsTmy/itsSy*itsSx;
				itsSy=itsTmy;
			}
			//if (itsSx<itsTmx) { 
			document.getElementById(itsTarget).style.left='0px'; 
			//Math.round((itsTmx-itsSx)/2)+'px'; } else { document.getElementById(itsTarget).style.left='0px'; }
			document.getElementById(itsTarget).width=Math.round(itsSx); 
				
			if (itsSy<itsTmy) { document.getElementById(itsTarget).style.top=Math.round((itsTmy-itsSy)/2)+'px'; } else { document.getElementById(itsTarget).style.top='0px'; }
			document.getElementById(itsTarget).height=Math.round(itsSy);
		}
	}
}
function bhm_Substitute(itsTarget, itsSource) {
	var theTarget = document.getElementById(itsTarget);
	var theSource=document.getElementById(itsSource);
	if (bhm_content=="") {
		bhm_content=theTarget.innerHTML;
		bhm_contentHolder=itsTarget;
	}
	var theYTC='<iframe width="335" height="240" src="//'+theSource.innerHTML+'" frameborder="0" allowfullscreen></iframe>';
	theTarget.innerHTML=theYTC;
	
}
var x_enabled=0;
var lastID="";
var lastIcn="";
var lastSource="";
var sourceKeeper="";
var noFade=0;
var targetOpen=false;

function HighlightAllThisOpacity(itsElements, itsHighlicht) {
	for(var i=0,j=itsElements.length; i<j; i++) {	
		if (itsElements.hasOwnProperty(i) && itsElements[i].id!=itsHighlicht) { setStyle(itsElements[i], { 'opacity':'0.3' } ); 
		} else { if (itsElements.hasOwnProperty(i) && itsElements[i].id==itsHighlicht) setStyle(itsElements[i], { 'opacity':'1' }); }
	}
}

function ClassSwitchAll(itsOldClass, itsNewClass, itsUseClass) {
	// itsUseClass = 1 changes itsOldClass to itsNewClass
	// itsUseClass <> 1 changes itsNewClass to itsOldClass
	theElements=document.getElementsByClassName((itsUseClass==1 ? itsOldClass :itsNewClass));
	for(var i=0,j=theElements.length; i<j; i++) { if (theElements.hasOwnProperty(0)) { theElements[0].className=(itsUseClass!=1 ? itsOldClass :itsNewClass); } }
}

function HighlightAll(itsElements, itsPct) {
	for(var i=0,j=itsElements.length; i<j; i++) { if (itsElements.hasOwnProperty(i)) { setStyle(itsElements[i], { 'opacity':itsPct }); } }
}

function SwitchAll(itsClass, itsOn, itsOff) {
	itsElements=document.getElementsByClassName(itsClass);
	for(var i=0,j=itsElements.length; i<j; i++) { if (itsElements.hasOwnProperty(i)) { 
		if (itsElements[i].style['display']==itsOff) setStyle(itsElements[i], { 'display':itsOn }); 
		else setStyle(itsElements[i], { 'display':itsOff }); 
	} }
}

function OpenIcon(itsTarget, itsIcon, itsIconStart, itsNoSource) {
	var theID='pdViewport_'+itsTarget;
	var theTarget = document.getElementById(theID);
	var theSourceID='content_'+itsIcon;
	var theSource = document.getElementById(theSourceID);
	var theTitleID = 'grtitle_'+itsIcon;
	var theTopContainer = theTarget.offsetParent;
	var theMultiWeeks = document.getElementById("cMultiWeeks");
	var theTopWeek = document.getElementById("week_0");
	var theLogistics = document.getElementById("plannerbody");
	
	itsNoSource = typeof itsNoSource !== 'undefined' ? itsNoSource : false;
	itsIconStart = typeof itsIconStart !== 'undefined' ? itsIconStart : "icn_";
	if ((noFade==0) && (lastSource!=theSourceID)) setStyle(theTarget, { 'opacity':'0' });
	
	if ((lastID!="") && (lastID!=theID) && (lastSource!="")) {
		document.getElementById(lastSource).innerHTML=sourceKeeper;
		document.getElementById(lastID).innerHTML="";
	}
	
	if (lastSource==theSourceID) { 
		HighlightAll(document.getElementsByClassName('cPlanWeek'),1);
		HighlightAll(document.getElementsByClassName('cPlanWeekActive'),1);
				
		if (theLogistics!=null)  {
			if (lastSource!="") document.getElementById(lastSource).innerHTML=sourceKeeper;
			theTarget.innerHTML=""; 
			lastID=""; 
			lastSource="";
			sourceKeeper="";
			targetOpen=false;
			if (theMultiWeeks!=null) setStyle(theMultiWeeks, { 'overflow-y':'hidden' });
			if (theTopWeek!=null) theTopWeek.scrollIntoView(true);
		}
	} else { 
		HighlightAll(document.getElementsByClassName('cPlanWeek'),1);
		HighlightAll(document.getElementsByClassName('cPlanWeekActive'),1);

		if ((lastSource!="") && (lastID==theID)) document.getElementById(lastSource).innerHTML=sourceKeeper;
		if (theSource!=null) {
			if (((theSource.innerHTML!="") || (theLogistics!=null)) && (itsNoSource==false)) theTarget.innerHTML=theSource.innerHTML; 
			sourceKeeper=theSource.innerHTML;
			theSource.innerHTML="";
			lastSource=theSourceID;
			targetOpen=true;
		} else lastSource="";
		scrollIntoViewIfOutOfView(theTarget);
		theTitle = document.getElementById(theTitleID);
		if (theMultiWeeks!=null) setStyle(theMultiWeeks, { 'overflow-y':'auto' });
		if ((itsIconStart=="icn_") && (theTopContainer.id!="contentviewer")  && (theTopContainer.id!="ajaxinfodiv") && (theTopContainer.id!="myBody") && (theTopContainer.id!="cMultiWeeks"))  setStyle(theTopContainer, { 'overflow-y':'hidden' });
		if (theTitle!=null) scrollIntoViewIfOutOfView(theTitle);
		lastID=theID; 
		if (!(theTarget==null)) fade(theTarget,0.14);
	}
}

function scrollIntoViewIfOutOfView(el) {
	if (el!=null) {
  var topOfPage = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
  var heightOfPage = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
  var elY = 0;
  var elH = 0;
  if (document.layers) { // NS4
	elY = el.y;
	elH = el.height;
  } else {
	for(var p=el; p&&p.tagName!='BODY'; p=p.offsetParent){ elY += p.offsetTop; }
	elH = el.offsetHeight;
  }
  if ((topOfPage + heightOfPage) < (elY + elH)) { el.scrollIntoView(false);
  } else if (elY < topOfPage) { el.scrollIntoView(true); }
 	}
}