	/**
	 * Programmers:        Laurens Martina, Simon Busstra
	 * Company:            Sequential Media
	 * Created:            ?
	 * Recreated:          2007-12-03
	 * Updated:            2008-09-19
	 * Version:            3.1.3
	 *                     Changed version a: 2007-12-03
	 *                     Changed version b: 2007-12-03
	 *                     Changed version c: 2008-10-02
	 * Build:              1
	 * Tested in:          msie    pc  6  : no
	 *                     msie    pc  7  : no
	 *                     firefox pc  2.0: yes
	 *                     firefox mac 2.0: no
	 *                     safari  mac 2.0: no
	 */
	
	// >->->->------------ COMMON JS FUNCTIONS ------------>->->->
	/**
	 * --------------------------------------------------------------------------
	 * function f_getWindowDimension
	 * --------------------------------------------------------------------------
	 */
	function f_getWindowDimension(){
		var w_docWidth = 0;
		var w_docHeight = 0;
		if(typeof(window.innerWidth) == 'number'){
			//Non-IE
			w_docWidth = window.innerWidth;
			w_docHeight = window.innerHeight;
		}
		else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){
			//IE 6+ in 'standards compliant mode'
			w_docWidth  = document.documentElement.clientWidth;
			w_docHeight = document.documentElement.clientHeight;
		}
		else if(document.body && (document.body.clientWidth || document.body.clientHeight)){
			//IE 4 compatible
			w_docWidth = document.body.clientWidth;
			w_docHeight = document.body.clientHeight;
		}
		return [w_docWidth, w_docHeight];
	}
	
	/**
	 * --------------------------------------------------------------------------
	 * function f_getScrollXY
	 * --------------------------------------------------------------------------
	 */
	function f_getScrollXY(){
		var scrOfX = 0;
		var scrOfY = 0;
		//Netscape compliant
		if(typeof(window.pageYOffset) == 'number'){
			scrOfX = window.pageXOffset;
			scrOfY = window.pageYOffset;
		}
		//DOM compliant
		else if(document.body && (document.body.scrollLeft || document.body.scrollTop)){
			scrOfX = document.body.scrollLeft;
			scrOfY = document.body.scrollTop;
		}
		//IE6 standards compliant mode
		else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)){
			scrOfX = document.documentElement.scrollLeft;
			scrOfY = document.documentElement.scrollTop;
		}
		return [scrOfX, scrOfY];
	}
	
	/**
	 * --------------------------------------------------------------------------
	 * function f_findPos
	 * --------------------------------------------------------------------------
	 */
	function f_findPos(obj){
		var curleft = curtop = 0;
		if(obj.offsetParent){
			curleft = obj.offsetLeft
			curtop = obj.offsetTop
			while(obj = obj.offsetParent){
				curleft += obj.offsetLeft
				curtop += obj.offsetTop
			}
		}
		return [curleft, curtop];
	}
	
	/**
	 * --------------------------------------------------------------------------
	 * function f_positionDiv
	 * --------------------------------------------------------------------------
	 */
	function f_positionDiv(p_oElement){
		var w_aPagDim   = f_getWindowDimension();
		var w_aSrollPos = f_getScrollXY();
		var t_sPattern  = /\D/gi;
		// width
		var w_iDiv_W    = f_regularExpression('replace', t_sPattern, f_getStyle(p_oElement, 'width'), '');
		
		// height
		
		//var w_iDiv_H    = f_regularExpression('replace', t_sPattern, f_getStyle(p_oElement, 'height'), '');
		var w_iDiv_H    = p_oElement.offsetHeight;
		//alert(w_iDiv_H + ', ' + t_iDiv_H);
		
		// padding-left
		var w_iDiv_PL = 0;
		var t_iDiv_PL;
		if(t_iDiv_PL = f_getStyle(p_oElement, 'paddingLeft')){
			w_iDiv_PL   = f_regularExpression('replace', t_sPattern, t_iDiv_PL, '');
		}
		else if(t_iDiv_PL = f_getStyle(p_oElement, 'padding-left')){
			w_iDiv_PL   = f_regularExpression('replace', t_sPattern, t_iDiv_PL, '');
		}
		
		// padding-top
		var w_iDiv_PT = 0;
		var t_iDiv_PT;
		if(t_iDiv_PT = f_getStyle(p_oElement, 'paddingTop')){
			var w_iDiv_PT   = f_regularExpression('replace', t_sPattern, t_iDiv_PT, '');
		}
		else if(t_iDiv_PT = f_getStyle(p_oElement, 'padding-top')){
			var w_iDiv_PT   = f_regularExpression('replace', t_sPattern, t_iDiv_PT, '');
		}
		
		var w_iTop  = (((w_aPagDim[1]*1 /2) -(w_iDiv_H*1 /2)) -(w_iDiv_PT*1 /2) +w_aSrollPos[1]*1);
		var w_iLeft = (((w_aPagDim[0]*1 /2) -(w_iDiv_W*1 /2)) -(w_iDiv_PL*1 /2) +w_aSrollPos[0]*1);
		
    if(w_iTop < w_aSrollPos[1]){
      w_iTop = w_aSrollPos[1]+10;
    }
    
		p_oElement.style.left = w_iLeft + 'px';
		p_oElement.style.top  = ((w_iTop < 0) ? 0 : w_iTop) + 'px';
	}
	
	/**
	 * --------------------------------------------------------------------------
	 * function f_getStyle
	 * --------------------------------------------------------------------------
	 * Description:
	 *   finds a style for an element and returns the value.
	 */
	function f_getStyle(p_oElement, p_sStyleName){
		var w_sStyleValue;
		if(p_oElement.currentStyle){
			if(w_sStyleValue = p_oElement.currentStyle[p_sStyleName]){
				return w_sStyleValue;
			}
		}
		else if(window.getComputedStyle){
			if(w_sStyleValue = document.defaultView.getComputedStyle(p_oElement, null).getPropertyValue(p_sStyleName)){
				return w_sStyleValue;
			}
		}
		return false;
	}
	
	/**
	 * --------------------------------------------------------------------------
	 * function f_setActionAndSubmit
	 * --------------------------------------------------------------------------
	 */
	function setActionAndSubmit(p_sAction){
		if(!document.forms['bestelling']){
			return false;
		}
		var w_oForm = document.forms['bestelling'];
		
		// change the value of sAction
		var w_aoChildNodes = w_oForm.elements;
		for(var i = 0; i<w_aoChildNodes.length; i++){
			var t_oChildNode = w_aoChildNodes[i];
			if(t_oChildNode.name == 'sAction'){
				t_oChildNode.value = 'redirect';
			} // end if
		} // end for in
		
		// change the form action
		w_oForm.action = p_sAction;
		
		// submit the form
		w_oForm.submit();
	}
	
	/**
	 * --------------------------------------------------------------------------
	 * function f_setOpacity
	 * --------------------------------------------------------------------------
	 */
	function f_setOpacity(p_oObj, p_iOpacity){
		w_iOpacity = ((p_iOpacity == 100) ? 99.999 : p_iOpacity);
		p_oObj.style.filter       = "alpha(opacity:" + w_iOpacity + ")"; // IE/Win
		p_oObj.style.KHTMLOpacity = w_iOpacity/100;                      // Safari smThan 1.2, Konqueror
		p_oObj.style.MozOpacity   = w_iOpacity/100;                      // Older Mozilla and Firefox
		p_oObj.style.opacity      = w_iOpacity/100;                      // Safari 1.2, newer Firefox and Mozilla, CSS3
	}
	
	/**
	 * --------------------------------------------------------------------------
	 * function f_inverseBoolean
	 * --------------------------------------------------------------------------
	 */
	function f_inverseBoolean(p_bBoolean){
		return ((p_bBoolean) ? false : true);
	}
	
	/**
	 * --------------------------------------------------------------------------
	 * function f_email
	 * --------------------------------------------------------------------------
	 */
	function email(a, b){
		return '<a href="mailto:' + a + '@' + b + '">' + a + '@' + b + '</a>';
	}
	
	/**
	 * --------------------------------------------------------------------------
	 * function f_euros
	 * --------------------------------------------------------------------------
	 */
	function euros(p_iValue){
		return (Math.round(100*parseFloat(p_iValue))/100).toFixed(2);
	}
	
	/**
	 * --------------------------------------------------------------------------
	 * function f_checkForNumAndChar
	 * --------------------------------------------------------------------------
	 */
	function f_checkForNumAndChar(p_sString, p_eNumchar){
		var findDigit     = /[\d]{1}/
		var findChar      = /[A-Z]{1}|[a-z]{1}/
		var w_bValid      = true;
		
		switch (p_eNumchar){
			case 'char':{
				if(p_sString.search(findChar) == -1){
					w_bValid =  false;
				}
				break;
			}
			case 'num':{
				if(!findDigit.test(p_sString)){
					w_bValid = false;
				}
				break;
			}
			case 'numchar':{
				if((p_sString.search(findDigit) == -1) || (p_sString.search(findChar) == -1)){
					w_bValid = false;
				}
				break;
			}
			default:{
				w_bValid = false;
				break;
			}
		}
		return w_bValid;
	}
	
	/**
	 * --------------------------------------------------------------------------
	 * function f_swapDisplay
	 * --------------------------------------------------------------------------
	 */
	function f_swapDisplay(p_iId){
		var w_oElement = document.getElementById(p_iId);
		if(w_oElement.style.display == 'none'){
			w_oElement.style.display = '';
			return true;
		}
		w_oElement.style.display = 'none';
		return false;
	}
	
	/**
	 * --------------------------------------------------------------------------
	 * function f_bankfailure
	 * --------------------------------------------------------------------------
	 */
	function bankfailure(rekType, rekNr){
		var w_bError = false;
		switch(rekType){
			case 'giro':{	
				if((rekNr.length < 2) || (rekNr.length > 8)){
					w_bError = true;
				}
				for(t_iI=0; t_iI<rekNr.length; t_iI++){
					if(!f_checkForNumAndChar(rekNr.substr(t_iI, 1), 'num')){
						w_bError = true;
					}
				}
				break;
			}
			case 'bank':{
				if(rekNr.length != 9){
					w_bError = true;
				}
				else{
					var getal = 0;
					var tot = 0;
					var deel = 0;
					var rest = 0;
					for(t_iI=0; t_iI<rekNr.length; t_iI++){
						getal = rekNr.substr(t_iI, 1);
						if(!f_checkForNumAndChar(getal, 'num')){
							w_bError = true;
						}
						tot+= getal * (9 - t_iI);
					}
					rest = tot%11;
					if(rest != 0){
						w_bError = true;
					}
				}
				break;
			}
		}
		return w_bError;
	}
	
	/**
	 * --------------------------------------------------------------------------
	 * function f_regularExpression
	 * --------------------------------------------------------------------------
	 */
	function f_regularExpression(p_eType, p_sPattern, p_sString, p_sReplace){
		// p_eType -> match / exec / replace / test
		switch(p_eType){
			case 'match':{
				var w_oRegExp = new RegExp(p_sPattern);
			  if(p_sString.match(w_oRegExp)){
					return true;
			  }
				return false;
				break;
			}
			case 'exec':{
				var w_oRegExp = new RegExp(p_sPattern);
			  var m = w_oRegExp.exec(p_sString);
			  if (m == null) {
					return false;
			  }
				else{
			    var w_sString = "Match at position " + m.index + ":\n";
			    for(i = 0; i < m.length; i++){
			      w_sString = w_sString + m[i] + "\n";
			    }
					return w_sString;
			  }
				break;
			}
			case 'replace':{
				var w_oRegExp = new RegExp(p_sPattern);
			  return p_sString.replace(w_oRegExp, p_sReplace);
				break;
			}
			case 'test':{
				var w_oRegExp = new RegExp(p_sPattern);
			  if(w_oRegExp.test(p_sString)){
					return true;
				}
				return false;
				break;
			}
			default:{
				break;
			}
		}
	}
	
	/**
	 * --------------------------------------------------------------------------
	 * function f_videoOpenFullScreen
	 *		p_sWhLink	Link to fullscreen video
	 * --------------------------------------------------------------------------
	 */
	function f_videoOpenFullScreen(p_sWhLink){
		var w_sBaseUrlFullScreen 	= 'http://www.phonehouse.nl/bestel/fullscreenVideo.php?';
		var w_sParamsFullScreen		= p_sWhLink;
		var w_oWindowFulscreen 		= window.open(w_sBaseUrlFullScreen + w_sParamsFullScreen,"fullscreen","height ="+screen.height+", width ="+screen.width+", scrollbars=no");
		
		// Align popup top left
		w_oWindowFulscreen.moveTo(0, 0);
	}	
	
	/**
	 * function f_trim
	 */
	function f_trim(p_sValue){
		var w_sValue = p_sValue;
		w_sValue = w_sValue.replace(/^\s+/, '');
		w_sValue = w_sValue.replace(/\s+$/, '');
		return w_sValue;
	}
	
	/**
	 * --------------------------------------------------------------------------
	 * function f_getCheckedValue
	 * --------------------------------------------------------------------------
	 */
	function f_getCheckedValue(radioObj){
		if(!radioObj){
			return;
		}
		var radioLength = radioObj.length;
		if(radioLength == undefined){
			if(radioObj.checked){
				return radioObj.value;
			}
			else{
				return;
			}
		}
		for(var i = 0; i < radioLength; i++){
			if(radioObj[i].checked){
				return radioObj[i].value;
			}
		}
		return;
	}
		
	/**
	 * --------------------------------------------------------------------------
	 * function f_setCheckedValue
	 * --------------------------------------------------------------------------
	 */
	function f_setCheckedValue(radioObj, newValue){
		if(!radioObj){
			return;
		}
		var radioLength = radioObj.length;
		if(radioLength == undefined){
			radioObj.checked = (radioObj.value == newValue.toString());
			return;
		}
		for(var i = 0; i < radioLength; i++){
			radioObj[i].checked = false;
			if(radioObj[i].value == newValue){
				radioObj[i].checked = true;
			}
		}
	}
	
	// <-<-<-<------------ COMMON JS FUNCTIONS ------------<-<-<-<
	// >->->->----------- SPECIFIC JS FUNCTIONS ----------->->->->
	// >->->------ COMMON FUNCIONS FOR THE PHONE HOUSE ------>->->
	/**
	 * --------------------------------------------------------------------------
	 * function f_adjustSiteForPopupDiv
	 * --------------------------------------------------------------------------
	 */
	var g_oPoppedUpDiv = null;
	var g_oBlackOver   = null;
	function f_adjustSiteForPopupDiv(p_bPopup, p_oPopupDiv){
		// create black layover
		if(g_oBlackOver == null){
			g_oBlackOver = document.createElement('div');
			g_oBlackOver.id                    = 'blackOver';
			g_oBlackOver.style.position        = 'absolute';
			g_oBlackOver.style.top             = '0px';
			g_oBlackOver.style.left            = '0px';
			g_oBlackOver.style.width           = document.body.offsetWidth + 'px';
			g_oBlackOver.style.height          = document.body.offsetHeight + 'px';
			g_oBlackOver.style.backgroundColor = 'black';
			g_oBlackOver.style.bottom          = '0px';
			g_oBlackOver.style.right           = '0px';
			g_oBlackOver.style.display         = 'none';
			g_oBlackOver.style.zIndex          = 9999;
			document.body.appendChild(g_oBlackOver);
			f_setOpacity(g_oBlackOver, 50);
		}
		
		// this function is called upon improperly
		if((p_oPopupDiv == g_oPoppedUpDiv) && !p_bPopup){
			g_oPoppedUpDiv.style.display = 'none';
			g_oPoppedUpDiv = null;
		}
		
		// if these div-elements aren't the same, make sure that the one that's not called upon is closed.
		if(p_oPopupDiv != g_oPoppedUpDiv){
			if(g_oPoppedUpDiv != null){
				g_oPoppedUpDiv.style.display = 'none';
			}
			// set a reference for the div-element that is called upon
			g_oPoppedUpDiv = p_oPopupDiv;
		}
		
		f_setOpacity(p_oPopupDiv, 90);
		p_oPopupDiv.style.display  = ((p_bPopup) ? 'block' : 'none');
		g_oBlackOver.style.display = ((p_bPopup) ? 'block' : 'none');
		
		// position div
		f_positionDiv(p_oPopupDiv);
		
		document.body.className = ((p_bPopup) ? 'black' : '');
		
		// make sure this layover is beneath the 'blackOver'
		document.body.appendChild(p_oPopupDiv);
	}
	
	/**
	 * --------------------------------------------------------------------------
	 * function f_startOrderStepsTracking
	 * --------------------------------------------------------------------------
	 */
	function startOrderStepsTracking(){
		// Google
		//urchinTracker('toestel/overzicht');
		pageTracker._trackPageview('order/step1');
		
		// PCT
		//pct_meeting(3899); // Mijn product overzicht
		//pct_meeting(3901); // Start bestelling
	}
	
	/**
	 * -------------------------------------------------------------------------
	 * function f_checkElementForAttribute
	 * -------------------------------------------------------------------------
	 * Description:
	 *   checks if an attribute is set within an element.
	 *
	 * Output:             if attribute exists this function will
	 *                       return the value of the attribute
	 *                     if attribute doesn't exists 'false' is returned
	 */
	function f_checkElementForAttribute(p_oElement, p_sAttribute){
		var w_sAttribute = p_sAttribute.toLowerCase();
		// 'hasAttribute' is available for Firefox 2.0, Safari 3.0 Win, Opera 9.5b, iCab 3.0 and Konqueror 3.5.7
		if(p_oElement.hasAttribute && p_oElement.hasAttribute(w_sAttribute)){
			if(p_oElement.attributes[w_sAttribute].name){
				return p_oElement.attributes[w_sAttribute].value;
			}
		}
		// IE 6, IE 7
		else{
			var w_asAttributes = p_oElement.attributes;
			for(t_sAttributeKey in w_asAttributes){
				if(t_sAttributeKey == w_sAttribute){
					return p_oElement.attributes[w_sAttribute].value;
				}
			}
		}
		return false;
	}
	
	/**
	 * -------------------------------------------------------------------------
	 * function f_clearForm
	 * -------------------------------------------------------------------------
	 * Description:
	 *   clears the form
	 */
	function f_clearForm(p_sFormName){
		var w_aFormChildTypes = [];
		w_aFormChildTypes['textarea'] = 'textarea';
		w_aFormChildTypes['radio']    = 'input';
		w_aFormChildTypes['checkbox'] = 'input';
		w_aFormChildTypes['text']     = 'input';
		w_aFormChildTypes['hidden']   = 'input';
		var w_oForm = document.forms[p_sFormName];
		var w_aoChildNodes = w_oForm.elements;
		for(var i=0; i<w_aoChildNodes.length; i++){
			var t_oChildNode = w_aoChildNodes[i];
			if((typeof t_oChildNode == 'object') && (t_oChildNode.nodeType == 1) && t_oChildNode.type){
				var t_bSelect = ((t_oChildNode.type.substr(0,6) == 'select') ? true : false);
				if(w_aFormChildTypes[t_oChildNode.type] || t_bSelect){
					switch(t_oChildNode.type){
						case 'textarea':{
							t_oChildNode.value = '';
							break;
						}
						case 'radio':{
							t_oChildNode.checked = false;
							break;
						}
						case 'checkbox':{
							t_oChildNode.checked = false;
							break;
						}
						case 'hidden':{
							break;
						}
						case 'text':{
							t_oChildNode.value = '';
							break;
						}
						default:{
							if(t_bSelect){
								t_oChildNode.selectedIndex = 0;
							}
							break;
						}
					} // end switch
				} // end if
			} // end if
		} // end for in
	} // end foreach
	
	
	// <-<-<------ COMMON FUNCIONS FOR THE PHONE HOUSE ------<-<-<
	// <-<-<-<----------- SPECIFIC JS FUNCTIONS -----------<-<-<-<