<!--
function toggleDiv(id,flagit) {
if (flagit=="1"){
if (document.layers) document.layers[''+id+''].visibility = "show"
else if (document.all) document.all[''+id+''].style.visibility = "visible"
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "visible"
}
else
if (flagit=="0"){
if (document.layers) document.layers[''+id+''].visibility = "hide"
else if (document.all) document.all[''+id+''].style.visibility = "hidden"
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden"
}
}
//-->

    document.body.onclick = hidePopup; //document.onclick = 
	cancelClick = false;
	hidePopupOnClick = true;
	
	function showPopupNextControl(element, offsetX, offsetY){
		hidePopup();
		cancelClick = true;
		showPopupEvent(element, element.nextSibling.innerHTML, offsetX, offsetY);
	}
	function showPopup(element, innerHTML, offsetX, offsetY){
		// Hide current popup if any to reduce flickering during update
		hidePopup();
		showPopupEvent(element, innerHTML, offsetX, offsetY);
	}
	function showPopupBaloon(element, contentFunction, offsetX, offsetY){
		// Hide current popup if any to reduce flickering during update
		hidePopup();
		showPopupEvent(element, eval(contentFunction), offsetX, offsetY);
	}

	function showPopupEvent(element, innerHTML, offsetX, offsetY)
	{
	    try{
		var theFrame = document.getElementById('popupIFrame');
		var theDiv = document.getElementById('popupDiv');

		theDiv.innerHTML = innerHTML;
		
		// Position div
		theDiv.style.top = (getElementY(element) + offsetY) + 'px';
		theDiv.style.left = (getElementX(element) + element.offsetWidth + offsetX) + 'px';

		// Make it visible, div must be visible before resizing frame:
		//  offsetWidth & offsetHeight will be 0 when display = none
		theDiv.style.display = '';
		theFrame.style.display = '';
		
        // Resize IFrame to hide SELECT elements
		theFrame.style.top = theDiv.style.top;
		theFrame.style.left = theDiv.style.left;
		theFrame.style.width = theDiv.offsetWidth;
		theFrame.style.height = theDiv.offsetHeight;
        cancelHidePopup();
		}
		catch(e){}




	}
	
	function showSimplePopupCentered(innerHTML)
	{
		hidePopupOnClick = false;
		showPopupCentered(innerHTML,true);
	}
	
	function showPopupCentered(innerHTML,fullModal)
	{
	    try{
		var theFrame = document.getElementById('popupIFrame');
		var theDiv = document.getElementById('popupDiv');

		theDiv.innerHTML = innerHTML;
		
		// Make it visible, div must be visible before resizing frame:
		//  offsetWidth & offsetHeight will be 0 when display = none
		theDiv.style.display = '';
		theFrame.style.display = '';		

		// Position the popup
		CenterDiv(theDiv);
		
		// Resize IFrame to hide SELECT elements
        if(fullModal){
			var bd = document.getElementsByTagName('BODY')[0];
			theFrame.style.top = '0px';
			theFrame.style.left = '0px';
			
			var windowSize = getWindowSize();
			theFrame.style.width = windowSize.width + 'px'; 
			theFrame.style.height = windowSize.height + 'px';
        }else{
        	theFrame.style.top = theDiv.style.top;
			theFrame.style.left = theDiv.style.left;
			theFrame.style.width = theDiv.offsetWidth;
			theFrame.style.height = theDiv.offsetHeight;
		}
		
		FlashDisplay(false);
		
		}
		catch(e){}
	}
	
	function cancelPopup(){
		hidePopupOnClick = true;
		hidePopup();
	}
	function hidePopup()
	{
		if(hidePopupOnClick){
			if(cancelClick){
				cancelClick = false;
			}else{
			    try{
			    theDiv = document.getElementById('popupDiv');
			    theFrame = document.getElementById('popupIFrame');
						theDiv.style.display = theFrame.style.display = 'none';
						theFrame.style.width = '1px';
		                theFrame.style.height = '1px';
		                theDiv.style.top = theFrame.style.top = '0px';
			            theDiv.style.left = theFrame.style.left = '0px';
		        FlashDisplay(true);
		        }
		        catch(e){}
			}
		}
	}
	
	function CenterDiv(theDiv)
	{
		var windowSize = getWindowSize();
		var popupSize = getElementSize(theDiv);
		
		// Position div
		theDiv.style.top = (windowSize.posY + Math.floor((windowSize.height - popupSize.height)/2))+'px';
		theDiv.style.left = (windowSize.posX + Math.floor((windowSize.width - popupSize.width) / 2)) + 'px';
	}
	
	function getWindowSize()
	{
		var size = {width: 0, height: 0, posX: 0, posY: 0};
		
		if (window.innerHeight) {
			posY = window.pageYOffset;
			posX = window.pageXOffset;
			size.height = window.innerHeight;
			size.width = window.innerWidth;
		}
        else if (document.documentElement) {
	        posY = document.documentElement.scrollTop;
	        posX = document.documentElement.scrollLeft;
	        size.height = document.documentElement.clientHeight;
	        size.width = document.documentElement.clientWidth;
        }
        else if (document.body) {
	        posY = document.body.scrollTop;
	        posX = document.body.scrollLeft;
	        size.height = document.body.clientHeight;
	        size.width = document.body.clientWidth;
        }
		// override width (FF shows hor-scrollbar if code above is used)
		size.width = document.getElementsByTagName('BODY')[0].offsetWidth;
		return size;
	}
	
	function getContentSize()
	{
		//return getElementSize(document.getElementsByTagName('BODY')[0]);
		var size = {width: 0, height: 0};
		var element = document.getElementsByTagName('HTML')[0]; //.getElementsByTagName('BODY')[0];
		
		size.width = element.scrollWidth;
		size.height = element.scrollHeight;
		
		return size;
	}
	
	function getElementSize(element)
	{
		var size = {width: 0, height: 0};
		
		size.width = element.offsetWidth;
		size.height = element.offsetHeight;
		
		return size;
	}
	
	function getElementX(element)
	{
		var coords = getPageCoords(element);
		var result = coords.x;
	
		return result;
	}
	
	function getElementY(element)
	{
		var coords = getPageCoords(element);
		var result = coords.y;
		
		return result;
	}
	
	function getPageCoords (element) 
	{ 
		var coords = {x: 0, y: 0} 
		while (element) 
		{
			coords.x += element.offsetLeft; 
			coords.y += element.offsetTop; 
			element = element.offsetParent; 
		} 
	
		return coords; 
	} 
	
	function getInnerHTML(elementId)
	{
		var element = document.getElementById(elementId);
		
		return element == null ? '' : element.innerHTML;
	}
	
	var alertOKurl = "";
	var alertCancelurl = "";
	function showAlertPopup(type, imagePath, message, linkTekst, linkURL, buttons, linkIsJsVar){
	
		// default type 1 = Error
		containerClass = "ib_redcontainer";
		headerClass = "cntHdrRed";
		titleImage = "infoboxFout_Red.gif";
		closeButtonTop = "infoBoxXknop_Red.gif";
		closeButtonContent = "X-knop.gif";
		okButton = "btnNextRed.gif";
		
		switch(type){
			case 2:{ // Warning
				titleImage = "infoboxWaarschuwing_Red.gif";
				break;
			}
			case 3:{
				containerClass = "ib_yellowcontainer";
				headerClass = "cntHdrYellow";
				titleImage = "infoboxTip_Yellow.gif";
				closeButtonTop = "infoBoxXknop_Yellow.gif";
				break;
			}
			//other cases not implemented yet
		}
		s='<div class="cntContainer366">';
			s+='<div class="' + containerClass + '">';
				s+='<div class="' + headerClass + '">';
					s+='<img src="'+ imagePath + titleImage + '" alt="" title="" class="cntImgHdrTxt"/>';
					s+='<a  href="javascript://" onclick="cancelPopup();"><img src="'+ imagePath + closeButtonTop + '" class="ib_sluitknop"/></a>';
				s+='</div>';
				s+='<div class="textBlack">';
					try{
						s+= eval(message);
						}
					catch(e){
						s+= message;
					}
				s+='</div>';
				s+='<div class="alertfooter">';
					s+='<div class="alertbuttons">';
					if(linkTekst){
						link = "";
						if(linkIsJsVar){
							link = eval(linkURL);
						}else{
							link = linkURL;
						}
						if(link.indexOf("javascript:")>-1){
							s+='<a href="' + link + '"><img  src="'+ imagePath + okButton + '" alt="" title="" /></a>&nbsp;';
							s+='<a class="LinkRedBold" href="' + link + '">' + linkTekst + '</a> ';
						}else{
							s+='<a href="javascript://" onclick="' + link + '"><img  src="'+ imagePath + okButton + '" alt="" title="" /></a>&nbsp;';
							s+='<a class="LinkRedBold" href="javascript://" onclick="' + link + '">' + linkTekst + '</a> ';
						}
	
					}
					switch(buttons){
						case 0:{ // NONE
							break;
						}
						case 1:{ // OK
						}
						case 2:{ // YES_NO
						}
						case 3:{ // OK_CANCEL
							s+='<a  href="javascript://" onclick="cancelPopup();"><img src="'+ imagePath + closeButtonContent + '" class="ib_sluitlink"/></a>&nbsp;';
							s+='<a class="LinkRedBold" href="javascript://" onclick="cancelPopup();">Sluit</a>';
						}
					}
					s+='</div>';
				s+='</div>';
				s+='<div class="cleaner"></div>';
			s+='</div>';	
		s+='</div>';	
		hidePopupOnClick = false;
		showPopupCentered(s,true);
	}
	
	function FormatPopupBaloon(innerHTML){
			
		s="<table border='0' cellpadding='0' cellspacing='0' class='popupTable' onmouseover='cancelHidePopup();' onmouseout='hidePopupAfterTimeout();'>";
		s+="<tr class='rowTop'>";
		s+="<td class='leftTop'></td>";
		s+="<td class='centerTop'></td>";
		s+="<td class='rightTop'></td>";
		s+="</tr>";
		s+="<tr valign='top'>";
		s+="<td class='leftSide'><div class='arrow'></div></td>";
		s+="<td class='content'>";
		s+=innerHTML;
		s+="</td>";
		s+="<td class='rightSide'><div class='sideSpacer'></div></td>"; // sideSpacer is used to stretch the cell
		s+="</tr>";
		s+="<tr class='rowBottom'>";
		s+="<td class='leftBottom'></td>";
		s+="<td class='centerBottom'></td>";
		s+="<td class='rightBottom'></td>";
		s+="</tr>";
		s+="</table>";
		return s;
	}
	
    function BuildPrevBaloonContent(duration, departureDate,  transport,  departureLocation, board, priceUrl, groupSize, offer, price, allInPriceText){
		s = "<table width='100%' border='0' class='toolboxTable'>";
        if(offer.length)
        {
			s += "<tr><td nowrap><nobr><span class='dt_specialOffer'>" + offer + "</span></nobr></td></tr>";
        }
        if (departureDate.length)
		{
			s += "<tr><td>Vertrek:</td><td nowrap><nobr>" + departureDate + "</nobr></td></tr>";
		}
		if (groupSize.length)
		{
			s += "<tr><td>Reisgezelschap:</td><td nowrap><nobr>" + groupSize + " personen</nobr></td></tr>";
		}
		if (duration.length)
		{
			s += "<tr><td>Reisduur:</td><td nowrap><nobr>"+ duration + "&nbsp;dgn</nobr></td></tr>";
		}
		if (transport.length)
		{
			s += "<tr><td>Vervoer:</td><td nowrap><nobr>" + transport + "</nobr></td></tr>";
		}else{
			s += "<tr><td>Vervoer:</td><td nowrap><nobr>alleen overnachting</nobr></td></tr>";
		}
		if (board.length)
		{
			s += "<tr><td>Verzorging:</td><td nowrap><nobr>"
			switch(board){
			    case "LG":{s += "Logies"; break;}
			    case "LO":{s += "Logies/ontbijt"; break;}
			    case "HP":{s += "Halfpension"; break;}
			    case "VP":{s += "Volpension"; break;}
			    case "AB":{s += "American breakfast"; break;}
			    case "BB":{s += "Engels ontbijt"; break;}
			    case "CB":{s += "Continental breakfast"; break;}
			    case "BR":{s += "Brunch"; break;}
			    case "VB":{s += "Volgens beschrijving brochure"; break;}
			    case "AI":{s += "Alles inclusief"; break;}
			} 
			s += "</nobr></td></tr>";
		}
		if (departureLocation.length)
		{
			s += "<tr><td colspan=2 nowrap><nobr>" + departureLocation + "</nobr></td></tr>";
		}
		if (price.length)
		{
			s += "<tr><td>Prijs vanaf:</td><td nowrap><nobr>"+ price + "</nobr></td></tr>";
		}
        s += "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>";

		if(allInPriceText.length > 0)
		{
			s += "<tr><td colspan=2 nowrap><nobr>" + allInPriceText + "</nobr></td></tr></td>";
		}
        s += "<tr><td colspan=2 nowrap><nobr><a onclick=\"setTimeout('openGP()');\" href='" + priceUrl + "' class='linkToolbox'>Klik voor prijsoverzicht</a></nobr></td></tr></td>";
        s += "</tr>";
        s += "</table>";
        return FormatPopupBaloon(s);
    }
    
    function BuildPriceBaloonContent(departureDate, duration, allInclusive, familyRoom, transport, airportGroupDescription, priceUrl, groupSize, groupSizeClass, offer, allInPriceText)
    {
        s = "<table width='280' border='0' class='toolboxTable'>";
        
        if(offer.length)
        {
			s += "<tr><td colspan='2' nowrap><nobr><span class='rs_specialOffer'>" + offer + "</span></nobr></td></tr>";
        }        
        s += "<tr><td>Vertrek:</td><td nowrap><nobr>" + departureDate + "</nobr></td></tr>";
        if(groupSize.length)
        {
   			s += "<tr><td>Reisgezelschap:</td><td nowrap><nobr><span class='" + groupSizeClass + "'>" + groupSize + " personen</span></nobr></td></tr>";
        }
        s += "<tr><td>Reisduur:</td><td nowrap><nobr>" + duration + "</nobr></td></tr>";
        if(allInclusive.length){
    		s += "<tr><td>Verzorging:</td><td nowrap><nobr>" + allInclusive + "</nobr></td></tr>";
		}
		if(familyRoom.length){
    		s += "<tr><td>&nbsp;</td><td nowrap><nobr>" + familyRoom + "</nobr></td></tr>";
		}
        s += "</tr><tr><td>Vervoer:</td><td nowrap><nobr>" + transport + "</nobr></td></tr>";
		
        if(airportGroupDescription.length){
            s += "<tr><td>&nbsp;</td><td width=180>" + airportGroupDescription + "</td></tr>";
        }
        if(allInPriceText.length > 0)
		{
			s += "<tr><td colspan=2 nowrap><nobr>" + allInPriceText + "</nobr></td></tr></td>";
		}
        s += "<tr><td colspan=2 nowrap><nobr><a onclick=\"setTimeout('openGP()');\" href='" + priceUrl + "' class='linkToolbox'>Klik voor prijsoverzicht</a></nobr></td></tr></td>";
        s += "</table>";
        //alert(s);
        return FormatPopupBaloon(s);
    }
    
    ShowFlashBlocked = false;
    function FlashDisplay(show){
		if(!ShowFlashBlocked){
			fl=document.getElementsByTagName("EMBED");
			for(i=0;i<fl.length;i++){
				fl[i].style.visibility=(show)?'visible':'hidden';
			}
		}
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////    
    /*
        This section facilitates that the popup automatically disappears when the mousepointer leaves
        the area of the control causing the popup or the popup itself, instead of needing a click on
        the page to make the popup disappear.
    */
    ////////////////////////////////////////////////////////////////////////////////////////////////////////    

	var hidePopupTimer = null;

	function hidePopupAfterTimeout()
	{
	    cancelHidePopup();
	    hidePopupTimer = setTimeout("hidePopup()", 700);
	    return true;
	}

	function cancelHidePopup()
	{
	    if(hidePopupTimer)
	    {
	        clearTimeout(hidePopupTimer);
	    }
	    return true;
	}
	
    //////////////////////////////////////////////////////////////////////////////////////////////////////// 
debugstring = "";   
function writedebug(string){
    debugstring+=string;
    document.getElementById("ftr").innerHTML = debugstring;
}

/*
function ShowMessageBox(headerText, message, closeButtonImage)
{
	showSimplePopupCentered("<table class='MessageBoxPopup' cellspacing='0'><tr class='header'><td class='caption'>" + headerText + "</td><td class='close' align='right'><a href='javascript://' onclick='cancelPopup();' class='closeLink'>Sluiten</a> <img src='" + closeButtonImage + "' border='0' style='vertical-align:bottom;cursor:pointer' onclick='cancelPopup();'></td></tr><tr><td colspan='2' class='content'>" + message + "</td></tr></table>");
}
*/

function ShowMessageBox(headerImage, message, closeButtonImage)
{
	showSimplePopupCentered("<table class='MessageBoxPopup' cellspacing='0'><tr class='header'><td class='caption'><img src='" + headerImage + "' border='0' style='vertical-align:bottom;'></td><td class='close' align='right'><a href='javascript://' onclick='cancelPopup();' class='closeLink'>Sluiten</a> <img src='" + closeButtonImage + "' border='0' style='vertical-align:bottom;cursor:pointer' onclick='cancelPopup();'></td></tr><tr><td colspan='2' class='content'>" + message + "</td></tr></table>");
}



