// ----------------------------------------------------------------------
// Browser check for Netscape and Explorer / (C) Poort80 / www.poort80.nl
// 
// ----------------------------------------------------------------------
var na       = navigator.userAgent; // shortcut
var isMac    = (na.indexOf("Mac")!=-1) ? true : false;
// Netscape
var NS4      = (document.layers) ? true : false;
var NS6      = (!document.layers) && (na.indexOf('Netscape')!=-1) ? true : false;
// MS Internet Explorer
var IE4      = ((document.all)&&(na.indexOf("MSIE 4.")!=-1)) ? true : false;
var IE5      = ((document.all)&&(na.indexOf("MSIE 5.")!=-1)) ? true : false;
var IE55     = ((document.all)&&(na.indexOf("MSIE 5.5")!=-1))? true : false;
var IE6      = ((document.all)&&(na.indexOf("MSIE 6.")!=-1)) ? true : false;
// abbreviations
var ver4     = (NS4 || IE4plus) ? true : false;
var IE4plus  = (document.all) ? true : false;
var IE5plus  = IE5 || IE55 || IE6;
var IE55plus = IE55 || IE6;

/* ===================================================================================== */
/* DOM enhanced functions																 */
 
 // -- function gets the previous element of a specific type
 function getPreviousSibling(elm,nodeName)
 {
 	if(nodeName)
 	{
 		nodeName=nodeName.toLowerCase();
 	}
 	else
 	{
 		nodeName=elm.tagName.toLowerCase();
 	}
 	var sibling = elm.previousSibling
 	while(sibling)
 	{
 		if(sibling.nodeName.toLowerCase()==nodeName) return sibling;
 		sibling = sibling.previousSibling;
 	}
 	return sibling;
 }
 // -- function gets the next element of a specific type
 function getNextSibling(elm,nodeName)
 {
 	if(nodeName)
 	{
 		nodeName=nodeName.toLowerCase();
 	}
 	else
 	{
 		nodeName=elm.tagName.toLowerCase();
 	}
 	var sibling = elm.nextSibling;
 	while(sibling)
 	{
 		if(sibling.nodeName.toLowerCase()==nodeName) return sibling;
 		sibling = sibling.nextSibling;
 	}
 	return sibling;
 }

 // -- function gets an element when its a child of a given element
 function getChildElementById(elm,id)
 {
 	for(var i=0; i<elm.childNodes.length;i++)
 	{
 		if(elm.childNodes[i].id==id)
 		{
 			return elm.childNodes[i];
 		}
 	}
 	return;
 }
 
 /* ===================================================================================== */
 /* popupwindow function																	 */
 
 function openInNewWindow(aObj,w,h,attr)
 {
 	var aURL
 	var aTarget = aObj.target;
 	
 	if(aObj.href)
 	{
 		aURL = aObj.href;
 	}
 	else if (typeof(aObj)=="string")
 	{
 		aURL=aObj;
 	}
	else
	{
		aURL="";
	}
	 	
 	//alert(aURL)
	
 	x=(screen.availWidth-w)/2
 	y=(screen.availHeight-h)/2
 	if(aObj.popUpWin)
 	{
 		aWindow = aObj.popUpWin
 		if(!window.aWindow.closed)
 		{ 
 			window.aWindow.close();
 		}
 	}
 	aWindow = window.open(aURL,aTarget,"width="+w+",height="+h+",left="+x+",top="+y+","+(attr ? attr : "location=no,status=yes,menubar=no,scrollbars=yes,resizable=no"))
 	aObj.popUpWin = aWindow;
 }
 
 function submitInNewWindow(fObj,w,h,attr)
 {
 	var fURL = ""
 	var fTarget = fObj.target;
 	x=(screen.availWidth-w)/2
 	y=(screen.availHeight-h)/2
 	if(fObj.popUpWin)
 	{
 		fWindow = fObj.popUpWin
 		if(!window.fWindow.closed)
 		{ 
 			window.fWindow.close();
 		}
 	}
 	fWindow = window.open(fURL,fTarget,"width="+w+",height="+h+",left="+x+",top="+y+","+(attr ? attr : "location=no,status=yes,menubar=no,scrollbars=yes,resizable=no"))
 	fObj.popUpWin = fWindow;
 	
 }
 
 /* ===================================================================================== */
 /* Get cookies set entry																 */
 
 function getCookieSet(cName)
 {
 	var uCookie = unescape(document.cookie)
 	var aCookie = uCookie.split("; ");
 	for (var i=0; i<aCookie.length; i++)
 	{
 		// a name/value pair (a crumb) is separated by an equal sign
 		var aCrumb = aCookie[i].split("=");
 		if (aCrumb[0] == cName && aCrumb[1])
 		{
 			return unescape(aCrumb[1]);
 		}
 	}
 	return false;
 }
 
 /* ===================================================================================== */
 /* For a standaard event handeling the IE way is WAY 									 */
 
 function createEventObj(e)
 {
 	event = e;
 	event.srcElement = e.target;
 	event.offsetX = e.layerX;
 	event.offsetY = e.layerY;
 	event.x = e.clientX;
 	event.y = e.clientY;
 	
 	event.offsetX=Math.floor(event.srcElement.offsetWidth/2);
 	event.offsetY=Math.floor(event.srcElement.offsetHeight/2);
 
 	return event;
 }
 
 /* ===================================================================================== */
 /* Form Functions									 									 */
 
 // -- Form Functions
 function inputFocus(inputObj)
 {
 	if(inputObj.defaultValue==inputObj.value)
 	{
 		inputObj.select();
 	}
 }
 
 function inputBlur(inputObj)
 {
 	if(inputObj.value=="")
 	{
 		inputObj.value=inputObj.defaultValue;
 	}
 }
 
 function inputRadioCheck(radioObj)
 {
 	radioObj.getElementsByTagName('input')[0].click();
 	radioObj.getElementsByTagName('input')[0].focus();
 }
 
 
function inputCheckboxCheck(boxObj,event)
 {
 	if(event && event.target) event.srcElement=event.target
  	if (event.srcElement.type!="checkbox" && boxObj.getElementsByTagName('input')[0].disabled=="")
	{
 		boxObj.getElementsByTagName('input')[0].click();
	 	boxObj.getElementsByTagName('input')[0].focus();
	}
 }
 
 var currentRadioOption = null;
 
 function showOption(id){
 	if(currentRadioOption)
 	{
 		currentRadioOption.style.display="none";
		if(IE5 && !IE55plus) tikkelHTML(currentRadioOption);
 		currentRadioOption = null;
 	}
 	if(id)
 	{
 		obj = document.getElementById(id);
 		if(obj)
 		{
 			obj.style.display="block";
 			if(obj.getElementsByTagName('input').length)
 			{
 				obj.getElementsByTagName('input')[0].focus();
 			} else if(obj.getElementsByTagName('textarea').length)
 			{
 				obj.getElementsByTagName('textarea')[0].focus();
 			}
 			currentRadioOption=obj;
 		}
 	}
 }
 
 
 
 function setSelectbox(selObj)
 {
 	if(selObj.value.length>0){
 		if(selObj.className.indexOf('Selected')<0) selObj.className=selObj.className+"Selected";
 	}
 	else
 	{
 		selObj.className=selObj.className.replace("Selected","");
 	}
}
 
 
function checkSearch(formObj)
{
	for(var set=0,i=0;i<formObj.length;i++)
	{
		if(formObj[i].value!="") set++;
	}
	if(set>0) formObj.submit();
	else alert("U moet minstens 1 zoekoptie geven");
}
 
 /* ===================================================================================== */
 
 var maxAantalBrochures = 2 // default
 var brochureChecked = 0;
 
 function selectBrochure(tdObj)
 {
 	if(tdObj.className=="brochure")
 	{
 		if(brochureChecked<maxAantalBrochures)
 		{
 			tdObj.className="brochureSelect"
 			tdObj.getElementsByTagName('input')[0].checked=true;
 			brochureChecked++
 		}	
 		else
 		{
 			tdObj.getElementsByTagName('input')[0].checked=false;
 			alert("U kunt maximaal "+maxAantalBrochures+" brochures tegelijk aanvragen");
 		}
 	}
 	else
 	{
 		tdObj.className="brochure"
 		tdObj.getElementsByTagName('input')[0].checked=false;
 		brochureChecked--
 	}
 }
 
 function selectZoekInBrochure(tdObj,event)
 {
 	
 	if(event.target) event.srcElement = event.target; // Let Mozilla behave as IE
 	
 	if(event.srcElement.tagName!="INPUT" && event.srcElement.tagName!="DIV")
 	{
 		if(tdObj.className=="brochure")
 		{
 			tdObj.className="brochureSelect"
 			tdObj.getElementsByTagName('input')[0].focus();
 		}
 		else
 		{
 			tdObj.className="brochure"
 			tdObj.getElementsByTagName('input')[0].blur();
 	
 		}
 	}
 	else
 	{
 		return false;
 	}
 }
 
 /* ===================================================================================== */
 
 function openCloseZoekcriteria(dObj)
 {
 	if(dObj.parentNode.className.indexOf('Closed')>-1)
 	{
 		dObj.parentNode.className=dObj.parentNode.className.replace('Closed','Opened')
 	}
 	else
 	{
 		dObj.parentNode.className=dObj.parentNode.className.replace('Opened','Closed')
 	}
 }
 
 /* ===================================================================================== */
 /* TAB function																			 */
 
 function writeTabSet(tabNameList,maxNr,maxRow)
 {
 	var outputHTML = '';
 	var tabNameListLength = (maxNr<tabNameList.length)? maxNr : tabNameList.length;
 	var maxRow = (maxRow)? maxRow : 4
 	if(tabNameListLength<=maxRow)
 	{
 		outputHTML += createTabSet(0,tabNameList,0,tabNameListLength)
 	}
 	else
 	{
 		var bottomSet =	Math.round(tabNameListLength/2);
 		
 		outputHTML += createTabSet(1,tabNameList,bottomSet,tabNameListLength);
 		outputHTML += createTabSet(2,tabNameList,0,bottomSet);
 	}
 	document.write(outputHTML);
 }
 
 function createTabSet(levelNr,tabNameList,start,end)
 {
 	var outputHTML = "";
 	outputHTML +='<div class="tabsLevel'+levelNr+'" id="tabSet'+((levelNr>0)?levelNr:'')+'">\n';
 	outputHTML +='	<table border="0" cellspacing="0" cellpadding="0">\n';
 	outputHTML +='		<tr>\n';
 	for(var i=start;i<end;i++)
 	{
 		outputHTML +='			<td'+((i==0)?' class="active"':'')+' onclick="setTab(this,'+(i+1)+');"><a href="javascript:void(0);" onclick="return false;">'+tabNameList[i]+'</a></td>\n';
 	}
 	outputHTML +='		</tr>\n';
 	outputHTML +='	</table>\n';
 	outputHTML +='</div>\n';
 		
 	return outputHTML
 }
 
 function tikkelHTML(dObj)
 {
 	dObj.innerHTML = dObj.innerHTML;
 }
 
 function setTab(tdObj,idNr)
 {	
 	var aObj=tdObj.childNodes[0];
 	var dObj=tdObj.parentNode.parentNode.parentNode.parentNode
 	
 	// set and reset active tab
 	tdList = dObj.parentNode.getElementsByTagName('td')
 	for(var i=0;i<tdList.length;i++)
 	{
 		if(tdList[i].className=="active")
 		{
 			tdList[i].className="";
 			break;
 		}
 	}
 	tdObj.className="active";
 	
 	//if 2 tablevels check to switch set top to bottom
 	if(dObj.className=="tabsLevel1")
 	{
 		tempObjHTML = document.getElementById('tabSet1').innerHTML;
 		document.getElementById('tabSet1').innerHTML = document.getElementById('tabSet2').innerHTML;
 		document.getElementById('tabSet2').innerHTML = tempObjHTML;
 		
 		document.getElementById('tabSet1').className="tabsLevel1";
 		document.getElementById('tabSet2').className="tabsLevel2";
 	}
 	else
 	{	
 		dActiveObj=dObj;
 	}
 	
 	// show right content
 	divList=dObj.parentNode.getElementsByTagName('div');
 	for(var i=0;i<divList.length;i++)
 	{
 		if(divList[i].className=="tabContentActive")
 		{
 			divList[i].className="tabContent";
 			if(!getChildElementById(divList[i],"priceTable")) tikkelHTML(divList[i]);
 			break;
 		}
 	}
 	document.getElementById('tabContent'+idNr).className="tabContentActive";
 }
 
 
 /* ===================================================================================== */
 /* PRICETABLE tr over function 															 */
 /* ===================================================================================== */
 
 function trOver(trObj)
 {
 	if(trObj.getElementsByTagName('img')[0].src.indexOf('vol')<0)
 	{	
 		trObj.className="trOver";
 	}
 	else
 	{
 		trObj.className="trOverVol";
 	}
 	trObj.onmouseout=function()
 	{
 		this.className="";
 		this.onmouseout=null;
 	}
 }
 
 function trOverLink(trObj,index)
 {
 	trOver(trObj);
 	trObj.onclick=function()
 	{
 		aList = this.getElementsByTagName('a')
 		if(aList.length)
 		{
 			document.location=aList[(index)?index:0];
 		}
 	}
 }
 
 /* ===================================================================================== */
 /* PRICETABLE OVERFLOW																	 */
 /* ===================================================================================== */
 
 var nrOfVisibleEntries = 6;	// default
 var visibleEntriesIndex = 0;
 
 //var entryPriceList = new Array();
 
// var currentNrOfVisibleEntries
 
 function initPriceTable()
 {
	// 	var currentDocWidth = document.body.offsetWidth
 	var currentDocWidth = getCookieSet("currentDocWidth");
 
 	nrOfVisibleEntries = ptDefaultNr
	if(currentDocWidth > 900) nrOfVisibleEntries=pt900Nr;
	if(currentDocWidth > 1020) nrOfVisibleEntries=pt1024Nr;
 
 	//if(ptCurrentNr>nrOfVisibleEntries)
	if(ptDefaultNr<ptCurrentNr)
	{
 
	 	var priceTable = document.getElementById('priceTable');
	 	var subHeader = document.getElementById('sub');
	 	
	 	var tableEntries = subHeader.getElementsByTagName('th');
	 	var nrOfEntries = 0;
	 	
	 	var entryIndex = 0;
	 	
	 	var entryPriceList = new Array();
	 	
	 	entryPriceList[entryIndex] = new Array();
	 	
	 	var i=0;
	 	while((i++)<tableEntries.length)
	 	{
	 		th = tableEntries[i-1];
	 		if(th.className=="days")
	 		{
	 			entryPriceList[entryIndex][entryPriceList[entryIndex].length]=th;
	 		}
	 	}
	 	entryPriceList[++entryIndex] = new Array();
	 	
	 	var tBodies = priceTable.getElementsByTagName('tbody');
	 	var i=0;
	 	while((i++)<tBodies.length)
	 	{
	 		tBody = tBodies[i-1];
	 		
	 		tRows = tBody.getElementsByTagName('tr');
	 		var j=0;
	 		while((j++)<tRows.length)
	 		{
	 			tr = tRows[j-1];
	 	
	 			tDatas = tr.getElementsByTagName('td');
	 			var k=0;
	 			while((k++)<tDatas.length)
	 			{
	 				td = tDatas[k-1];
	 				if(td.className=="price")
	 				{
	 					entryPriceList[entryIndex][entryPriceList[entryIndex].length]=td;
	 				}
	 			}
	 			entryPriceList[++entryIndex] = new Array();
	 		}
	 	}
	 	priceTable.entryPriceList = entryPriceList;
	 	
	 	displayPriceList(0);
	}
 }
 
 function resetPriceList()
 {
 	var entryPriceList=priceTable.entryPriceList;
	
	var priceListButtonPrev = document.getElementById('priceListButtonPrev');
 	var priceListButtonNext = document.getElementById('priceListButtonNext');
	
	for(var i=0;i<entryPriceList.length;i++)
	{
		for(var j=0;j<entryPriceList[i].length;j++)
		{
			entryPriceList[i][j].className=entryPriceList[i][j].className.replace(" hide","");
		}
	}
	
	priceListButtonPrev.style.display="none";
 	priceListButtonNext.style.display="none";

	visibleEntriesIndex=0;
	initPriceTable();
	
 }
 
 function displayPriceList(nr)
 {
 	var priceTable = document.getElementById('priceTable');
 	var entryPriceList =priceTable.entryPriceList;
 	if(visibleEntriesIndex+nr>=0 && visibleEntriesIndex+nrOfVisibleEntries+nr<=entryPriceList[0].length)
 	{
 		var priceListIndexText = document.getElementById('priceListIndexText');
 		var priceListButtonPrev = document.getElementById('priceListButtonPrev');
 		var priceListButtonNext = document.getElementById('priceListButtonNext');
 		
 		visibleEntriesIndex+=nr;
 		for(var i=0;i<entryPriceList.length;i++)
 		{
 			for(var j=0;j<entryPriceList[i].length;j++)
 			{
 				if(j<visibleEntriesIndex || j>=(nrOfVisibleEntries+visibleEntriesIndex))
 				{
 					//entryPriceList[i][j].style.display="none";
 					if(entryPriceList[i][j].className.indexOf(" hide")<0)
 					{
 						entryPriceList[i][j].className+=" hide"
 					}
 				}
 				else
 				{
 					//entryPriceList[i][j].style.display="";
 					entryPriceList[i][j].className=entryPriceList[i][j].className.replace(" hide","");
 				}
 			}
 		}
		
		priceListButtonPrev.style.display="none";
 		priceListButtonNext.style.display="none";
 		if(visibleEntriesIndex==0 && nrOfVisibleEntries+visibleEntriesIndex<entryPriceList[0].length)
 		{
 			priceListButtonNext.style.display="inline";
 		}
 		else if(visibleEntriesIndex>0 && nrOfVisibleEntries+visibleEntriesIndex==entryPriceList[0].length)
 		{
 			priceListButtonPrev.style.display="inline";
 		}
 		else if(visibleEntriesIndex>0 && nrOfVisibleEntries+visibleEntriesIndex<entryPriceList[0].length)
 		{
 			priceListButtonPrev.style.display="inline";
 			priceListButtonNext.style.display="inline";
 		}
		
 		/*
 		var thOutput = "";
 		thSet = entryPriceList[0]
 		
 		for(var i=0;i<thSet.length;i++)
 		{
 			if(i==visibleEntriesIndex)
 			{
 				thOutput += " <strong>[ "
 			}
 			
 			thOutput +=thSet[i].innerHTML+((i+1<thSet.length)?" ":"");
 			
 			if(i==(nrOfVisibleEntries+visibleEntriesIndex-1))
 			{
 				thOutput += " ]</strong> "
 			}
 		}
 		
 		priceListIndexText.innerHTML=thOutput+" daags";
 		*/
 	}
 }
 
 /* ===================================================================================== */
 /* NAV functions																		 */
 /* ===================================================================================== */
 
 var currentMainNav=null;
 var currentSubNav=null;
 
 var navIsOpen=false;
 
 var navCloseID=null;
 
 var dummyIframe
 
 function showNav(aObj,subNavId,mOver)
 {
 	if((currentSubNav && mOver) || !(currentSubNav || mOver))
 	{
 		if(!navIsOpen){
 			bodyObj = document.getElementById('body')
			
			if(currentMainNav)
 			{
 				currentMainNav.className="subMenu";
 			}
 			if(currentSubNav)
 			{
 				currentSubNav.style.visibility="hidden";
 			}
 			
 			if(subNavId)
 			{
 				subNavObj = document.getElementById(subNavId);
				
				 if(subNavObj)
 				{
 					subNavObj.style.left=(bodyObj.offsetLeft+aObj.offsetLeft)+"px";
								
					// IE/WIN Hide selectbox before opening nav
					if(document.all && !isMac)
					{
						if(dummyIframe==null)
						{
							dummyIframe = document.createElement("IFRAME");
							dummyIframe.style.top=(subNavObj.offsetTop)+"px";
							dummyIframe.style.position="absolute";
							dummyIframe.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";
							subNavObj.parentNode.insertBefore(dummyIframe,subNavObj)
						}
						dummyIframe.style.left=(bodyObj.offsetLeft+aObj.offsetLeft)+"px";
						dummyIframe.style.width=(subNavObj.offsetWidth-4)+"px";
						dummyIframe.style.height=(subNavObj.offsetHeight-15)+"px";
						dummyIframe.style.display="block";
					
						/*selectList = document.getElementById("ZoekEnBoek").getElementsByTagName("select");
						for(var i=0;i<selectList.length;i++)
						{
							selectList[i].style.visibility="hidden";
						}*/	
					}
													
 					aObj.className="subMenuActive";
 					subNavObj.style.visibility="visible";
					 										
 					currentMainNav=aObj;
 					currentSubNav=subNavObj;
					 				
 					document.onmouseup = function(e)
 					{
 						if(e) event = createEventObj(e);
 						
 						if(event.srcElement.className!="delete") // check weither the delete button is pushed
 						{
 					//lCurrentMainNav=currentMainNav;
 							if(event.srcElement==currentMainNav)
 							{ 
 								navIsOpen=true;
 							}
 							currentMainNav.className="subMenu";
 							currentSubNav.style.visibility="hidden";
 							currentMainNav=null;
 							currentSubNav=null;
 							document.onmouseup = null;
							
							// IE/WIN show selectbox after closing nav
							if(document.all && !isMac)
							{
								dummyIframe.style.display="none";
								/*
								var selectList = document.getElementById("ZoekEnBoek").getElementsByTagName("select");
								for(var i=0;i<selectList.length;i++)
								{
									selectList[i].style.visibility="visible";
								}
								*/
							}
 						}
 					}
 				}
 			}
 		}
 		else
 		{
 			navIsOpen=false;
 		}
 	}
 }
 

 /* ======================================= */
 preLoadImageSet = new Array();
 
 function preLoadImages(imgList)
 {
 	for(var i=0; i<imgList.length; i++)
 	{
		if (typeof(imgList[i])=="string"){
			imgObj = new Image();
	 		imgObj.src = imgList[i];
	 		preLoadImageSet[preLoadImageSet.length]=imgObj;
			//alert("geladen: " + imgList[i] )
		} else {
 			 //alert("NIET geladen: " +imgList[i])
			 if (typeof(imgList[i][0])=="string"){
				imgObj = new Image();
		 		imgObj.src = imgList[i][0];
	 			preLoadImageSet[preLoadImageSet.length]=imgObj;
				// alert("geladen: " + imgList[i][0])
			} 
		}
 	}
 }
 				
 /* ===================================================================================== */
 /* FOTO Slideshow																		 */
 
 function slider(endPos)
 {
 	this.style.left = parseInt(this.offsetLeft +(endPos-this.offsetLeft)*0.3)+"px";
 	if(this.offsetLeft==endPos) return true;
 	else return false;
 }
 
 function moveSlide(fotoShowObj)
 {
 	
 	if(fotoShowObj.slideObj.slideTo(0))
 	{
 		clearInterval(fotoShowObj.slideID);
 		fotoShowObj.slideID=null;
 		//fotoShowObj.fotoObj.style.backgroundImage="url("+fotoShowObj.fotoList[fotoShowObj.fotoIndex][0]+")";
		fotoShowObj.fotoObj.getElementsByTagName("img")[0].src=fotoShowObj.fotoList[fotoShowObj.fotoIndex][0];
		fotoShowObj.fotoObj.getElementsByTagName("img")[0].width=fotoShowObj.slideObj.offsetWidth;
 		fotoShowObj.slideObj.style.left=fotoShowObj.slideObj.offsetWidth+"px";
 		fotoShowObj.fotoNrObj.innerHTML=(fotoShowObj.fotoIndex+1)+"/"+fotoShowObj.fotoList.length;
 	}
 }
 	
 function volgendeFoto(id)
 {
 	fotoShowObj = getFotoShowObj(id);
 	
 	if(!fotoShowObj.slideID)
 	{
 		if(++fotoShowObj.fotoIndex>=fotoShowObj.fotoList.length) fotoShowObj.fotoIndex=0;
 		
 		fotoShowObj.slideObj.style.left=fotoShowObj.slideObj.offsetWidth+"px";

 		fotoShowObj.slideObj.innerHTML="<img src=\""+fotoShowObj.fotoList[fotoShowObj.fotoIndex][0]+"\" width=\""+fotoShowObj.slideObj.offsetWidth+"\" />";
 		
 		// indien er geen grote versie is hide zoom button
 		if(fotoShowObj.fotoList[fotoShowObj.fotoIndex][1]){
 			fotoShowObj.zoomButton.style.display="inline";		
 		}
 		else
 		{
 			fotoShowObj.zoomButton.style.display="none";		
 		}
 		
 		showImage(fotoShowObj,fotoShowObj.fotoList[fotoShowObj.fotoIndex][0]);
 		/*
 		preloadObj = new Image();
 		preloadObj.src=fotoShowObj.fotoList[fotoShowObj.fotoIndex][0];
 		preloadObj.onload = function()
 		{
 			fotoShowObj.slideID = setInterval('moveSlide(fotoShowObj)',30);
 		}*/
 	}
 }
 function vorigeFoto(id)
 {
 	fotoShowObj = getFotoShowObj(id);
 	
 	if(!fotoShowObj.slideID)
 	{
 		if(--fotoShowObj.fotoIndex<0 ) fotoShowObj.fotoIndex=fotoShowObj.fotoList.length-1;
 		
 		fotoShowObj.slideObj.style.left=-fotoShowObj.slideObj.offsetWidth+"px";
 		fotoShowObj.slideObj.innerHTML="<img src=\""+fotoShowObj.fotoList[fotoShowObj.fotoIndex][0]+"\" width=\""+fotoShowObj.slideObj.offsetWidth+"\" />";
 		
 		// indien er geen grote versie is hide zoom button
 		if(fotoShowObj.fotoList[fotoShowObj.fotoIndex][1]){
 			fotoShowObj.zoomButton.style.display="inline";		
 		}
 		else
 		{
 			fotoShowObj.zoomButton.style.display="none";		
 		}
 		showImage(fotoShowObj,fotoShowObj.fotoList[fotoShowObj.fotoIndex][0]);
 		/*
 		preloadObj = new Image();
 		preloadObj.src=fotoShowObj.fotoList[fotoShowObj.fotoIndex][0];
 		preloadObj.onload = function()
 		{
 			fotoShowObj.slideID = setInterval('moveSlide(fotoShowObj)',30);
 		}*/
 	}
 }
 
 function showImage(fotoShowObj,fotoSrc)
 {
 	var preloadObj = new Image();
 	preloadObj.onload = function()
 	{
 		fotoShowObj.slideID = setInterval('moveSlide(fotoShowObj)',30);
 	}
 	preloadObj.src=fotoSrc;
 }
 
 /* ===================================================================================== */
 /* HTML     																			 */

 htmlHeader =  '<?xml version="1.0" encoding="UTF'+'-8"?>\n';
 htmlHeader += '<!DOCTYPE html ';
 htmlHeader += ' PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\n';
 htmlHeader += '  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n';
 htmlHeader += '<html xmlns="http://www.w3.org/1999/xhtml" \n';
 htmlHeader += '	  xml:lang="en" \n';
 htmlHeader += '	  lang="en">\n';
 htmlHeader += '<head>\n';
 htmlHeader += '	<title>Foto slideshow</title>\n';
 htmlHeader += '	<meta http-equiv="Content-Type" content="text/html; charset=UTF'+'-8" />\n';
 htmlHeader += '	<meta http-equiv="Content-Language" content="nl" />\n';
 htmlHeader += '	\n';
 htmlHeader += '	<meta http-equiv="Content-Style-Type" content="text/css" />\n';
 htmlHeader += '	<meta http-equiv="Content-Script-Type" content="text/javascript" />\n';
 htmlHeader += '	\n';
 htmlHeader += '	<meta http-equiv="imagetoolbar" content="no" />\n';
 htmlHeader += '	<meta http-equiv="MSThemeCompatible" content="no" />\n';
 htmlHeader += '	<meta name="MSSmartTagsPreventParsing" content="true" />\n';
 htmlHeader += '	\n';
 htmlHeader += '	<link href="css/common_style.css" charset="ISO-8859-1" rel="stylesheet" type="text/css" />\n';
 
 htmlFooter = '</body>\n';
 htmlFooter += '</html>\n';
 
 /* ===================================================================================== */
 /* FOTO ZOOM																			 */
 
 htmlZoomHeader = '	<script type="text/javascript" src="scripts/photoalbum.js"></script>\n'
 
 winObj = new Object();
 
 function zoomImage(index,fotoList)
 {
 	if(index<0)
 	{
 		imgTitle = fotoList[2];
 		imgSrc = fotoList[1];
 	}
 	else
 	{
 		id = index;
 		fotoShowObj = fotoShowObjList[id];
 		index = fotoShowObj.fotoIndex;
 		fotoList = new Array();
 		for(var i=0;i<fotoShowObj.fotoList.length;i++)
 		{
 			if(fotoShowObj.fotoList[i][1]){
 				fotoList[fotoList.length] = fotoShowObj.fotoList[i];
 			}
 			else
 			{
 				if(i<=index) index--
 			}
 		}
 		imgTitle = fotoList[index][2];
 		imgSrc = fotoList[index][1];
 	}
 
  	htmlGenerated = '</head>\n';	
 	htmlGenerated += '<body class="zoomImage" id="zoomImageBody">\n';
 	
 	htmlGenerated += '<div class="navSet">\n';
 	htmlGenerated += '<h1 class="fotoTitle" id="fotoTitle">'+imgTitle+'</h1>\n';
 	
 	htmlGenerated += '<div class="buttonRight"><a href="javascript:void(0);" onclick="window.close();return false;"><img src="gfx/button_sluit_venster.gif" width="96" height="17" alt="" border="0" /></a></div>\n';
 	
 	if(index>=0)
 	{
 
 		htmlGenerated += '<script type="text/javascript">\n';
 		htmlGenerated += '	fotoList= new Array();\n';
 		for(var i=0;i<fotoList.length;i++)
 		{
 			htmlGenerated += '	fotoList['+i+']= new Array();\n';
 			for(var j=0;j<fotoList[i].length;j++){
 				htmlGenerated += '	fotoList['+i+']['+j+']="'+fotoList[i][j]+'";\n\n';
 			}
 		}
 		htmlGenerated += '	fotoIndex='+index+';\n';
 		htmlGenerated += '</script>\n';
 
 		htmlGenerated += '<div class="fotoNav" id="fotoNav">\n';
 		htmlGenerated += '<table border="0" cellspacing="0" cellpadding="0">\n';
 		htmlGenerated += '	<tr>\n';
 		htmlGenerated += '		<td><a href="javascript:void(0);" onclick="vorigeFoto();return false;"><img src="gfx/button_foto_vorige.gif" width="17" height="17" alt="" border="0" /></a></td>\n';
 		htmlGenerated += '		<td class="fotoNr" id="fotoNr">'+(index+1)+'/'+fotoList.length+'</td>\n';
 		htmlGenerated += '		<td><a href="javascript:void(0);" onclick="volgendeFoto();return false;"><img src="gfx/button_foto_volgende.gif" width="17" height="17" alt="" border="0" /></a></td>\n';
 		htmlGenerated += '		<td><a href="javascript:void(0);" onclick="viewAll();return false;" class="viewAll"><img class="viewAll" src="gfx/button_view_all.gif" width="17" height="17" alt="" border="0" /></a></td>\n';
 		htmlGenerated += '	</tr>\n';
 		htmlGenerated += '</table>\n';
 		htmlGenerated += '</div>\n';
 	}
 	
 	htmlGenerated += '</div>\n';
 
 	htmlGenerated += '<table border="0" cellspacing="0" cellpadding="0" class="imageContainer">\n';
 	htmlGenerated += '	<tr>\n';
 	if(imgSrc.indexOf(".swf")<0)
 	{
 		htmlGenerated += '		<td class="imageContainer" id="foto" style="filter:blendTrans(duration=2)"><img src="'+imgSrc+'" border="0" onload="if(this.width>this.height && this.width>500)this.width=500;else if(this.height>500)this.height=500;" /></td>\n';
 	}
 	else
 	{
 		htmlGenerated += '		<td class="imageContainer" id="foto">';
 		htmlGenerated += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="500" height="500">';
 
 htmlGenerated += '<param name="movie" value="'+imgSrc+'">';
 htmlGenerated += '<param name="quality" value="high">';
 htmlGenerated += '<param name="bgcolor" value="#ffffff">';
 htmlGenerated += '<param name="wmode" value="transparent">';
 htmlGenerated += '<param name="scale" value="showall">';
 htmlGenerated += '<param name="salign" value="mb">';
 htmlGenerated += '<embed src="'+imgSrc+'" quality="high" bgcolor="#ffffff" width="500" height="500" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>';
 htmlGenerated += '</object></td>\n';
 		
 	}
 	htmlGenerated += '	</tr>\n';
 	htmlGenerated += '</table>\n';
 	
 	openInNewWindow(this,520,400);
 	if(this.popUpWin)
	{
		this.popUpWin.document.write(htmlHeader+htmlZoomHeader+htmlGenerated+htmlFooter);
 		this.popUpWin.document.close();
	}
	else
	{
		alert("Attentie: U heeft vermoedelijk een pop-up beveiliging geinstalleerd op uw computer.\nOm een vergroting te zien dient u de beveiliging tijdelijk uit te schakelen!");
	}
 	
 }
 
 htmlWorldHeader = '<script type="text/javascript" src="scripts/worldmap.js"></script>\n'
 htmlWorldHeader += '<script src="scripts/worldmap.vbs" type="text/vbscript"></script>\n'
 
 function popupMap(fileName,zoomID,areaId)
 {
 	var htmlGenerated = '</head>\n';
 	
 	htmlGenerated += '<body class="worldmap">\n';
 	htmlGenerated += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"\n';
 	htmlGenerated += '	codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"\n';
 	htmlGenerated += '	width="510" height="275" \n';
 	htmlGenerated += '	id="map">\n';
 	htmlGenerated += '	<param name="movie" value="/wsinc/swf/map.swf" />\n';
 	htmlGenerated += '	<param name="flashvars" value="file='+appServer+'reis.nu/'+fileName+((zoomID)?'&zoomid='+zoomID:'')+((areaId)?'&mapid='+areaId:'')+((sessionString.length>0)?'&'+sessionString:'')+'" />\n';
 	htmlGenerated += '	<param name="quality" value="high" />\n';
 	htmlGenerated += '	<embed src="/wsinc/swf/map.swf"\n';
 	htmlGenerated += '	  	 flashvars="file='+appServer+'reis.nu/'+fileName+((zoomID)?'&zoomid='+zoomID:'')+((areaId)?'&mapid='+areaId:'')+((sessionString.length>0)?'&'+sessionString:'')+'"\n';
 	htmlGenerated += '	  	 width="510" height="275"\n';
 	htmlGenerated += '	  	 id="eMap"\n';
 	htmlGenerated += '	  	 quality="high"\n';
 	htmlGenerated += '	  	 liveconnect="true"\n';
 	htmlGenerated += '	  	 type="application/x-shockwave-flash"\n';
 	htmlGenerated += '	  	 pluginspage="http://www.macromedia.com/go/getflashplayer">\n';
 	htmlGenerated += '	</embed>\n';
 	htmlGenerated += '</object>\n';
 	htmlGenerated += '	<div class="mapInterface">\n';
 	htmlGenerated += '	<a href="javascript:void(0);" onclick="window.close();return false;"><img class="buttonRight" src="gfx/button_sluit_venster.gif" width="96" height="17" alt="" border="0" /></a>'
 	htmlGenerated += '		<a href="javascript:void(0);" onclick="return false;" onmousedown="zoomMap(zAll);"><img src="gfx/button_map_all.gif" width="25" height="17" alt="" border="0" /></a><a href="javascript:void(0);" onclick="return false;" onmousedown="zoomMap(\'nl\');"><img src="gfx/button_map_nl.gif" width="17" height="17" alt="" border="0" /></a>\n';
 	htmlGenerated += '<a href="javascript:void(0);" onclick="return false;" onmousedown="zoomMap(zOut);"><img src="gfx/button_zoom_out.gif" width="17" height="17" alt="" border="0" /></a><a href="javascript:void(0);" onclick="return false;" onmousedown="zoomMap(zIn);"><img src="gfx/button_zoom.gif" width="17" height="17" alt="" border="0" /></a>\n';
 
 	htmlGenerated += '<a href="javascript:void(0);" onclick="return false;" onmousedown="moveMap(this,\'l\');"><img src="gfx/button_map_left.gif" width="17" height="17" alt="" border="0" /></a><a href="javascript:void(0);" onclick="return false;" onmousedown="moveMap(this,\'r\');"><img src="gfx/button_map_right.gif" width="17" height="17" alt="" border="0" /></a><a href="javascript:void(0);" onclick="return false;" onmousedown="moveMap(this,\'t\');"><img src="gfx/button_map_up.gif" width="17" height="17" alt="" border="0" /></a><a href="javascript:void(0);" onclick="return false;" onmousedown="moveMap(this,\'b\');"><img src="gfx/button_map_down.gif" width="17" height="17" alt="" border="0" /></a>\n';
 htmlGenerated += '<span id="countryName"></span>\n';
 htmlGenerated += '</div>\n';
 	
 	openInNewWindow(this,510,298,"location=no,status=no,menubar=no,scrollbars=yes,resizable=no");
 	if(this.popUpWin)
	{
		this.popUpWin.document.write(htmlHeader+htmlWorldHeader+htmlGenerated+htmlFooter);
 		this.popUpWin.document.close();
	}
	else
	{
		alert("Attentie: U heeft vermoedelijk een pop-up beveiliging geinstalleerd op uw computer.\nOm de kaart te kunnen zien dient u de beveiliging tijdelijk uit te schakelen!")
	}
 }
 

function writeAgencyMap(swfSrc)
{

var agencyMapIframe = document.frames["agencyMap"];
var htmlGenerated = '<script type="text/javascript">function goTo(url){if(parent.goTo)parent.goTo(url);}</script>\n'

htmlGenerated += '</head>\n';	
htmlGenerated += '<body class="agencyMap">\n';

htmlGenerated += '<object id="tripmap" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="283" height="346">\n';
htmlGenerated += '<param name="movie" value="'+swfSrc+'" />\n';
htmlGenerated += '<param name="quality" value="high" />\n';
htmlGenerated += '<param name="bgcolor" value="#fff" />\n';
htmlGenerated += '<param name="scale" value="noscale" />\n';
htmlGenerated += '<param name="salign" value="lt" />\n';
htmlGenerated += '<param name="menu" value="false" />\n';
htmlGenerated += '<embed src="'+swfSrc+'" quality="high" scale="noscale" menu="false" bgcolor="#ffffff" salign="lt" width="283" height="346" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object>\n';

	agencyMapIframe.document.write(htmlHeader+htmlGenerated+htmlFooter);
	agencyMapIframe.document.close();
} 
 
 function popupWindow(contentId,width,height)
 {
 	if(!width) var width=340;
 	if(!height) var height=345;
 
 	var htmlGenerated = '</head>\n';
 	
 	htmlGenerated += '<body class="help">\n';
 	htmlGenerated += '	<table border="0" cellspacing="0" cellpadding="0" class="solid">\n';
 	htmlGenerated += '		<tr>\n';
 	htmlGenerated += '			<td class="top">\n';
 	htmlGenerated += '				<div class="default headless">\n';
 	htmlGenerated += '					<div class="cornerSolid"></div>\n';
 	htmlGenerated += '					<div class="content">\n';
 	
 	htmlGenerated += document.getElementById(contentId).innerHTML+"\n";
 	
 	htmlGenerated += '					</div>\n';
 	htmlGenerated += '				</div>\n';
 	htmlGenerated += '			</td>\n';
 	htmlGenerated += '		</tr>\n';
 	htmlGenerated += '		<tr>\n';
 	htmlGenerated += '			<td class="bottom">\n';
 	htmlGenerated += '				<div class="default headless">\n';
 	htmlGenerated += '					<div class="content">\n';
 	htmlGenerated += '						<div class="topDotted">\n';
 	htmlGenerated += '							<div class="buttonRight">\n';
 	htmlGenerated += '								<a href="javascript:void(0);" onclick="window.close();return false;"><img src="gfx/button_sluit_venster.gif" width="96" height="17" alt="" border="0" /></a>\n';
 	htmlGenerated += '							</div>\n';
 	htmlGenerated += '						</div>\n';
 	htmlGenerated += '					</div>\n';
 	htmlGenerated += '				</div>\n';
 	htmlGenerated += '			</td>\n';
 	htmlGenerated += '		</tr>\n';
 	htmlGenerated += '	</table>\n';	
 	
 	openInNewWindow(this,width,height);
 
 	if(this.popUpWin)
	{
		this.popUpWin.document.write(htmlHeader+htmlGenerated+htmlFooter);
 		this.popUpWin.document.close();
	}
	else
	{
		alert("Attentie: U heeft vermoedelijk een pop-up beveiliging geinstalleerd op uw computer.\nOm dit venster te kunnen zien dient u de beveiliging tijdelijk uit te schakelen!")
	}
 }
 
 function showAllAgencies()
 {
 	agencyList = document.getElementById("agencies").getElementsByTagName("div")
	for(var i=0;i<agencyList.length;i++)
	{
		if(agencyList[i].className=="agencyBlock") 
		{
			agencyList[i].style.display="block";
		}
	} 
	document.getElementById("allAgencies").style.display="none"
 }
 
 
 /* ===================================================================================== */
 /* SWF																					 */
 var currentAgency = null;
 
 function goTo(swfURL)
 {
 	if(swfURL.indexOf("#")==0)
 	{
		agencyId = swfURL.substring(1,swfURL.length);
 		currentAgency = document.getElementById(agencyId);
		if(currentAgency)
		{
			agencyList = document.getElementById("agencies").getElementsByTagName("div")
			for(var i=0;i<agencyList.length;i++)
			{
				if(agencyList[i].className=="agencyBlock") 
				{
					agencyList[i].style.display="none";
				}
			} 
 			currentAgency.style.display="block";
			document.getElementById("allAgencies").style.display="block"
		}
 	}
 	else
 	{
 		window.open(swfURL,"_blank");
 	}
 }
 	
 
 /* ===================================================================================== */
 /* CLIP IT																				 */
 
 function getAbsoluteLeft(obj){
 	var pos = 0;
 	var tempObj = obj
 	do{
 		pos += tempObj.offsetLeft
 		tempObj = tempObj.offsetParent
 	}while(tempObj);
 	
 	return pos;
 }
 function getAbsoluteTop(obj){
 	var pos = 0;
 	var tempObj = obj
 	do{
 		pos += tempObj.offsetTop
 		tempObj = tempObj.offsetParent
 	}while(tempObj);
 	
 	return pos;
 }
 
 clipItSteps = 12;
 var clipItList = new Array();
 
 function addClipIt(clipItObj,clipItType,clipItTitle)
 {
 	var clipItId
 	var clipItNav = document.getElementById("reisgids");
 	var clipItEntries = document.getElementById("reisgidsEntries");
 	
 	if(clipItObj.className.indexOf('Added')<0)
 	{
 		clipItObj.className=clipItObj.className+"Added";
 		clipItId=clipItObj.id.substr(2);
 	
 		//prepare clipIt ghost to move to reisgids
 		clipItGhost = document.createElement('DIV');
 		clipItGhost.innerHTML='<img src="gfx/clip-it_trip.gif" border="0" />';
 		//clipItGhost.innerHTML='<img src="gfx/clip-it_trip.gif" width="25" border="0" />';
 		clipItGhost.style.position="absolute";
 		
 		clipItGhost.style.left = getAbsoluteLeft(clipItObj)+2+"px";
 		clipItGhost.style.top = getAbsoluteTop(clipItObj)+3+"px";
 		
 		document.body.appendChild(clipItGhost);
 			
 		//position clipIt ghost on clipIt spot
 		clipItGhost.endLeft = (clipItGhost.offsetLeft-(getAbsoluteLeft(clipItGhost)-getAbsoluteLeft(clipItNav)))+10;
 		clipItGhost.endTop = (clipItGhost.offsetTop-(getAbsoluteTop(clipItGhost)-getAbsoluteTop(clipItNav)))+10;
 		
 		clipItGhost.stepsLeft=(clipItGhost.endLeft-clipItGhost.offsetLeft)/clipItSteps;
 		clipItGhost.stepsTop=(clipItGhost.endTop-clipItGhost.offsetTop)/clipItSteps;
 		
 		//add clipIt info to ghost
 		clipItGhost.clipItId=clipItId;
 		clipItGhost.clipItType=clipItType;
 		clipItGhost.clipItTitle=clipItTitle;
 		
 		//move clipIt ghost
 		setTimeout("moveObject(clipItGhost)",10);
 		
 		/*	setTimeout("clipItGhost.removeNode(true)",300);*/
 	}
 }
 
 function moveObject(mObj)
 {
 	lMObj = mObj;
 	
 	mObj.style.left = parseInt(mObj.offsetLeft+mObj.stepsLeft)+"px";
 	mObj.style.top = parseInt(mObj.offsetTop+mObj.stepsTop)+"px";
 
 	if(mObj.endLeft>=mObj.offsetLeft && mObj.offsetTop>10)
 	{	
 		setTimeout("moveObject(lMObj)",20);
 	}
 	else
 	{
 		if(clipItList.length==0)
 		{
 			if(document.getElementById('reisgids').click)document.getElementById('reisgids').click();
 		}
 		clipItList[clipItList.length] = [lMObj.clipItId,lMObj.clipItType,lMObj.clipItTitle];
 		refreshReisgids(clipItList);
		
		mObj.parentNode.removeChild(mObj);
 	}
 }
 
 /* ==================================*/
 function deleteAllClipIts()
 {
 	do
 	{
 		deleteClipIt(clipItList[0][0]);
 	}while(clipItList.length)
 }
 
 
 function deleteClipIt(cID)
 {
 	clipItID = "c_"+cID
 	if(document.getElementById(clipItID))
 	{
 		document.getElementById(clipItID).className = document.getElementById(clipItID).className.replace("Added","");
 	}
 	clipItList = removeClipItEntry(clipItList,cID);
 	refreshReisgids(clipItList);
 }
 
 function removeClipItEntry(obj,cID)
 {
 	temp = new Array()
 	for(var i=0;i<obj.length;i++)
 	{
 		if(obj[i][0]!=cID) temp[temp.length]=obj[i];
 	}
 	return temp;
 }

 function refreshReisgids(clipItList)
 {
 	reisgidsInfoObj = document.getElementById("reisgidsInfo");
 	reisgidsOptionsObj = document.getElementById("reisgidsOptions");
 	clipItEntries = document.getElementById("reisgidsEntries");
 	
 	if(clipItEntries && reisgidsInfoObj)
 	{
 		var clipItId;
 		var	clipItType;
 		var	clipItTitle;
 	
 		var EntriesStr = "";
 		var EntriesCountStr = "[0]";
 		var clipItCookieStr = "";
 		
 		if(clipItList && clipItList.length)
 		{
 			reisgidsInfoObj.style.display = "none";
 			reisgidsOptionsObj.style.display = "block";
 			
 			clipItCookieStr += "["
 			for(var i=0;i<clipItList.length;i++)
 			{
 				clipItId=clipItList[i][0];
 				clipItType=clipItList[i][1];
 				clipItTitle=clipItList[i][2];
 				
 				EntriesStr += createClipItEntry(clipItId,clipItType,clipItTitle);
 				
 				clipItCookieStr+= "[\""+clipItId+"\",\""+clipItType+"\",\""+clipItTitle+"\"],";
 			}
 			clipItCookieStr = clipItCookieStr.substring(0,clipItCookieStr.length-1); // remove last comma
 			clipItCookieStr += "]";
 	
 			EntriesCountStr = "["+clipItList.length+"]";
 		}
 		else
 		{
 			reisgidsInfoObj.style.display = "block";
 			reisgidsOptionsObj.style.display = "none";
 		}
 		document.getElementById("entries").innerHTML = EntriesCountStr;
 		document.cookie = "clipIt="+clipItCookieStr +"; expires=Fri, 31 Dec 2010 23:59:59 GMT;path=/";

		//alert(document.cookie)
 		clipItEntries.innerHTML = EntriesStr;
 	}
 }
 
 function addSavedClipIts(clipItList)
 {
 	if(clipIts)
	{
	
		for(var i=0;i<clipIts.length;i++)
		{
			clipItList[clipItList.length] = clipIts[i];
		}
	}

	if(clipItList.length)
	{
		var clipItCookieStr = "";
		clipItCookieStr += "[";
		
		var clipItCheckObj = {};
		for(var i=0;i<clipItList.length;i++)
		{
			clipItId=clipItList[i][0];
			clipItType=clipItList[i][1];
			clipItTitle=clipItList[i][2];
			if(!clipItCheckObj[clipItId])
			{
				clipItCheckObj[clipItId]=true;
				clipItCookieStr+= "[\""+clipItId+"\",\""+clipItType+"\",\""+clipItTitle+"\"],";
			}
		}
		clipItCookieStr = clipItCookieStr.substring(0,clipItCookieStr.length-1); // remove last comma
		clipItCookieStr += "]";
	
		document.cookie = "clipIt="+clipItCookieStr;
		clipIts = eval(clipItCookieStr);
	}
 }
 

 function createClipItEntry(id,type,name)
 {
 	var clipItURL
 	switch(type)
 	{
 		case "T":
 			clipItURL = "trip.xml?tripid="+id
 			break;
 		case "R":
 			clipItURL = "reportview.xml?tripreportid="+id
 			break;
 		case "P":
 			clipItURL = "photoview.xml?albumid="+id
 			break;
 		case "TT":
 			clipItURL = "triptype.xml?triptype="+id
 			break;
 		case "TH":
 			clipItURL = "theme.xml?themeid="+id
 			break;
 		case "A":
 			clipItURL = "country.xml?areaid="+id
 			break;			
 			
 	}
 	return '<a href="'+pageServer+clipItURL+ ((sessionString.length>0)?'&'+sessionString:'') + '" class="type'+type+'"><img onclick="deleteClipIt(\''+id+'\');return false;" class="delete" src="gfx/button_delete.gif" width="11" height="11" alt="" border="0" />'+name+'</a>'
 }
 
 function saveClipIts()
 {
 	var i=0
 	queryStr = "?id"+i+"="+clipItList[i][0];
 	queryStr+="&type"+i+"="+clipItList[i++][1];
 	for(;i<clipItList.length;i++)
 	{
 		queryStr+="&id"+i+"="+clipItList[i][0];
 		queryStr+="&type"+i+"="+clipItList[i][1];
 	}
 	document.location=pageServer+'mymenu.xml'+queryStr+((sessionString.length>0)?'&'+sessionString:'');	
 }
 
function printClipIts()
 {
 	var i=0
 	queryStr = "?id"+i+"="+clipItList[i][0];
 	queryStr+="&type"+i+"="+clipItList[i++][1];
 	for(;i<clipItList.length;i++)
 	{
 		queryStr+="&id"+i+"="+clipItList[i][0];
 		queryStr+="&type"+i+"="+clipItList[i][1];
 	}
 	document.location=pageServer+'myprint.xml'+queryStr+((sessionString.length>0)?'&'+sessionString:'');	
 }
 
 /* ======================================== */
 function writeClipIt(id,type,title)
 {
 	var altText ="Voeg toe aan mijn reisgids";
 	document.write("<img id=\"c_"+id+"\" class=\"tripClipIt"+((clipItInList(id))?"Added":"")+"\" src=\"gfx/spacer.gif\" onclick=\"addClipIt(this,'"+type+"','"+title+"');\" width=\"17\" height=\"17\" alt=\""+altText+"\" border=\"0\" />");
 }

 function writeNumberOfClipIts()
 {
 	if(clipIts)
 	{
 		clipItList = eval(clipIts);
 		document.write("["+clipItList.length+"]");
 	}
 	else
 	{
 		document.write("[0]");
 	}
 }
 
 function writeClipItList()
 {
 	var reisgidsInfoObj = document.getElementById("reisgidsInfo");
 	var reisgidsOptionsObj = document.getElementById("reisgidsOptions");
 	if(clipIts)
 	{
 		reisgidsInfoObj.style.display = "none";
 		reisgidsOptionsObj.style.display = "block";
 	
 		var clipItList = eval(clipIts);
 		var clipItOutput = ""
 		for(var i=0;i<clipItList.length;i++)
 		{
 			clipItId=clipItList[i][0];
 			clipItType=clipItList[i][1];
 			clipItTitle=clipItList[i][2];
 			
 			clipItOutput += createClipItEntry(clipItId,clipItType,clipItTitle);
 		}
 	}
 	else
 	{
 		reisgidsInfoObj.style.display="block";
 		reisgidsOptionsObj.style.display="none";
 	}
 	document.write(clipItOutput);
 }
 
 /* --------------------------------------- */
 
 function clipItInList(id)
 {
 	if(clipIts)
 	{
 		clipItList = eval(clipIts);
 		for(var i=0;i<clipItList.length;i++)
 		{
 			if(clipItList[i][0]==id) return true;
 		}
 	}
 	return false;
 }
 /* ===================================================================================== */
 /* == WINDOW EVENTS ==================================================================== */
 /* ===================================================================================== */	

 /* == REISGIDS Variables =========================== */
 var clipIts = eval(getCookieSet("clipIt"));
 
  /* == SLIDESHOW Variables =========================== */
 
 fotoShowObjList = new Object();
 
 // -- after a tab innerHTML switch the elements get lost, so they have to be initialized
 function getFotoShowObj(id)
 {
 	fotoShowObj = fotoShowObjList[id];
 
 	fotoShowObj.fotoObj=document.getElementById('fotoStill_'+id);
 	fotoShowObj.fotoNrObj=document.getElementById('fotoNr_'+id);
 	fotoShowObj.slideObj=document.getElementById('fotoSlide_'+id);
 	
	fotoShowObj.fotoNavObj=document.getElementById('fotoNav_'+id);
 	fotoShowObj.zoomButton=document.getElementById('zoomButton_'+id);
 	
 	fotoShowObj.slideObj.slideTo = slider;
 	
 	return fotoShowObj;
 }
 
 function fotoSet()
 {
 	this.fotoIndex = 0;		// start position list
 	this.slideID = false;	// setInterval ID
 }
 
 window.onload = function()
 {
 	// init photo slide shows
 	if(fotoShowObjList)
 	{
 		for(var i in fotoShowObjList)
 		{
 			fotoShowObj = getFotoShowObj(i);
 			
 			preLoadImages(fotoShowObj.fotoList);
 						
 			if(fotoShowObj.fotoList[fotoShowObj.fotoIndex][1]==null){
 				fotoShowObj.zoomButton.style.display="none";		
 			}
 			
 			//fotoShowObj.fotoObj.style.backgroundImage="url("+fotoShowObj.fotoList[fotoShowObj.fotoIndex][0]+")";
			fotoShowObj.fotoNrObj.innerHTML=(fotoShowObj.fotoIndex+1)+"/"+fotoShowObj.fotoList.length;
			fotoShowObj.fotoNavObj.style.visibility="visible";
 			//fotoShowObj.slideObj.style.left=fotoShowObj.slideObj.offsetWidth+"px";
 		}
 	}
 	
 	if(document.forms["booking"] && document.forms["booking"]["serverToStep"])
 	{
 		runThrough();
 	}
 
 	if(document.getElementById('alertMessage'))
 	{
 		 popupWindow('alertMessage');
 	}
 	
 	
 	// init photo index number for photo-view and photo-popup
 	if(document.getElementById('fotoShow'))
 	{
 		document.getElementById('fotoNr').innerHTML="1/"+fotoList.length;
 	}
 
 	// init clipit icons which are selected in mijn reisgids 
 	/*
 	if(clipIts)
 	{
 		clipItList = eval(clipIts);
 		for(var i=0;i<clipItList.length;i++)
 		{
 			clipItID = "c_"+clipItList[i][0];
 			if(document.getElementById(clipItID))
 			{
 				document.getElementById(clipItID).className = document.getElementById(clipItID).className+"Added"
 			}
 		}
 	}
 	refreshReisgids(clipItList);
 	*/
 	
 }

