
var isIE6    = (navigator.userAgent.toLowerCase().indexOf("msie 6") != -1);
var isIE7    = (navigator.userAgent.toLowerCase().indexOf("msie 7") != -1);
var isSafari = (navigator.userAgent.toLowerCase().indexOf("safari") != -1);
var isMovemend = false;

//Stars
window.stars = new Array();
window.stars['vorm'] = 0;
window.stars['gebruik'] = 0;
window.stars['geluid'] = 0;
window.stars['duur'] = 0;
window.stars['mog'] = 0;

window.onload = function() {
  FlashOnload(document);
}

FlashOnload = function(container) {
  if(isIE6 || isIE7 || isSafari){

	  if (isSafari) { 
		  addSafariCSS(); // Extra stylesheet voor safari browsers
	  } 
	  else { // Safari en de Image Reflex werken niet goed samen.
  	
		    if(isIE6 || isIE7){
			    addIEReflex();
		    } else {
		 	    addReflex(); 
		    }
  	
	  }
	  if (flashDetect() && SWFObject) {
		  if (container == document && container.getElementById("logo") != null) {
			  var logo = new SWFObject("/swf/logobellen.swf", "logobellen", "301", "52", "8", "#FFFFFF");
			  logo.addParam("wmode", "transparent");
			  logo.write("logo");
		  }
		  // Parse alle H2 voor flashtitels
		  h2s = container.getElementsByTagName("h2");
		  for (i = 0; i < h2s.length; i++) {
			  h2 = h2s[i];
			  re = /\bflash-(\w|-)*\b/;
			  reicon = /\bicon-(\w|-)*\b/;
			  if (h2.className) {
				  names = re.exec(h2.className);
				  icon  = reicon.exec(h2.className);
				  if (names) {
					  if (icon) {
						  icon = icon[0]
					  } else {
						  icon = null;
					  }
					  switch (names[0]) {
						  case "flash-overview-compair":
							  writeTitle(h2, "0x002A7F", 13, "", "100%", "100%",icon,"",true);
							  break;
						  case "flash-information-tab":
							  writeTitle(h2, "0x002A7F", 13, "", "100%", "100%",icon,"",true);
							  break;
						  case "flash-belwijzer":
							  writeTitle(h2, (h2.className.indexOf('active') > -1 ? "0x002A7F" : "0x6A84B7"), 13, "", "100%","100%",icon,"0x002A7F",true);
							  break;
						  case "flash-belwijzer-nobar":
							  writeTitle(h2, (h2.className.indexOf('active') > -1 ? "0x002A7F" : "0x6A84B7"), 13, "", "100%","100%",icon,"0x002A7F",true);
							  break;
						  case "flash-belwijzer-sort":	
							  writeTitle(h2, (h2.className.indexOf('active') > -1 ? "0x002A7F" : "0x6A84B7"), 13, "", "100%","100%",icon,"0x002A7F",true);
							  break;
						  case "flash-belwijzer-nosort":
							  writeTitle(h2, "0x6A84B7", 13, "", "100%","100%",icon,"0x002A7F",true);
							  break;
						  case "flash-header":
							  writeTitle(h2, (h2.className.indexOf('active') > -1 ? "0x002A7F" : "0x6A84B7"), 13, "", "100%","100%",icon,"0x002A7F",true);
							  break;
						  case "flash-header-small":
							  writeTitle(h2, (h2.className.indexOf('active') > -1 ? "0x002A7F" : "0x6A84B7"), 11, "", "100%","100%",icon,"0x002A7F",true);
							  break;
           					  case "flash-header-small-main":
							writeTitle(h2, (h2.className.indexOf('active') > -1 ? "0x002A7F" : "0x6A84B7"), 11, "", "100%","100%",icon,"0x002A7F",true);
							break;
						  case "flash-left":
							  writeTitle(h2, "0x8080A4", 14, "", "100%","100%",icon,"",true);
							  break;
						  case "flash-main":
						 	  // FAQ heeft anders transparent header
							  writeTitle(h2, "0x002A7F", 18, "", "100%", "100%",icon,"",( h2.className.indexOf('icon-faq') > -1 ? false : true ));
							  break;
						  case "flash-right":
							  writeTitle(h2, "0x002A7F", 18, "", "100%", "100%",icon,"",true);
							  break;
						  case "flash-top5":
							  writeTitle(h2, (h2.className.indexOf('active') > -1 ? "0x002A7F" : "0x6A84B7"), 17, "", "100%", "100%",icon,"",true);
							  break;
						  case "flash-social":
							  writeTitle(h2, "0x666666", 12, "", "100%", "100%",icon,"",true);
							  break;
						  case "flash-gsm-title":
							  //writeTitle(h2, "0x002A7F", 15, "", "100%","100%",icon,"",true);
							  break;
						  case "flash-gsm-price":
							  //writeTitle(h2, "0xFFFFFF", 20, "", "100%","100%",icon,"",true);
							  break;
						  case "flash-gsm-price-small":
							  //writeTitle(h2, "0xFFFFFF", 17, "", "100%","100%",icon,"",true);
							  break;
						  case "flash-toestel-info":
							  writeTitle(h2, "0x667FB2", 18, "", "100%","100%",icon,"",true);
							  break;
						  case "flash-voorkeur":
							  writeTitle(h2, "0xA6B5D3", 12, "", "98%","100%",icon,"0x002A7F",true);
							  break;
						  case "flash-star":
							  writeTitle(h2, "0xFFFFFF", 20, "", "25","30",icon,"",true);
							  h2.style.padding = '0';
							  break;
					  }
				  }
			  }
		  }
		}  
		parseStars(container);
	}
	
	//Init sliders
//	sliders = carpeGetElementsByClass(carpeSliderClassName, container) // Find the horizontal sliders.
//	for (i = 0; i < sliders.length; i++) {
//		sliders[i].onmousedown = slide // Attach event listener.
//	}
//	displays = carpeGetElementsByClass(carpeSliderDisplayClassName, container) // Find the displays.
//	for (i = 0; i < displays.length; i++) {
//		displays[i].onfocus = focusDisplay // Attach event listener.
//	}	

	//Tooltips
	enableTooltips("enableTooltips", container);
//	var toolTips = getElementsByClassName("enableTooltips", container);
//	if (toolTips.length > 0) {
// 		enableTooltips("enableTooltips");
//	}
	// Ervaring percentages
	parseStarsPercentage();	
};

function enableTooltips(id, enableTooltipsContainer){
  var links,classes,i,j,h;
  if(!document.getElementById || !document.getElementsByTagName) return;
  classes=getElementsByClassName(id, enableTooltipsContainer);
  if (classes.length > 0) {
    if (!enableTooltipsContainer || enableTooltipsContainer == document) {
      AddCss();
      h=document.createElement("span");
      h.id="btc";
      h.setAttribute("id","btc");
      h.style.position="absolute";
      document.getElementsByTagName("body")[0].appendChild(h);
    }
    for (j = 0; j < classes.length; j++) {
	    links=classes[j].getElementsByTagName("a");
	    for(i=0;i<links.length;i++){
	        Prepare(links[i]);
        }
	    links=classes[j].getElementsByTagName("th");
	    for(i=0;i<links.length;i++){
	        Prepare(links[i]);
        }
    }
  }
}

flashDetect = function() {
	// IE flash detection.
	flashVersion = 0;
    if (isIE6 || isIE7) {
		for(var i=15; i>0; i--){
			try{
				var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
				flashVersion = i;
				break;
			}
			catch(e){
			}
		}
	} else {
		MSDetect = "false";
		if (navigator.plugins && navigator.plugins.length)
		{
			x = navigator.plugins["Shockwave Flash"];
			if (x)
			{
				flashinstalled = 2;
				if (x.description)
				{
					y = x.description;
					flashVersion = y.charAt(y.indexOf('.')-1);
				}
			}
			else
				flashinstalled = 1;
			if (navigator.plugins["Shockwave Flash 2.0"])
			{
				flashinstalled = 2;
				flashversion = 2;
			}
		}
		else if (navigator.mimeTypes && navigator.mimeTypes.length)
		{
			x = navigator.mimeTypes['application/x-shockwave-flash'];
			if (x && x.enabledPlugin)
				flashinstalled = 2;
			else
				flashinstalled = 1;
		}
		else
			MSDetect = "true";
	}
	
	return (flashVersion >= 8);
};

parseStars = function(parseStarsContainer) {
	var stars = getElementsByClassName("flashstar", parseStarsContainer);
	for (var i = 0; i < stars.length; i++) {
		var color = "0x";
		var bgcolor = stars[i].getAttribute('bgcolor');
		if (bgcolor == null) { bgcolor = stars[i].parentNode.getAttribute('bgcolor'); }
		color += bgcolor.substring(1,7); 
//		var classNames = stars[i].parentNode.className.split(' ');
//		classNames = classNames[0];
//		if (operatorColors[classNames] == undefined) classNames = 'none';
//		var color = "0x" + operatorColors[classNames].substring(1,7);
		var number = getXHTML(stars[i], false, false);
		stars[i].style.paddingTop = '0px';
		writeStar(stars[i],color,number);
	}
}

parsetop5stars = function() {
	var stars = getElementsByClassName("top5flashstar");
	for (var i = 0; i < stars.length; i++) {
		var color = "0x" + stars[i].parentNode.getAttribute('bgcolor').substring(1,7);
//		var classNames = stars[i].parentNode.className.split(' ');
//		classNames = classNames[0];
//		if (operatorColors[classNames] == undefined) classNames = 'none';
//		var color = "0x" + operatorColors[classNames].substring(1,7);
		var number = getXHTML(stars[i], false, false);
		stars[i].style.paddingTop = '0px';
		writeStar(stars[i],color,number);
	}
}

writeStar = function(container, color, number) {
	var so = new SWFObject("/swf/star.swf", container, "30", "30", "8", "#FFFFFF");
	so.addVariable("color", color);
	so.addVariable("number", number);
	so.addParam("scale", "noScale");
	so.addParam("wmode", "transparent");
	so.addParam("quality", "high");
	so.write(container);
}

parseStarsPercentage = function(container) {
	var stars = getElementsByClassName("stars", container);
	for (var i = 0; i < stars.length; i++) {
		starPercentage(stars[i]);
	}
}

starPercentage = function(container) {
	var width = 75;
	for (var i = 0; i < container.childNodes.length; i++) {
		if (container.childNodes[i].className == 'percentage') {
			container.childNodes[i].style.left = (-1 * (width - Math.round(width / 100 * container.childNodes[i].innerHTML))) + 'px';
			break;
		}
	}
}

toggleCallCalc = function(obj) {
	if (obj.innerHTML != "meer gegevens verbergen") {
		obj.innerHTML = "meer gegevens verbergen";
		document.getElementById("call-calc-extra").style.display = "block";
	} else {
		obj.innerHTML = "meer gegevens invullen";
		document.getElementById("call-calc-extra").style.display = "none";
	}
};

togglemenu = function(obj) {
	var li = obj.parentNode;
	if (li.className == "open") {
		li.className = "";
	} else {
		li.className = "open";
	}
};

SetFocus = function (elementId) {
  document.getElementById(elementId).scrollIntoView();
}

SetCheckBoxes = function(containerId, value) {
  var divContainer = document.getElementById(containerId);
  if (divContainer != null && divContainer != undefined) {
    //exist
    var inputCollection = divContainer.getElementsByTagName("input");
    for(var indexInputCollection=0; indexInputCollection < inputCollection.length; indexInputCollection++) {
		  if(inputCollection[indexInputCollection].type == "checkbox") {
		    if (value == true) { inputCollection[indexInputCollection].checked = "checked"; }
		    else { inputCollection[indexInputCollection].checked = ""; }
		  }
		}
  }
}

opentab = function(basename, num, fade) {
	if (num != 0) {
	  for (var indexDisplayNoneOpentab=1;indexDisplayNoneOpentab<=10;indexDisplayNoneOpentab++)
	  {
		  if (document.getElementById(basename + indexDisplayNoneOpentab)) {
			  //exist
			  if (indexDisplayNoneOpentab != num) {
				  document.getElementById(basename + indexDisplayNoneOpentab).style.display = "none";
			  }
		  } else {
			  break;
		  }
	  }
	  if(num != -1) {
		  if (fade && (!isSafari)) { // Geen fading in safari
			  document.getElementById(basename + num).style.display = "block";
			  setOpacity('top5Table' + num,0);
			  for (var i=0;i<11;i++)
				  setTimeout('setOpacity(\'top5Table' + num + '\','+i+')',200*i);
  		
		  } else {					
			  document.getElementById(basename + num).style.display = "block";
		  }
	  }
  	
	  if(isIE){
		  addIEReflex();
	  }
	  
	   SetCookie("opentabvoorpagina",num,30)
	}
};

setOpacity = function (divObjName, value)
{
	divObj = document.getElementById(divObjName);
	if (divObj != undefined) {
		divObj.style.opacity = value/10;
		divObj.style.filter = 'alpha(opacity=' + value*10 + ')';
	}
};

// Flash titles
writeTitle = function(container, color, size, label, width, height, icon, hovercolor, transparent) {
	var so = new SWFObject("/swf/title.swf", container, width, height, "8", "#FFFFFF");
	if (icon != null) {
		so.addVariable("fvIcon", "/images/" + icon + ".png");
		container.style.paddingLeft = '0px'; // Move over the HTML icon's padding
		container.style.backgroundImage = 'none'; // Remove the icon
	}
	if(container.childNodes[0].length == undefined) { // Er is een HTML element in de H2 titel. Dit is de <a href="...">...</a>
		var h2Link = container.childNodes[0].getAttribute('href');
		var h2Target = container.childNodes[0].getAttribute('target');
		if (h2Link!=null) {
		h2Link = h2Link.replace(new RegExp( "&amp;", "g" ),'%26');
		h2Link = h2Link.replace(new RegExp( "&", "g" ),'%26');
		}
		if (h2Link   != null) so.addVariable("fvUrl",h2Link); // Is er een a href met een link, voeg die dan toe aan de title.swf
		if (h2Target != null) so.addVariable("fvTarget",h2Target);  // Is er een target gespecificeerd, dan die gebruiken, anders default _top
		label = container.childNodes[0].innerHTML;
	}
	if (label == "") {
		label = getXHTML(container, false, false);
	}
	if (icon != null && h2Link != null) { // Als er een link is en een icoon, dan alleen een hover color tonen
		hovercolor = "0x900000";
	}
	// Vervang leestekens met HTML varianten
	if (label.length > 0) {
		label = label.replace(new RegExp( "&amp;", "g" ),'%26');
		label = label.replace(new RegExp( "&", "g" )    ,'%26');
		label = label.replace(new RegExp( "\\+", "g" )    ,'%2B');
	}
	
	if (hovercolor != undefined && hovercolor != '') {
		so.addVariable("fvOverColor",hovercolor);
	}

	so.addVariable("fvColor", color);
	so.addVariable("fvSize", size);
	so.addVariable("fvLetterSpacing", 0);
	so.addVariable("fvLabel", label);
	so.addVariable("fvLeading", -5);
	so.addParam("scale", "noScale");
	if (transparent) {
		so.addParam("wmode", "transparent");
	} else {
		so.addParam("wmode", "opaque");
	}
	so.addParam("quality", "high");
	so.write(container);
};

getXHTML = function(obj, encode, bOuter) {
  // bOuter -> true = outerHTML, false = innerHTML
  // It is an option to pass innerXHTML() a string indicating an id attribute
  if (typeof obj == "string") {
    obj = document.getElementById(obj)
  }
  
  var open = '';
  var content = '';
  var close = '';
  var tagname = obj.nodeName.toLowerCase();
  var emptytag = (obj.nodeName.match(/area|base|basefont|br|col|frame|hr|img|input|isindex|link|meta|param/i)) ? true : false; 

  // Write open tag
  if (bOuter)
  {
	  open = '<'+tagname;
	  for (var i=0; i<obj.attributes.length; i++) {
		if (obj.attributes[i].specified && obj.attributes[i].value != "null")
		  open += ' '+obj.attributes[i].name.toLowerCase()+'="'+obj.attributes[i].value+'"';
	  }
	  open += (emptytag) ? ' />' : '>';
  }

  if (!emptytag) {
    // Write tag content
    for (var i=0; i<obj.childNodes.length; i++) {
      var node = obj.childNodes[i];
      if (node.nodeType==3)
      {  
	  	nodecontent = node.data.replace(/</gi, "&lt;");
		nodecontent = nodecontent.replace(/>/gi, "&gt;");
		content += nodecontent; //node.data; //nodecontent;
	  }
      else if (node.nodeType==1)
        content += getXHTML(obj.childNodes[i], false, true);
      else
        content += " ";
    }
	
	if (bOuter)
    {
		// Write closing tag
    	close = '</'+tagname+'>';
	}
  }
  
  // URI encode the content if desired
  return (typeof(encode)=="undefined encode" || encode==true) ? encodeURIComponent(open+content+close) : open+content+close;
};

function getElementsByClassName(classname, node) {
	if(!node) node = document.getElementsByTagName("body")[0];
	var a = [];
	var re = new RegExp('\\b' + classname + '\\b');
	var els = node.getElementsByTagName("*");
	for(var i=0,j=els.length; i<j; i++)
		if(re.test(els[i].className))a.push(els[i]);
	return a;
};

function getElementsByTagAndClassName(tagName, classname, node) {
	if(!node) node = document.getElementsByTagName("body")[0];
	var a = [];
	var re = new RegExp('\\b' + classname + '\\b');
	var els = node.getElementsByTagName(tagName);
	for(var i=0,j=els.length; i<j; i++)
		if(re.test(els[i].className))a.push(els[i]);
	return a;
};

function SetBackGroundImage(targetObject, imageName) {
  targetObject.style.backgroundImage="url('" + imageName + "')";
}

var enablePhoneDetail = true; //Whether the onclick to see the details of a phone is enabled (event is triggered on a href click too)
var currentTop3MenuPosition = 0; // Current scroll position
var phonesDivObj = "phones"; // Id with all the phones in it
var phonesClassName = "phone"; // The class name of one phone
var phoneWidth = 154; // Width in pixels
var stepSize = 3; // Number of phones per click

openTop3Menu = function(direction) {
	var numberOfPhones = 0;
	var phonesDiv = document.getElementById(phonesDivObj);
	
	for (var i = 0; i < phonesDiv.childNodes.length; i++) {
		if (phonesDiv.childNodes[i].className == phonesClassName) numberOfPhones++;
	}
	if (numberOfPhones <= 3) return null; //nothing to scroll
	var maxScroll = -1 * phoneWidth * (numberOfPhones - 3);
	
		switch (direction) {
			case "top3Right":
				if (currentTop3MenuPosition > maxScroll) currentTop3MenuPosition = currentTop3MenuPosition - stepSize * phoneWidth;
			break;
			
			case "top3Left":
				if (currentTop3MenuPosition <= 0) currentTop3MenuPosition = currentTop3MenuPosition + stepSize * phoneWidth;
			break;
		}

		if (currentTop3MenuPosition <= maxScroll) {
			document.getElementById('noMoreRight').style.display = 'block';
			document.getElementById('top3Right').style.display = 'none';
		} else if (currentTop3MenuPosition == 0) {
			document.getElementById('noMoreLeft').style.display = 'block';
			document.getElementById('top3Left').style.display = 'none';
		} else if (currentTop3MenuPosition < 0) {
			document.getElementById('noMoreLeft').style.display = 'none';
			document.getElementById('top3Left').style.display = 'block';
			document.getElementById('noMoreRight').style.display = 'none';
			document.getElementById('top3Right').style.display = 'block';
		}
		
		phonesDiv.style.left = currentTop3MenuPosition + 'px';
	
};

getTop3Content = function() {
	return top.top3phones;
};

toggleNieuwsbriefForm = function() {
	if (!isMovemend) {
		var maxHeight = 133;
		if (isSafari) {
			maxHeight = 130;
		} else if (isIE7) {
			maxHeight = 130;
		} else if (isIE6) {
			maxHeight = 140;
		}
		var divObj = document.getElementById('nieuwsbriefform');
		var linkObj = document.getElementById('nieuwsbriefformlink');
		if (divObj.style.display == 'none' || divObj.style.display == '') {
			linkObj.className = 'morearrow active';
			sizeBox('nieuwsbriefform','open',maxHeight);
		} else {
			linkObj.className = 'morearrow';
			sizeBox('nieuwsbriefform','close',maxHeight);
		}
	}
};

toggleSearchForm = function() {
	if (!isMovemend) {
		var maxHeight = 135;
		if (isSafari) {
			maxHeight = 120;
		} else if (isIE7) {
			maxHeight = 115;
		} else if (isIE6) {
			maxHeight = 110;
		}
		var divObj = document.getElementById('nieuwssearchform');
		var linkObj = document.getElementById('nieuwssearchformlink');
		if (divObj.style.display == 'none' || divObj.style.display == '') {
			linkObj.className = 'morearrow active';
			sizeBox('nieuwssearchform','open',maxHeight);
		} else {
			linkObj.className = 'morearrow';
			sizeBox('nieuwssearchform','close',maxHeight);
		}
	}
};

toggleSearchForumForm = function() {
	if (!isMovemend) {
		var maxHeight = 145;
		if (isSafari) {
			maxHeight = 160;
		} else if (isIE7) {
			maxHeight = 160;
		} else if (isIE6) {
			maxHeight = 165;
		}
		var divObj = document.getElementById('nieuwssearchform');
		var linkObj = document.getElementById('nieuwssearchformlink');
		if (divObj.style.display == 'none' || divObj.style.display == '') {
			linkObj.className = 'morearrow active';
			sizeBox('nieuwssearchform','open',maxHeight);
		} else {
			linkObj.className = 'morearrow';
			sizeBox('nieuwssearchform','close',maxHeight);
		}
	}
};

toggleSearchFaqForm = function() {
	if (!isMovemend) {
		var maxHeight = 70;
		if (isSafari) {
			maxHeight = 75;
		} else if (isIE7) {
			maxHeight = 75;
		} else if (isIE6) {
			maxHeight = 80;
		}
		var divObj = document.getElementById('nieuwssearchform');
		var linkObj = document.getElementById('nieuwssearchformlink');
		if (divObj.style.display == 'none' || divObj.style.display == '') {
			linkObj.className = 'morearrow active';
			sizeBox('nieuwssearchform','open',maxHeight);
		} else {
			linkObj.className = 'morearrow';
			sizeBox('nieuwssearchform','close',maxHeight);
		}
	}
};

toggleForm = function(elementIdVisible, elementIdNotVisible, hiddenFieldId, hiddenFieldValue) {
	var divObj = document.getElementById(elementIdVisible);
	if (divObj != null) {
		divObj.style.display = 'block';
	}
	
	divObj = document.getElementById(elementIdNotVisible);
	if (divObj != null) {
		divObj.style.display = 'none';
	}
	
	if (hiddenFieldId != null && hiddenFieldValue != null) {
	  document.getElementById(hiddenFieldId).value = hiddenFieldValue;
	}
};

toggleBelwijzerForm = function(hdnMeerOptiesId) {
	if (!isMovemend) {
		var maxHeight = 195;
		if (isSafari) {
			maxHeight = 190;
		} else if (isIE7) {
			maxHeight = 210;
		} else if (isIE6) {
			maxHeight = 210;
		}
		
		var divObj = document.getElementById('moreBelwijzer');
		var linkObj = document.getElementById('moreBelwijzerLink');
		var hdnObj = document.getElementById(hdnMeerOptiesId);
		
		if (divObj.style.display == 'none' || divObj.style.display == '') {
			linkObj.className = 'morearrow active noToolTip';
			linkObj.innerHTML = 'meer gegevens verbergen';
  		divObj.style.display = "block";

			//sizeBox('moreBelwijzer','open',maxHeight);
		} else {
			linkObj.className = 'morearrow noToolTip';
			linkObj.innerHTML = 'meer gegevens invullen';
  		divObj.style.display = "none";
			//sizeBox('moreBelwijzer','close',maxHeight);
		}

		hdnObj.value = divObj.style.display;
	}
};

toggleZoekenAdvancedForm = function() {
	if (!isMovemend) {
		var maxHeight = 195;
	
		var divObj = document.getElementById('zoekenExtra');
		var linkObj = document.getElementById('zoekenExtraLink');
		var btnZoekBasic = document.getElementById('btnZoekenBasic');
		if (divObj.style.display == 'none' || divObj.style.display == '') {
			linkObj.className = 'morearrow active';
			btnZoekBasic.style.display = 'none';
			sizeBox('zoekenExtra','open',maxHeight);
		} else {
			linkObj.className = 'morearrow';
			btnZoekBasic.style.display = 'block';
			sizeBox('zoekenExtra','close',maxHeight);
		}
	}
};

sizeBox = function(objectName,direction,maxheight) {
	isMovemend = true;
	var animationSpeed = 5;
	var animationStep = 10;
	var objectID = document.getElementById(objectName);
	var currentHeight = 0;
	if (direction == 'open' && (objectID.style.height == '' || objectID.style.height == '0px')) {
		currentHeight = 0;
		objectID.style.height = '0px';
		objectID.style.display = "block";
	} else {
		currentHeight = parseInt(objectID.style.height);
	  //alert('currentheight: ' + currentHeight);
	}
	if ( (direction == 'open' && currentHeight < maxheight) || (direction == 'close' && currentHeight > 0) )  {
		objectID.style.height = (direction == 'open' ? currentHeight + animationStep : currentHeight - animationStep) + 'px';
		setTimeout('sizeBox(\''+ objectName + '\',\''+ direction + '\',' + maxheight + ');',animationSpeed);
	} else if (direction == 'close') {
		objectID.style.display = 'none';
		isMovemend = false;
	} else {
		isMovemend = false;
	}
};

selectStar = function(pStar, containerId, starId) {
	var starBase = pStar.id.substring(0,pStar.id.length-1);
	//var number = pStar.id.substring(pStar.id.length-1,pStar.id.length);
	if (containerId != null) {
	  document.getElementById(containerId).value = starId;
	}
	window.stars[starBase] = starId; 
};

hoverStar = function(pStar, starId) {
	var starBase = pStar.id.substring(0,pStar.id.length-1);
	//var number = pStar.id.substring(pStar.id.length-1,pStar.id.length);
	for (var i = 1; i <= 5; i++) {
		document.getElementById(starBase + i).className = 'singlestar';
	}
	
	for (var i = 1; i <= starId; i++) {
		document.getElementById(starBase + i).className = 'singlestar selected';
	}
};

clearStars = function(pStar) {
	var starBase = pStar.id.substring(0,pStar.id.length-1);
	var number = 0;
	if (window.stars[starBase] != undefined) {
		number = window.stars[starBase];
	}
	
	var i = 0;
	for (i = 1; i <= number; i++) {
		document.getElementById(starBase + i).className = 'singlestar selected';
	}
	for (;i <= 5; i++) {
		//alert(i);
		document.getElementById(starBase + i).className = 'singlestar';
	}
};

faqResponse = function(pObject) {
	var faqDivObj = document.getElementById('TB_iframeContent');
	var height = parseInt(faqDivObj.style.height);
	var faqContent = pObject.parentNode.parentNode;
	//Change the leading text
	var aSpans = pObject.parentNode.getElementsByTagName('span');
//	alert(aSpans[0].id);
//	alert(aSpans[1].id);
//	alert(aSpans[2].id);
	//for (int si222 = 0; si222 < aSpans.length; si222++) {
	  //alert(aSpans[si].id);
	//}
	aSpans[0].style.display = 'none';
	aSpans[1].style.display = 'inline';
	//aSpans[2].style.display = 'none';
	
	var aHrefs = pObject.parentNode.childNodes;
	for (var i = 0; i < aHrefs.length; i++) {
		if (aHrefs[i].className != "" && aHrefs[i].className != undefined) {
			if (aHrefs[i].className.indexOf("-smiley-") != -1) {
				if (aHrefs[i].className != pObject.className) {
					aHrefs[i].style.display = "none";
				}
				else {
	        var inputs = faqContent.getElementsByTagName("input");
	        //alert(inputs.length);
	        for (var j = 0; j < inputs.length; j++) {
		        var smiley = inputs[j];
		        //alert(smiley.id);
				    if (smiley.id == 'hdnSmiley') {
				      smiley.value = pObject.className;
				      break;
				    }
				  }
				  //alert(smiley.value);
				}
			} else if (aHrefs[i].className.indexOf("form") != -1) {
				var faqRatingDivObj = aHrefs[i];
			}
		}
	}
	
	if (faqRatingDivObj.style.display == undefined || faqRatingDivObj.style.display != "block") {
		faqDivObj.style.height = height + 33 + "px";
		faqContent.style.height = height + 31 + "px";
		faqRatingDivObj.style.display = "block";
	}
};

faqCloseResponse = function(pObject) {
	var faqDivObj = document.getElementById('TB_iframeContent');
	var height = parseInt(faqDivObj.style.height);
	var faqContent = pObject.parentNode.parentNode.parentNode;
	//Change the leading text
	var aSpans = pObject.parentNode.parentNode.getElementsByTagName('span');
	aSpans[0].style.display = 'inline';
	aSpans[1].style.display = 'none';
	//aSpans[2].style.display = 'none';
	
	var aHrefs = pObject.parentNode.parentNode.childNodes;
	for (var i = 0; i < aHrefs.length; i++) {
		if (aHrefs[i].className != "" && aHrefs[i].className != undefined) {
			if (aHrefs[i].className.indexOf("-smiley-") != -1) {
				if (aHrefs[i].className != pObject.className) {
					aHrefs[i].style.display = "inline";
				}
			} else if (aHrefs[i].className.indexOf("form") != -1) {
				var faqRatingDivObj = aHrefs[i];
			}
		}
	}
	
	if (faqRatingDivObj.style.display == undefined || faqRatingDivObj.style.display != "none") {
		faqDivObj.style.height = (parseInt(faqDivObj.style.height) - 28) + "px";
		faqContent.style.height = (parseInt(faqContent.style.height) - 28) + "px";
		faqRatingDivObj.style.display = "none";
	}
};

addSafariCSS = function() {
	var newSS=document.createElement('link');
	newSS.rel='stylesheet';
	newSS.href='/css/safari.css';
	document.getElementsByTagName("head")[0].appendChild(newSS);
};

printFAQ = function() {
	this.focus();
	this.print();
};

function popitup(contentid,height,width ) {
	location.href="/content/layer.aspx?contentid="+contentid+"&keepThis=true&TB_iframe=true&height="+height+"&width="+width+"&modal=true";
	return true;
}

function detailvastpopup(url) {
	window.open(url, 'detailvast','width=740,height=600,resizable=1,scrollbars=yes,menubar=no,statusbar=no,status=no');
	return false;
}


function ToggleClass(oItem)
{
	$(oItem).toggleClass('active');
}

function TabNext(obj,event,len,next_field) {
	if (event == "down") {
		veldlengte=obj.value.length;
  	obj.style.backgroundColor="#FFFF99";
    obj.style.borderColor="#000000";
	}
  if (event == "done") {
    obj.style.backgroundColor="#FFFFFF";
    obj.style.borderColor="#a0a0a0";
  }
	if (event == "up") {
		if (obj.value.length != veldlengte) {
			veldlengte=obj.value.length;
			if (veldlengte == len) {
        obj.style.backgroundColor="#FFFFFF";
        obj.style.borderColor="#a0a0a0";
				next_field.focus();
				next_field.style.backgroundColor="#FFFF99";
        next_field.style.borderColor="#000000";
			}
		}
	}    
}

function ReadCookie(cookieName) {
 var theCookie=""+document.cookie;
 var ind=theCookie.indexOf(cookieName);
 if (ind==-1 || cookieName=="") return ""; 
 var ind1=theCookie.indexOf(';',ind);
 if (ind1==-1) ind1=theCookie.length; 
 return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}
            
function SetCookie(cookieName,cookieValue,nDays) {
  var today = new Date();
  var expire = new Date();
  if (nDays==null || nDays==0) nDays=1;
   expire.setTime(today.getTime() + 3600000*24*nDays);
   document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString();
  }
  
function submitformgids() {
  document.TGIGIDS1.submit();
}
function submitformbelwijzer() {
  document.belwijzermobiel.submit();
}
function Afmelden() {
  document.nieuwsbrief.fid.value="afmelden";
  document.nieuwsbrief.submit();
}
function Aanmelden() {
  document.nieuwsbrief.submit();
}
function landen() {
 var land = document.bellenbuitenland.landnaam.value;
 parent.location = "/bellen-naar-het-buitenland/"+land+".aspx";
}