/*
 *               ____
 *              /\   \
 *             ___\   \___
 *            /\          \
 *            \ \___    ___\
 *        ____ \/__/\   \__/
 *       /\   \    \ \___\    klof  |  innovative web technology
 *      ___\   \___ \/___/
 *     /\          \          klib3/style.js
 *     \ \___    ___\         HTML Element style manipulation
 *      \/__/\   \__/
 *          \ \___\           Copyright 2003-2006, klof
 *           \/___/           http://www.klof.net/k.lib3/
 *
 */
/* Create the master klib3 object if she doesn't exist */
if ( typeof klib3 != "object" )
klib3 = new ( function(){ this._child = 0 } )();
/**
 *  K.Lib3 Style Object
 *  @name    klib3.style
 *  @type    constructor
 *  @access  public
 *  @param   string  template path [optional]
 *  @param   string  compilation path [optional]
 *  @returns object
 *  @syntax  object = &new klib3.style()
 */
klib3.style = function()
{
this._version = "1.0.1";
};
/**
 *  Get the value of a CSS property
 *  @name    get
 *  @type    method
 *  @access  public
 *  @param   object html element
 *  @param   string style property
 *  @returns string
 *  @syntax  object.get( oElement, "background-color" );
 *  @note    style property can be either the CSS or JavaScript style property syntax
 */
klib3.style.prototype.get = function( oElement, sProperty )
{
if ( typeof document.defaultView == "object" && typeof document.defaultView.getComputedStyle != "undefined" )
{
var oCS = document.defaultView.getComputedStyle( oElement, "" );
if ( oCS && oCS.getPropertyValue )
return oCS.getPropertyValue( this.cssProperty( sProperty ) );
}
else if ( oElement.currentStyle )
{
return oElement.currentStyle[ this.scriptProperty( sProperty ) ];
}
return false;
};
/**
 *  Set the style property to a given value
 *  @name    set
 *  @type    method
 *  @access  public
 *  @param   object html element
 *  @param   string style property
 *  @param   mixed  property value
 *  @returns boolean
 *  @syntax  object.set( oElement, "background-color", "#f00" );
 */
klib3.style.prototype.set = function( oElement, sProperty, mValue )
{
return oElement.style[ this.scriptProperty( sProperty ) ] = mValue;
};
/**
 *  Convert a style property in CSS format to that same property in script format
 *  @name    scriptProperty
 *  @type    method
 *  @access  public
 *  @param   string style property
 *  @returns string
 *  @syntax  object.scriptProperty( "background-color" ); // returns "backgroundColor"
 */
klib3.style.prototype.scriptProperty = function( sProperty )
{
var n = 0;
while( ( n = sProperty.indexOf( "-", n ) ) >= 0 )
sProperty = sProperty.substr( 0, n ) + sProperty.charAt( ++n ).toUpperCase() + sProperty.substring( n + 1 );
return sProperty;
//  didn't work in older Safari's/IE's (besides.. having a anonymous function for every hyphen in all properties handled is kinda brute)
//return sProperty.replace( /(-)([a-z])/g, function( a, b, c ){ return c.toUpperCase(); } );
};
/**
 *  Convert a style property in script format to that same property in CSS format
 *  @name    cssProperty
 *  @type    method
 *  @access  public
 *  @param   string style property
 *  @returns string
 *  @syntax  object.cssProperty( "backgroundColor" ); // return background-color
 */
klib3.style.prototype.cssProperty = function( sProperty )
{
return sProperty.replace( /([A-Z])/g, "-$1" ).toLowerCase();
};
/**
 *  Verifies whether a specific style property exists in the provided HTML element
 *  @name    propertyExists
 *  @type    method
 *  @access  public
 *  @param   object HTML element
 *  @param   string style property
 *  @returns boolean
 *  @syntax  object.propertyExists( oElement, "background-color" );
 */
klib3.style.prototype.propertyExists = function( oElement, sProperty )
{
return ( typeof oElement.style[ sProperty ] != "undefined" );
};
// construct the klib3.style Object onto itself so we have access to it's members
klib3.style = new klib3.style;

function DateSet(sWrapper)
{
if ( sWrapper )
this._init( sWrapper);
};
DateSet.prototype._init = function(sWrapper)
{
this._id = sWrapper;
this._wrapper = document.getElementById('date_'+sWrapper);
this._createInput();
var aInputElements = this._wrapper.getElementsByTagName('input');
for (var i=0; i < aInputElements.length; ++i)
{
if (aInputElements[i].id == sWrapper+'_day')
{
this._day = aInputElements[i];
this._day._parent = this;
this._day.onchange = function()
{
this._parent._setDateValue();
}
this._day.onfocus = function()
{
this.value = (this.value != 'DD') ? this.value : ''
}
this._day.onkeypress = this._isNumberKey;
}
if (aInputElements[i].id == sWrapper+'_month')
{
this._month = aInputElements[i];
this._month._parent = this;
this._month.onchange = function()
{
this._parent._setDateValue();
}
this._month.onfocus = function()
{
this.value = (this.value != 'MM') ? this.value : ''
}
this._month.onkeypress = this._isNumberKey;
}
if (aInputElements[i].id == sWrapper+'_year')
{
this._year = aInputElements[i];
this._year._parent = this;
this._year.onchange = function()
{
this._parent._setDateValue();
}
this._year.onfocus = function()
{
this.value = (this.value != 'JJJJ') ? this.value : ''
}
this._year.onkeypress = this._isNumberKey;
}
}
this._setDateValue();
};
DateSet.prototype.invoke = function()
{
};
DateSet.prototype._intval = function( sValue )
{
return parseInt( sValue.replace( /^0+/, "" ) );
};
DateSet.prototype.validate = function()
{
if ( ( this._day.value != "" && this._day.value != "DD" ) && ( this._month.value != "" && this._month.value != "MM" ) && ( this._year.value != "" && this._year.value != "JJJJ" ) )
{
var oNow   = new Date();
var oGiven = new Date( this._intval( this._year.value ), this._intval( this._month.value ) - 1, this._intval( this._day.value ), oNow.getHours(), oNow.getMinutes(), oNow.getSeconds() );
if ( this._intval( this._year.value ) != oGiven.getFullYear() || oGiven.getFullYear() < 1900 || oGiven.getFullYear() > oNow.getFullYear() || this._intval( this._month.value ) - 1 != oGiven.getMonth() || this._intval( this._day.value ) != oGiven.getDate() )
return "Ongeldige datum opgegeven";
return true;
}
return false;
};
DateSet.prototype.getScreenElement = function()
{
return Survey.findScreenElement( this._wrapper );
};
DateSet.prototype._isNumberKey = function( e )
{
e = e || window.event;
var charCode = typeof e.which != "undefined" ? e.which : e.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
};
/* add extension specific functions */
DateSet.prototype._createInput = function()
{
this._answerinput = document.createElement( "input" );
this._answerinput.type = "hidden";
this._answerinput.name = this._id;
this._wrapper.appendChild( this._answerinput );
};
DateSet.prototype._setDateValue = function()
{
if ( this._day.value.length < 2 && parseInt( this._day.value ) < 10 )
this._day.value = "0" + this._day.value;
if ( this._month.value.length < 2 && parseInt( this._month.value ) < 10 )
this._month.value = "0" + this._month.value;
var sYear = parseInt( this._year.value.replace( /^0+/, "" ) ) + "";
if ( sYear.length <= 2 && parseInt( sYear ) < 1900 )
this._year.value = parseInt( sYear ) + ( parseInt( sYear ) <= ( ( new Date() ).getFullYear() - 2000 ) ? 2000 : 1900 );
this._answerinput.value = this._year.value + this._month.value + this._day.value;
};
function AgeCheck( sWrapper )
{
this._init( sWrapper);
};
AgeCheck.prototype = new DateSet;
AgeCheck.prototype.validate = function()
{
if ( ( this._day.value != "" && this._day.value != "DD" ) && ( this._month.value != "" && this._month.value != "MM" ) && ( this._year.value != "" && this._year.value != "JJJJ" ) )
{
var oNow     = new Date();
var oCompare = new Date( oNow.getYear() - 18, oNow.getMonth(), oNow.getDate(), oNow.getHours(), oNow.getMinutes(), oNow.getSeconds() );
var oGiven   = new Date( this._intval( this._year.value ), this._intval( this._month.value ) - 1, this._intval( this._day.value ), oNow.getHours(), oNow.getMinutes(), oNow.getSeconds() );
if ( this._intval( this._year.value ) != oGiven.getFullYear() || oGiven.getFullYear() < 1900 || oGiven.getFullYear() > oNow.getFullYear() || this._intval( this._month.value ) - 1 != oGiven.getMonth() || this._intval( this._day.value ) != oGiven.getDate() )
return "Ongeldige datum opgegeven";
else if ( Math.floor( ( oCompare.getTime() - oGiven.getTime() ) / 1000 ) < 0 )
return "Helaas, je bent nog niet oud genoeg.";
return true;
}
return false;
};

function Checkbox( sName )
{
this.init( sName );
};
Checkbox.prototype.init = function( sName )
{
this._checkboxName = sName;
this._checkboxLabel = document.getElementById( "label_" + this._checkboxName );
this._checkboxInput = this._checkboxLabel.getElementsByTagName( "input" );
this._checkboxFieldset = this._checkboxLabel.parentNode;
for ( var i = 0 ; i < this._checkboxInput.length; i++ )
{
if ( this._checkboxInput[ i ].type == "checkbox" )
{
this._checkboxInput[ i ]._checkboxImage = document.getElementById( "img_" + this._checkboxInput[ i ].id );
if ( this._checkboxInput[ i ]._checkboxImage != null )
{
this._checkboxInput[ i ]._checkboxImage._checkboxParent = this;
this._checkboxInput[ i ]._checkboxImage._checkboxIndex = i;
this._checkboxInput[ i ]._checkboxImage.onmouseover = this.__onmouseover;
this._checkboxInput[ i ]._checkboxImage.onmouseout = this.__onmouseout;
this._checkboxInput[ i ]._checkboxImage.parentNode._checkboxParent = this;
this._checkboxInput[ i ]._checkboxImage.parentNode._checkboxIndex = i;
this._checkboxInput[ i ]._checkboxImage.parentNode.onmouseover = this.__onmouseover;
this._checkboxInput[ i ]._checkboxImage.parentNode.onmouseout = this.__onmouseout;
this._checkboxInput[ i ]._checkboxImage.onclick = this.__onclickImage;
}
this._checkboxInput[ i ]._checkboxParent = this;
this._checkboxInput[ i ]._checkboxIndex = i;
this._checkboxInput[ i ].__onclick = this.__onclick;
if( typeof this._checkboxInput[ i ].onclick == "function" )
this._checkboxInput[ i ]._onclick = this._checkboxInput[ i ].onclick;
this._checkboxInput[ i ].onclick = function()
{
this.__onclick();
if( typeof this._onclick == "function" )
this._onclick();
}
this._checkboxInput[ i ].onchange = this.__onchange;
this._checkboxInput[ i ].onblur = this.__onblur;
this._checkboxInput[ i ]._checkboxImage.parentNode.__onclick = this.__onclick;
//this._checkboxInput[ i ]._checkboxImage.parentNode.onclick = this._checkboxInput[ i ]._checkboxImage.onclick;
if ( this._checkboxInput[ i ].checked )
this.select( i );
}
}
};
Checkbox.prototype.invoke = function()
{
};
Checkbox.prototype.validate = function()
{
return true;
};
Checkbox.prototype.getScreenElement = function()
{
return Survey.findScreenElement( this._checkboxFieldset );
};
Checkbox.prototype.select = function( nIndex )
{
if ( typeof this._select == "undefined" || this._select == false )
{
this._select = true;
if ( this._checkboxInput[ nIndex ]._checkboxImage != null )
{
this._clearStyles( this._checkboxInput[ nIndex ]._checkboxImage );
this._checkboxInput[ nIndex ]._checkboxImage.className += this._checkboxInput[ nIndex ].checked ? " checked" : " hover";
}
this._select = false;
}
};
Checkbox.prototype.deselect = function( nIndex )
{
if ( typeof this._deselect == "undefined" || this._deselect == false )
{
this._deselect = true;
if ( this._checkboxInput[ nIndex ]._checkboxImage != null )
{
this._clearStyles( this._checkboxInput[ nIndex ]._checkboxImage );
this._checkboxInput[ nIndex ]._checkboxImage.className += " unchecked";
}
this._deselect = false;
}
};
Checkbox.prototype.onmouseover = function( nIndex )
{
if ( this._checkboxInput[ nIndex ] != null )
this.select( nIndex );
};
Checkbox.prototype.onmouseout = function( nIndex )
{
if ( this._checkboxInput[ nIndex ] != null )
if ( !this._checkboxInput[ nIndex ].checked )
this.deselect( nIndex );
};
Checkbox.prototype.onclick = function( nIndex )
{
if ( this._checkboxInput[ nIndex ] != null )
{
if ( !this._checkboxInput[ nIndex ].checked )
this.deselect( nIndex );
this.select( nIndex );
}
};
Checkbox.prototype.onchange = function( nIndex )
{
if ( this._checkboxInput[ nIndex ] != null )
{
if ( this._checkboxInput[ nIndex ].checked )
this.select( nIndex );
else
this.deselect( nIndex );
}
};
Checkbox.prototype.onblur = function( nIndex )
{
if ( this._checkboxInput[ nIndex ] != null )
{
if ( this._checkboxInput[ nIndex ].checked )
this.select( nIndex );
else
this.deselect( nIndex );
}
};
Checkbox.prototype._clearStyles = function( oElement )
{
oElement.className = oElement.className.replace( /unchecked/gi, '' );
oElement.className = oElement.className.replace( /hover/gi, '' );
oElement.className = oElement.className.replace( /checked/gi, '' );
};
Checkbox.prototype.__onmouseover = function()
{
this._checkboxParent.onmouseover( this._checkboxIndex );
};
Checkbox.prototype.__onmouseout = function()
{
this._checkboxParent.onmouseout( this._checkboxIndex );
}
Checkbox.prototype.__onclickImage = function()
{
if ( this._checkboxParent._checkboxInput[ this._checkboxIndex ] != null )
{
// only handle event in IE, hence the input event will not be triggered
if ( window.ActiveXObject )
{
this._checkboxParent._checkboxInput[ this._checkboxIndex ].checked = !this._checkboxParent._checkboxInput[ this._checkboxIndex ].checked;
this._checkboxParent.onclick( this._checkboxIndex );
}
}
};
Checkbox.prototype.__onclick = function()
{
this._checkboxParent.onclick( this._checkboxIndex );
};
Checkbox.prototype.__onchange = function()
{
this._checkboxParent.onchange( this._checkboxIndex );
};
Checkbox.prototype.__onblur = function()
{
this._checkboxParent.onblur( this._checkboxIndex );
};
function Slider( sWrapper )
{
this.init( sWrapper );
}
Slider.prototype.init = function( sWrapper )
{
this.disable();
this._bActive = false;
this._setElements( sWrapper );
this._createInput();
this._setEventHandlers();
this._setDefaults();
this.enable();
};
Slider.prototype.invoke = function()
{
this._setDefaults();
};
Slider.prototype.validate = function()
{
return this._answerinput.value != "";
};
Slider.prototype.getScreenElement = function()
{
return Survey.findScreenElement( this._wrapper );
};
Slider.prototype.slide = function( e )
{
// slide
if ( this._orientation == "vertical" )
this._slideVertical( e );
else
this._slideHorizontal( e );
// get value
var aPos = this.getCursorPosition( e );
var nPos = this._orientation == "horizontal" ? aPos[ 0 ] : aPos[ 1 ];
// set value
if ( nPos )
this.setValue( nPos );
};
Slider.prototype.setValue = function( nPos )
{
var nValue = this._valueMin + ( nPos * this._valueDelta );
if( nValue < this._valueMin )
nValue = this._valueMin;
if( nValue > this._valueMax )
nValue = this._valueMax;
if ( nValue )
{
this._input.value = nValue;
this.setAlpha( nValue );
}
};
Slider.prototype.setAlpha = function( nValue )
{
var nDelta = ( this._alphaMax - this._alphaMin ) * nValue;
for ( var i = 0; i < this._aCaption.length; i++ )
{
var nOpacity = 0;
if ( this._aCaption[ i ].className.match( /slidercaptionmax/i ) )
nOpacity = ( ( nDelta ) * ( this._alphaMax - this._alphaMin ) );
else if ( this._aCaption[ i ].className.match( /slidercaptionmin/i ) )
nOpacity = ( this._alphaMax - nDelta );
nOpacity = this._alphaMin + ( nOpacity * ( this._alphaMax - this._alphaMin ) );
this._aCaption[ i ].style.opacity = nOpacity;
this._aCaption[ i ].style.filter  = "alpha( opacity=" + ( nOpacity * 100 ) + ")";
}
};
Slider.prototype.enable = function()
{
this._disabled = false;
if ( this._container )
this._container.className = this._container.className.replace( / disabled/gi );
};
Slider.prototype.disable = function()
{
this._disabled = true;
if ( this._container )
this._container.className += " disabled";
};
/* event handlers */
Slider.prototype.mousemoveHandler = function( e )
{
if ( !this._parent._disabled && this._parent._bActive )
this._parent.slide( e );
};
Slider.prototype.mousedownHandler = function( e )
{
this._parent._bActive = true;
if ( !this._parent._disabled )
this._parent.slide( e );
};
Slider.prototype.mouseupHandler = function( e )
{
this._parent._bActive = false;
if ( !this._parent._disabled )
this._parent.slide( e );
};
Slider.prototype.mouseoutHandler = function( e )
{
this._parent._bActive = false;
};
Slider.prototype.onselectstartHandler = function( e )
{
return false;
};
/* private functions */
Slider.prototype._setElements = function( sWrapper )
{
this._wrapper = document.getElementById( sWrapper );
this._container = null;
this._aCaption = Array();
this._bar = null;
this._handle = null;
var aChild = this._wrapper.getElementsByTagName( "DIV" );
for ( var i=0; i < aChild.length; i++ )
{
if ( aChild[ i ].className.match( /slidercontainer vertical/i ) )
{
this._orientation = "vertical";
this._container = aChild[ i ];
}
else if ( aChild[ i ].className.match( /slidercontainer/i ) )
{
this._container = aChild[ i ];
}
else if ( aChild[ i ].className.match( /slidercaption/i ) )
{
this._aCaption.push( aChild[ i ] );
}
else if ( aChild[ i ].className.match( /sliderbar/i ) )
{
this._bar = aChild[ i ];
}
else if ( aChild[ i ].className.match( /sliderhandle/i ) )
{
this._handle = aChild[ i ];
}
}
return this._container != null;
};
Slider.prototype._createInput = function()
{
this._input = document.createElement( "input" );
this._input.type = "hidden";
this._input.name = this._wrapper.id + "value";
this._wrapper.appendChild( this._input );
}
Slider.prototype._setDefaults = function( nValue )
{
this._valueMin = 0;
this._valueMax = 1;
this._alphaMin = 0.1;
this._alphaMax = 1;
this._orientation = this._orientation != null ? this._orientation : "horizontal";
this._bar._pos = this.getElementPosition( this._bar );
this._bar._width = parseInt( this._bar.offsetWidth );
this._bar._height = parseInt( this._bar.offsetHeight );
this._handle._width = parseInt( this._handle.offsetWidth );
this._handle._height = parseInt( this._handle.offsetHeight );
this._handle._rightbound = this._bar._width - this._handle._width;
this._handle._bottombound = this._bar._height - this._handle._height;
this._valueDelta = ( this._valueMax - this._valueMin ) / ( this._orientation == "horizontal" ? this._bar._width : this._bar._height );
// set initial value
if ( nValue >= this._valueMin && nValue <= this._valueMax )
{
this.setValue( nValue );
if ( this._orientation == "vertical" )
this._handle.style.top = ( this._bar._height * nValue ) - ( this._handle._height / 2 ) + "px";
else
this._handle.style.left = ( this._bar._width * nValue ) - ( this._handle._width / 2 ) + "px";
this.setAlpha(nValue);
}
};
Slider.prototype._setEventHandlers = function()
{
this._container.onmousemove = this.mousemoveHandler;
this._container._parent = this;
for ( var i=0; i < this._aCaption.length; i++ )
this._aCaption[ i ].onselectstart = this.onselectstartHandler;
//this._handle.onmouseover = this.mouseoverHandler;
this._handle.onmousedown = this.mousedownHandler;
this._handle.onmouseup = this.mouseupHandler;
this._handle._parent = this;
this._bar.onmousedown = this.mousedownHandler;
this._bar.onmouseup = this.mouseupHandler;
this._bar._parent = this;
};
Slider.prototype._slideHorizontal = function( e )
{
e = e ? e : window.event;
var aPos = this.getCursorPosition( e, this._handle );
this._handle.style.left = aPos[ 0 ] - ( this._handle._width / 2 ) + "px";
if( this._handle.style.left )
{
if( parseInt( this._handle.style.left ) < 0 )
this._handle.style.left = "0px";
if( parseInt( this._handle.style.left ) > this._handle._rightbound )
this._handle.style.left = this._handle._rightbound + "px";
}
};
Slider.prototype._slideVertical = function( e )
{
e = e ? e : window.event;
var aPos = this.getCursorPosition( e, this._handle );
this._handle.style.top = aPos[ 1 ] - ( this._handle._height / 2 ) + "px";
if( this._handle.style.top )
{
if( parseInt( this._handle.style.top ) < 0 )
this._handle.style.top = "0px";
if( parseInt( this._handle.style.top ) > this._handle._bottombound )
this._handle.style.top = this._handle._bottombound + "px";
}
};
Slider.prototype.getCursorPosition = function getCursorPosition( e )
{
e = e ? e : window.event;
var aPos = this._bar._pos;
var aCoords= new Array( 0, 0 );
if( isNaN( window.scrollX ) )
aCoords = new Array( e.clientX + document.documentElement.scrollLeft + document.body.scrollLeft - aPos[ 0 ],
e.clientY + document.documentElement.scrollTop + document.body.scrollTop - aPos[ 1 ] );
else
aCoords = new Array( e.clientX + window.scrollX - aPos[ 0 ],  e.clientY + window.scrollY - aPos[ 1 ] );
return aCoords;
};
Slider.prototype.getElementPosition = function getElementPosition( oElement )
{
var aPosition = new Array( 0, 0 );
if ( oElement.offsetParent )
{
do
{
var nBorderWidth = 0;
if( isNaN( window.scrollX ) )
{
nBorderWidth = parseInt( klib3.style.get( oElement, "borderWidth" ) );
aPosition[ 0 ] += oElement.offsetLeft + ( !isNaN( nBorderWidth ) ? nBorderWidth : 0 );
aPosition[ 1 ] += oElement.offsetTop + ( !isNaN( nBorderWidth ) ? nBorderWidth : 0 );
}
else
{
aPosition[ 0 ] += oElement.offsetLeft + parseInt( klib3.style.get( oElement, "borderLeftWidth" ) );
aPosition[ 1 ] += oElement.offsetTop + parseInt( klib3.style.get( oElement, "borderTopWidth" ) );
}
}
while ( oElement = oElement.offsetParent );
}
return aPosition;
};
Slider.prototype._snapInit = function()
{
this._snapCreateInput();
}
Slider.prototype.invoke = function()
{
/* add gender to class name */
if ( this._wrapper.id == "unselfishnessinbed" && typeof this._wrapper._invoked == "undefined" )
{
var aChildren = this._wrapper.getElementsByTagName( "DIV" );
var sGender = document.getElementById( "youpartner" ).value;
var sGenderYou = sGender.substr( 0, 1 ) <= 1  ? 'male' : 'female';
var sGenderPartner = sGender.substr( 2, 1 ) <= 1  ? 'male' : 'female';
for ( var i = 0; i < aChildren.length; i++ )
{
if ( aChildren[ i ].className.match( /slidercaptionmin/gi ) )
aChildren[ i ].className = aChildren[ i ].className.replace( /selfish/gi, 'selfish_' + sGenderYou );
else if( aChildren[ i ].className.match( /slidercaptionmax/gi ) )
aChildren[ i ].className = aChildren[ i ].className.replace( /selfish/gi, 'selfish_' + sGenderPartner );
}
}
this._snap       = true;
this._snapVisual = false;
if ( typeof this._jmt == "undefined" )
this._jmt = true;
this._setDefaults( this._input.value == "" ? 0.5 : this._input.value );
this._wrapper._invoked = true;
};
/* overrule slider methods */
Slider.prototype.setValue = function( nPos )
{
var nValue = this._valueMin + ( nPos * this._valueDelta );
if( nValue < this._valueMin )
nValue = this._valueMin;
if( nValue > this._valueMax )
nValue = this._valueMax;
if ( nValue )
{
this._input.value = nValue;
if ( typeof this._snap == "boolean" && this._snap )
this._snapSetAnswer( nValue );
this.setAlpha( nValue );
}
};
/* add extension specific functions */
Slider.prototype._snapCreateInput = function()
{
this._answerinput = document.createElement( "input" );
this._answerinput.type = "hidden";
this._answerinput.name = this._wrapper.id;
this._wrapper.appendChild( this._answerinput );
};
Slider.prototype._snapSetAnswer = function( nValue )
{
if ( !this._answerinput )
{
nValue = .5;
this._snapCreateInput();
}
if (this._snapAnswers)
{
var tmpAnswer = this._answerinput.value;
var nTotalSegments = this._snapAnswers.length - 1;
var nSegmentSize = (1 / nTotalSegments);
var nSegment = Math.round(nValue / nSegmentSize);
var newAnswer = this._snapAnswers[nSegment];
if (newAnswer != tmpAnswer)
this._updateAnswer(newAnswer, nSegment);
}
};
Slider.prototype._updateAnswer = function(sAnswer, nSegment)
{
if (sAnswer.indexOf('have_') == 0 || sAnswer.indexOf('want_') == 0)
{
var oSliderVisual = document.getElementById( 'slidervisual_'+ this._wrapper.id );
oSliderVisual.style.backgroundPosition = '0px -'+(nSegment * 160)+'px';
}
this._answerinput.value = sAnswer;
};

function Radio( sName )
{
this.init( sName );
};
Radio.prototype.init = function( sName )
{
this._radioName = sName;
this._radioInput = document.getElementsByTagName ? document.getElementsByName( this._radioName ) : document.getElementById( this._radioName );
for ( var i = 0 ; i < this._radioInput.length; i++ )
if ( this._radioInput[ i ].type != "radio" || this._radioInput[ i ].name != sName )
delete( this._radioInput[ i ] );
for ( var i = 0 ; i < this._radioInput.length; i++ )
{
this._radioInput[ i ]._radioImage = document.getElementById( "img_" + this._radioName + "_" + this._radioInput[ i ].value );
if ( typeof this._radioInput[ i ]._radioImage != "undefined" )
{
this._radioInput[ i ]._radioImage._radioParent = this;
this._radioInput[ i ]._radioImage._radioIndex = i;
this._radioInput[ i ]._radioImage.onmouseover = this.__onmouseover;
this._radioInput[ i ]._radioImage.onmouseout = this.__onmouseout;
this._radioInput[ i ]._radioImage.parentNode._radioParent = this;
this._radioInput[ i ]._radioImage.parentNode._radioIndex = i;
this._radioInput[ i ]._radioImage.parentNode.onmouseover = this.__onmouseover;
this._radioInput[ i ]._radioImage.parentNode.onmouseout = this.__onmouseout;
this._radioInput[ i ]._radioImage.__onclick = this.__onclick;
if( typeof this._radioInput[ i ]._radioImage.onclick == "function" )
this._radioInput[ i ]._radioImage._onclick = this._radioInput[ i ]._radioImage.onclick;
this._radioInput[ i ]._radioImage.onclick = function()
{
this.__onclick();
if( typeof this._onclick == "function" )
this._onclick();
}
this._radioInput[ i ]._radioImage.parentNode.__onclick = this.__onclick;
this._radioInput[ i ]._radioImage.parentNode.onclick = this._radioInput[ i ]._radioImage.onclick;
if ( this._radioInput[ i ].checked )
this.select( i );
}
this._radioInput[ i ]._radioParent = this;
this._radioInput[ i ]._radioIndex = i;
this._radioInput[ i ].onclick = this.__onclick;
}
};
Radio.prototype.invoke = function()
{
};
Radio.prototype.validate = function()
{
for ( var i = 0; i < this._radioInput.length; ++i )
if ( this._radioInput[ i ].checked )
return true;
return false;
};
Radio.prototype.getScreenElement = function()
{
if ( this._radioInput.length )
return Survey.findScreenElement( this._radioInput[ 0 ] );
return false;
};
Radio.prototype.select = function( nIndex )
{
for ( var i = nIndex; i >= 0; i-- )
{
// clear old styles
this._clearStyles( this._radioInput[ i ]._radioImage );
// add new style
this._radioInput[ i ]._radioImage.className += this._radioInput[ i ].checked ? " checked" : " hover";
break;
}
};
Radio.prototype.deselect = function()
{
for ( var i = 0; i < this._radioInput.length; i++ )
{
if ( this._radioInput[ i ].checked )
this._radioActive = i;
if ( !this._radioSlider && !this._radioInput[ i ].checked )
{
// clear old styles
this._clearStyles( this._radioInput[ i ]._radioImage );
// add new style
this._radioInput[ i ]._radioImage.className += " unchecked";
}
}
};
Radio.prototype.onmouseover = function( nIndex )
{
if ( typeof this._radioInput[ nIndex ].disabled == "undefined" || this._radioInput[ nIndex ].disabled == false )
this.select( nIndex );
};
Radio.prototype.onmouseout = function( nIndex )
{
if ( typeof this._radioInput[ nIndex ].disabled == "undefined" || this._radioInput[ nIndex ].disabled == false )
{
this.deselect();
if ( this._radioInput[ nIndex ].checked )
this.select( nIndex );
}
};
Radio.prototype.onclick = function( nIndex )
{
    if ( typeof this._radioInput[ nIndex ].disabled == "undefined" || this._radioInput[ nIndex ].disabled == false )
{
this.deselect();
this._radioInput[ nIndex ].focus();
this._radioInput[ nIndex ].checked = true;
this.select( nIndex );
this.deselect();
if( typeof this._radioInput[ nIndex ].onfocus == "function" )
this._radioInput[ nIndex ].onfocus();
}
};
Radio.prototype._clearStyles = function( oElement )
{
oElement.className = oElement.className.replace( /unchecked/gi, '' );
oElement.className = oElement.className.replace( /hover/gi, '' );
oElement.className = oElement.className.replace( /checked/gi, '' );
};
Radio.prototype.__onmouseover = function()
{
this._radioParent.onmouseover( this._radioIndex );
};
Radio.prototype.__onmouseout = function()
{
this._radioParent.onmouseout( this._radioIndex );
};
Radio.prototype.__onclick = function()
{
this._radioParent.onclick( this._radioIndex );
};
function DragDrop( sName )
{
this.init( sName );
}
DragDrop.prototype.init = function( sName )
{
this._name = sName;
this._draggers = new Array();
this._droppers = new Array();
this._self = "oDragDrop_" + this._name;
window[ this._self ] = this;
this._wrapper = document.getElementById( sName + "wrapper" );
this._input = document.getElementById( this._name );
    this._invoked = false;
};
DragDrop.prototype.invoke = function()
{
    if (!this._invoked)
    {
        this._invoked = true;
        this._setDefaults();
    }
};
DragDrop.prototype.getScreenElement = function()
{
return Survey.findScreenElement( this._wrapper );
};
DragDrop.prototype.validate = function()
{
var bMandatory = false;
var bValid     = true;
var aValue     = null;
for ( var i = 0; i < this._droppers.length; ++i )
{
if ( this._droppers[ i ].className.match( /mandatory/ ) )
{
if ( !aValue )
{
var aMatch = this._droppers[ i ].id.match( /^.*_([a-z]+)_.*$/ );
if ( aMatch.length > 1 )
{
var oInput = document.getElementById( aMatch[ 1 ] );
if ( oInput )
aValue = oInput.value.split( "," );
}
}
if ( aValue && aValue.length >= i )
bValid = aValue[ i ] != "" && aValue[ i ] != null && aValue[ i ] != "null";
}
}
return bValid;
};
DragDrop.prototype._setDefaults = function()
{
this._wrapper._pos = this.getElementPosition( this._wrapper );
// reset (after refresh for example)
this._input.value = "";
// retrieve all div's in wrapper
var aTMP = this._wrapper.getElementsByTagName( "DIV" );
// keep track of numbers
var nDragger = 0;
var nDropper = 0;
for( var i=0; i < aTMP.length; i++ )
{
if ( aTMP[ i ].className.match( /dragger/gi ) )
{
this._draggers[ nDragger ] = new Dragger( nDragger, this, aTMP[ i ] );
++nDragger;
}
else if ( aTMP[ i ].className.match( /dropper/gi ) )
{
this._droppers[ nDropper ] = document.getElementById( "dropper_" + this._name + "_" + ( nDropper + 1 ) );
var aPosDropper = this.getElementPosition( this._droppers[ nDropper ] );
this._droppers[ nDropper ]._pos = [ ( aPosDropper[ 0 ] - this._wrapper._pos[ 0 ] ), ( aPosDropper[ 1 ] - this._wrapper._pos[ 1 ] ) ];
this._droppers[ nDropper ]._width = this._droppers[ nDropper ].offsetWidth;
this._droppers[ nDropper ]._height = this._droppers[ nDropper ].offsetHeight;
this._droppers[ nDropper ]._value = null;
++nDropper;
}
}
// clean up
aTMP = null;
};
DragDrop.prototype.getDropperValue = function ( nDropper )
{
var mReturn = null;
for( var i=0; i < this._droppers.length; i++ )
if( i == nDropper )
mReturn = this._droppers[ i ]._value;
return mReturn;
};
DragDrop.prototype.setDropperValue = function( nDropper, mValue )
{
var sValue = "";
for( var i=0; i < this._droppers.length; i++ )
{
if( i == nDropper )
this._droppers[ i ]._value = mValue;
sValue += ( i > 0 ) ? "," + this._droppers[ i ]._value : this._droppers[ i ]._value;
}
this._input.value = sValue;
};
function Dragger( iNumber, oParent, oElement )
{
this._dragdrop  = oParent;
this._parent    = this;
this._number    = iNumber;
this._element        = oElement;
this._element._parent   = this;
this._element._top      = this._element.offsetTop;
this._element._left     = this._element.offsetLeft;
this._element._width    = this._element.offsetWidth;
this._element._height   = this._element.offsetHeight;
// image is required
aImage = this._element.getElementsByTagName( "img" );
this._image= aImage[ 0 ];
this._fading   = false;
this._opacity  = 0;
this._dragging = false;
document.onmousemove = this.move;
document.onmouseup = this.endDrag;
this._element.onmousedown = this.startDrag;
};
Dragger.prototype.startDrag = function startDrag( e )
{
document._oDragDrop = this._parent;
this._parent._dragging = true;
return false;
};
Dragger.prototype.endDrag = function endDrag( e )
{
if( document._oDragDrop )
{
var oDragger = document._oDragDrop;
var aPosCursor = oDragger._dragdrop.getCursorPosition( e );
var bDropped = false;
for( var i=0; i < oDragger._dragdrop._droppers.length; i++ )
{
var nPosX = oDragger._dragdrop._droppers[ i ]._pos[ 0 ];
var nPosY = oDragger._dragdrop._droppers[ i ]._pos[ 1 ];
var nWidth = oDragger._dragdrop._droppers[ i ]._width;
var nHeight = oDragger._dragdrop._droppers[ i ]._height;
// does dropper already have content?
var mValue = oDragger._dragdrop.getDropperValue( i );
// if box is filled ...
if ( ( aPosCursor[ 0 ] > nPosX && aPosCursor[ 0 ] < ( nPosX + nWidth ) ) && ( aPosCursor[ 1 ] > nPosY && aPosCursor[ 1 ] < ( nPosY + nHeight ) ) )
{
if ( mValue != null )
oDragger._dragdrop._draggers[ mValue ].reset();
// set value
oDragger._element.style.left = nPosX + ( ( nWidth - oDragger._element._width ) / 2 ) + "px";
oDragger._element.style.top = nPosY + ( ( nHeight - oDragger._element._height ) / 2 ) + "px";
oDragger._dragdrop.setDropperValue( i, oDragger._number );
bDropped = true;
}
else if ( mValue == oDragger._number )
{
oDragger._dragdrop.setDropperValue( i, null );
}
}
if ( !bDropped )
oDragger.reset();
oDragger.deLightDroppers();
oDragger._element.style.zIndex = "1";
oDragger._dragging = false;
}
document._oDragDrop = null;
return false;
};
Dragger.prototype.reset = function()
{
this._parent._element.style.left = this._parent._element._left + "px";
this._parent._element.style.top= this._parent._element._top + "px";
};
Dragger.prototype.deLightDroppers = function deLightDroppers()
{
for( var i=0; i < this._dragdrop._droppers.length; i++ )
if ( this._dragdrop._droppers[ i ].style )
this._dragdrop._droppers[ i ].style.backgroundColor = "#1D1F20";
};
Dragger.prototype.move = function move( e )
{
if( document._oDragDrop )
{
var oDragger = document._oDragDrop;
var aPosCursor = oDragger._dragdrop.getCursorPosition( e );
oDragger._element.style.left = aPosCursor[ 0 ] - ( oDragger._element.offsetWidth / 2 ) + "px";
oDragger._element.style.top = aPosCursor[ 1 ] - ( oDragger._element.offsetHeight / 2 ) + "px";
//light up dropbox
var bDeLight = true;
for( var i=0; i < oDragger._dragdrop._droppers.length; i++ )
{
var nPosX = oDragger._dragdrop._droppers[ i ]._pos[ 0 ];
var nPosY = oDragger._dragdrop._droppers[ i ]._pos[ 1 ];
var nWidth = oDragger._dragdrop._droppers[ i ]._width;
var nHeight = oDragger._dragdrop._droppers[ i ]._height;
if ( ( aPosCursor[ 0 ] > nPosX && aPosCursor[ 0 ] < ( nPosX + nWidth ) ) && ( aPosCursor[ 1 ] > nPosY && aPosCursor[ 1 ] < ( nPosY + nHeight ) ) )
{
oDragger._dragdrop._droppers[ i ].style.backgroundColor = "#666";
bDeLight = false;
}
}
if ( bDeLight )
oDragger.deLightDroppers();
}
return false;
};
DragDrop.prototype.getElementPosition = function( oElement )
{
var aPosition = new Array( 0, 0 );
if ( oElement.offsetParent )
{
do
{
var nBorderWidth = 0;
if( isNaN( window.scrollX ) )
{
nBorderWidth = parseInt( klib3.style.get( oElement, "borderWidth" ) );
aPosition[ 0 ] += oElement.offsetLeft + ( !isNaN( nBorderWidth ) ? nBorderWidth : 0 );
aPosition[ 1 ] += oElement.offsetTop + ( !isNaN( nBorderWidth ) ? nBorderWidth : 0 );
}
else
{
aPosition[ 0 ] += oElement.offsetLeft + parseInt( klib3.style.get( oElement, "borderLeftWidth" ) );
aPosition[ 1 ] += oElement.offsetTop + parseInt( klib3.style.get( oElement, "borderTopWidth" ) );
}
}
while ( oElement = oElement.offsetParent );
}
return aPosition;
};
DragDrop.prototype.getCursorPosition = function( e )
{
e = e ? e : window.event;
var aPos = this._wrapper._pos;
var aCoords= new Array( 0, 0 );
if( isNaN( window.scrollX ) )
aCoords = new Array( e.clientX + document.documentElement.scrollLeft + document.body.scrollLeft - aPos[ 0 ],
e.clientY + document.documentElement.scrollTop + document.body.scrollTop - aPos[ 1 ] );
else
aCoords = new Array( e.clientX + window.scrollX - aPos[ 0 ],  e.clientY + window.scrollY - aPos[ 1 ] );
return aCoords;
};
function SurveyDuration()
{
this._display    = null;
this._value      = 1;
this._repeat     = null;
this._accelerate = 1;
window[ ( this._self = "SurveyDuration" ) ] = this;
}; 
SurveyDuration.prototype._init = function( oOffset )
{
this._duration = oOffset.parentNode.parentNode;
var aDiv = this._duration.getElementsByTagName( "div" );
for ( var i = 0; i < aDiv.length; ++i )
if ( aDiv[ i ].className.match( /display/ ) )
this._display = aDiv[ i ];
var aInput = this._duration.getElementsByTagName( "input" );
for ( var i = 0; i < aInput.length; ++i )
this._input = aInput[ i ];
this._duration._control   = this;
this._duration.onmouseout = this._duration.onmouseup = function()
{
this._control.stoprepeat();
};
this._input.value = this._value;
}
SurveyDuration.prototype.change = function( oClick, nAmount )
{
if ( !this._display )
this._init( oClick );
this._change( nAmount );
this._repeat     = nAmount;
this._accelerate = 1;
this._timer      = setTimeout( this._self + "._autoChange();", 300 );
};
SurveyDuration.prototype._change = function( nAmount )
{
if ( this._value + nAmount > 0 && this._value + nAmount <= 720 )
this._value += nAmount;
else if ( this._value + nAmount <= 0 )
this._value  = 1;
else if ( this._value + nAmount > 720 )
this._value  = 720;
this._input.value = this._value;
this.update();
};
SurveyDuration.prototype._autoChange = function()
{
clearTimeout( this._timer );
if ( this._repeat != null )
{
++this._accelerate;
if ( this._accelerate == 10 && Math.abs( this._repeat ) < 5 )
{
this._repeat = ( this._repeat < 0 ? -1 : 1 ) * 5;
this._value  = Math.floor( this._value / 5 ) * 5;
}
this._change( this._repeat );
this._timer = setTimeout( this._self + "._autoChange();", 200 );
}
};
SurveyDuration.prototype.stoprepeat = function()
{
clearTimeout( this._timer );
this._repeat = null;
};
SurveyDuration.prototype.update = function()
{
var nHour    = Math.floor( this._value / 60 );
var nMinute  = this._value - ( nHour * 60 );
var sDisplay = "" + ( nHour < 10 ? "0" + nHour : nHour ) + ( nMinute < 10 ? "0" + nMinute : nMinute );
var aImage   = this._display.getElementsByTagName( "img" );
for ( i = 0; i < aImage.length; ++i )
aImage[ i ].src = "/media/image/digit/" + sDisplay.substr( i, 1 ) + ".jpg";
};
Duration = new SurveyDuration();

function displayTableRows( oTable )
{
if ( oTable )
window[ "__displayTable" ] = oTable;
else
oTable = window[ "__displayTable" ];
var aTR = oTable.getElementsByTagName( "tr" );
for ( var i = 0; i < aTR.length; ++i )
if ( aTR[ i ].className.match( /collection.*hidden/ ) )
{
aTR[ i ].className = aTR[ i ].className.replace( /\s*hidden\s*/g, " nohide" );
setTimeout( "displayTableRows();", 50 );
break;
}
else if ( aTR[ i ].className.match( /more/ ) )
{
var aLinks = aTR[ i ].getElementsByTagName("a");
aLinks[0].onclick = function(){hideTableRows();};
aLinks[0].innerHTML = aLinks[0].innerHTML.replace("Toon alle","Verberg");
}
}
function hideTableRows( oTable )
{
if ( oTable )
window[ "__displayTable" ] = oTable;
else
oTable = window[ "__displayTable" ];
var aTR = oTable.getElementsByTagName( "tr" );
for ( var i = 0; i < aTR.length; ++i )
if ( aTR[ i ].className.match( /collection.*nohide/ ) )
{
aTR[ i ].className = aTR[ i ].className.replace( /\s*nohide\s*/g, " hidden" );
setTimeout( "hideTableRows();", 50 );
break;
}
else if ( aTR[ i ].className.match( /more/ ) )
{
var aLinks = aTR[ i ].getElementsByTagName("a");
aLinks[0].onclick = function(){displayTableRows();};
aLinks[0].innerHTML = aLinks[0].innerHTML.replace("Verberg","Toon alle");
}
}
function findbreakdown( oTD )
{
var aDiv = oTD.getElementsByTagName( "div" );
for ( var i = 0; i < aDiv.length; ++i )
if ( aDiv[ i ].className.match( /breakdown/ ) )
return aDiv[ i ];
return false;
}
function showbreakdown( oTD )
{
if ( !oTD._breakdown )
oTD._breakdown = findbreakdown( oTD );
oTD._breakdown.style.display = "block";
}
function hidebreakdown( oTD )
{
if ( !oTD._breakdown )
oTD._breakdown = findbreakdown( oTD );
oTD._breakdown.style.display = "none";
}
function BlindControl( oSurvey )
{
this._survey     = oSurvey;
this._container  = document.getElementById( "blindcontainer" );
this._minblinds  = 4;
this._blindwidth = 280;
this._tease      = false;
for ( var i = 1; i <= 20; ++i )
this.preload( "/media/image/blinds/" + i + ".jpg" );
this.preload( "/media/image/bg/intake_overlay.jpg" );
this._initBlinds();
window.__blindcontrol = this;
window.onresize       = this.__onresize;
this._plop  = 35;
this._alpha = 95;
this.fade( true );
window[ ( this._self = "BlindControl" ) ] = this;
this._animatestep = 0;
this._animate();
};
BlindControl.prototype.rise = function()
{
document.getElementById('player').style.visibility = 'hidden';
this._container.style.zIndex = 100;
};
BlindControl.prototype.sink = function()
{
document.getElementById('player').style.visibility = 'visible';
this._container.style.zIndex = 0;
};
BlindControl.prototype.preload = function( sURL )
{
if ( typeof this._preload == "undefined" )
{
this._preload = document.createElement( "div" );
this._preload.style.position = "absolute";
this._preload.style.width    = "10px";
this._preload.style.height   = "10px";
this._preload.style.left     = "-100px";
this._preload.style.top      = "-100px";
document.body.appendChild( this._preload );
}
var oDiv = document.createElement( "div" );
oDiv.style.backgroundImage = "url(" + sURL + ")";
this._preload.appendChild( oDiv );
};
BlindControl.prototype.open = function( nColumn, bNow )
{
for ( var i = 1; i <= nColumn; ++i )
if ( this._container.childNodes[ i ] && this._container.childNodes[ i ]._control )
this._container.childNodes[ i ]._control.slide( -( i * 280 ) );
};
BlindControl.prototype.close = function( bNow )
{
for ( var i = 0; i < this._container.childNodes.length; ++i )
if ( this._container.childNodes[ i ]._control )
this._container.childNodes[ i ]._control.slide( 0 );
};
BlindControl.prototype.tease = function( bEnable )
{
this._tease = bEnable;
for ( var i = 0; i < this._container.childNodes.length; ++i )
if ( this._container.childNodes[ i ]._control )
this._container.childNodes[ i ]._control.tease( this._tease ? Math.round( Math.random() * 2000 ) : false );
};
BlindControl.prototype.fade = function( bInit )
{
for ( var i = 0; i < this._container.childNodes.length; ++i )
if ( this._container.childNodes[ i ]._control )
{
if ( bInit )
this._container.childNodes[ i ]._control.setDarkness( this._alpha );
else
this._container.childNodes[ i ]._control.fade();
}
};
BlindControl.prototype._animate = function()
{
clearTimeout( this._timer );
for ( var i = 0; i < this._container.childNodes.length; ++i )
if ( this._container.childNodes[ i ]._control )
this._container.childNodes[ i ]._control.update();
this._timer = setTimeout( this._self + "._animate();", 40 );
};
BlindControl.prototype._initBlinds = function()
{
this.updateColumnWidth();
};
BlindControl.prototype.change = function()
{
var sBlind = "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20";
for ( var i = 0; i < this._container.childNodes.length; ++i )
{
var sCurrent = this._container.childNodes[ i ]._control.getBlind();
sBlind = sBlind.replace( new RegExp( "\s*" + sCurrent + "\s*" ), "" );
}
var aBlind = sBlind.replace( /^\s+|\s+$/, "" ).split( /\s+/ );
for ( var i = 0; i < this._container.childNodes.length; ++i )
if ( this._container.childNodes[ i ]._control )
{
var nBlind   = Math.round( Math.random() * ( aBlind.length - 1  ) );
var aChoice  = aBlind.splice( nBlind, 1 );
this._container.childNodes[ i ]._control.setBlind( aChoice[ 0 ] );
}
};
BlindControl.prototype.getWidth = function()
{
return this._container.offsetWidth;
};
BlindControl.prototype.__onresize = function( e )
{
this.__blindcontrol.updateColumnWidth();
};
BlindControl.prototype.updateColumnWidth = function()
{
var nWidth  = this.getWidth();
var nAmount = Math.max( Math.ceil( nWidth / this._blindwidth ), this._minblinds );
var nFlex   = nWidth < this._blindwidth * this._minblinds ? 0 : nAmount - 1; //  flex the last element, unless there's no 'content blind', then flex the first
//  Adjust the number of blinds to best match our needs
if ( this._container.childNodes.length > nAmount )
{
while( this._container.childNodes.length > nAmount )
{
var oBlind      = this._container.childNodes[ this._container.childNodes.length - 1 ];
oBlind._control = null;
oBlind.parentNode.removeChild( oBlind );
}
}
else if ( this._container.childNodes.length < nAmount )
{
while( this._container.childNodes.length < nAmount )
{
var oBlind = new Blind();
oBlind.setBlind( this._container.childNodes.length, true );
oBlind.backgroundPosition( this._container.childNodes.length == 0 ? 100 : 50 );
if ( this._tease )
{
oBlind.setDarkness( this._alpha );
oBlind.tease( Math.round( Math.random() * 2000 ) );
}
this._container.appendChild( oBlind.getElement() );
}
}
for ( var i = 0; i < this._container.childNodes.length; ++i )
{
var oElement = this._container.childNodes[ i ];
var oBlind   = oElement._control;
if ( i == nFlex ) //  The flexing element
oBlind.setWidth( nWidth - ( this._blindwidth * ( nAmount - 1 ) ) );
else
oBlind.setWidth( this._blindwidth );
}
this._survey.updateOffset( nFlex == 0 ? nWidth - ( this._blindwidth * ( nAmount - 1 ) ) : this._blindwidth );
};
function Blind()
{
this._object = document.createElement( "div" );
this._object._control  = this;
this._object.className = "blind";
this._slide = document.createElement( "div" );
this._slide._control  = this;
this._slide.className = "slide";
this._alpha = document.createElement( "div" );
this._alpha._control  = this;
this._alpha.className = "alpha";
this._object.appendChild( this._slide );
( this._object.appendChild( document.createElement( "div" ) ) ).className = "leftshade";
( this._object.appendChild( document.createElement( "div" ) ) ).className = "rightshade";
this._object.appendChild( this._alpha );
this._tease      = false;
this._opacity    = 0;
this._imagesteps = 15;
this._fadesteps  = 15;
this._movesteps  = 20;
this._imagestep  = null;
this._fadestep   = null;
this._movestep   = null;
this.setDarkness( 0 );
};
Blind.prototype.smooth = function( nBegin, nEnd, nStep, nNumStep )
{
return ( nEnd - nBegin ) / 2 * ( ( nStep /= nNumStep / 2 ) < 1 ? Math.pow( nStep, 3 ) : ( nStep -= 2 ) * Math.pow( nStep, 2 ) + 2 ) + nBegin;
};
Blind.prototype.update = function()
{
if ( typeof this._imagestep == "number" )
{
if ( ++this._imagestep < this._imagesteps )
{
this._slide.style.width = Math.round( this.smooth( 0, 100, this._imagestep, this._imagesteps ) ) + "%";
}
else
{
this._object.style.backgroundImage = this._slide.style.backgroundImage;
this._slide.style.width = "0%";
delete this._imagestep;
}
}
if ( typeof this._movestep == "number" )
{
if ( ++this._movestep < this._movesteps )
{
this._object.style.left = Math.round( this.smooth( this._startX, this._endX, this._movestep, this._movesteps ) ) + "px";
}
else
{
this._object.style.left = this._endX + "px";
delete this._movestep;
}
}
if ( typeof this._fadestep == "number" )
{
if ( ++this._fadestep < this._fadesteps )
{
this.setDarkness( this.smooth( this._fadestart, this._fadeend, this._fadestep, this._fadesteps ) );
}
else
{
if ( typeof this._tease == "number" )
{
this._fadestart = this._opacity;
this._fadeend   = 95;
this._fadestep  = 0;
}
else
{
this.setDarkness( this._fadeend );
delete this._fadestep;
}
}
}
if ( typeof this._tease == "number" )
{
if ( ++this._tease % 500 == 0 )
{
this._fadestart = this._opacity;
this._fadeend   = 40;
this._fadestep  = 0;
}
}
};
Blind.prototype.setDarkness = function( nAlpha )
{
this._opacity             = nAlpha;
this._alpha.style.opacity = this._alpha.style.MozOpacity = nAlpha / 100;
this._alpha.style.filter  = "alpha(opacity=" + nAlpha + ")";
};
Blind.prototype.getElement = function()
{
return this._object;
};
Blind.prototype.getWidth = function()
{
return this._object.offsetWidth;
};
Blind.prototype.setBlind = function( nIndex, bImmediate )
{
if ( bImmediate )
{
this._object.style.backgroundImage = "url(/media/image/blinds/" + ( 1 + ( nIndex % 20 ) ) + ".jpg)";
}
else
{
this._slide.className = "slide" + ( Math.round( Math.random() ) == 1 ? " flip" : "" )
this._imagestep = 0;
this._slide.style.width = "0%";
this._slide.style.backgroundImage = "url(/media/image/blinds/" + ( 1 + ( nIndex % 20 ) ) + ".jpg)";
}
};
Blind.prototype.tease = function( mValue )
{
//alert( "Blind.tease: " + ( typeof mValue == "boolean" ? ( mValue ? "true" : "false" ) : mValue ) );
this._fadesteps = 30;
this._tease = mValue;
};
Blind.prototype.getBlind = function()
{
return parseInt( this._object.style.backgroundImage.replace( /[^0-9]+/g, "" ) );
};
Blind.prototype.fade = function( nTo )
{
this._fadesteps = 15;
this._fadestart = this._opacity;
this._fadeend   = nTo || 0;
this._fadestep  = 0;
};
Blind.prototype.slide = function( nEndX, nStartX )
{
this._object.style.zIndex = 10;
this._startX   = nStartX || this._endX || 0;//this._object.offsetLeft;
this._endX     = nEndX;
this._movestep = 0;
};
Blind.prototype.setWidth = function( nValue )
{
//alert( "'" + nValue + "'" );
if ( nValue > 0 )
this._object.style.width = nValue + "px";
this._object.style.display = nValue <= 0 ? "none" : "block";
};
Blind.prototype.backgroundPosition = function( nValue )
{
this._object.style.backgroundPosition = nValue + "% 0";
};
Blind.prototype._build = function()
{
for ( var i = 0; i < this._amount; ++i )
{
var oBlindScreen = document.createElement( "div" );
oBlindScreen.className = "screen";
this._object.appendChild( oBlindScreen );
}
};

function SurveyControl()
{
this._screen   = [];
this._announce = [];
this._current  = 0;
};
SurveyControl.prototype.init = function( oForm )
{
this._form = oForm || document.getElementById( "survey" );
window[ ( this._self = "SurveyControl" ) ] = this;
for ( var i = 1; i <= 20; ++i )
this.preload( "/media/image/blinds/" + i + ".jpg" );
for ( var i = 0; i <= 9; ++i )
this.preload( "/media/image/digit/" + i + ".jpg" );
this.preload( "/media/image/bg/intake_overlay.jpg" );
};
SurveyControl.prototype._checkload = function()
{
clearTimeout( this._timer );
var bLoaded = true;
for ( var i = 0; i < this._preload.length; ++i )
if ( !this._preload[ i ]._loaded )
{
bLoaded = false;
break;
}
if ( bLoaded )
this._init();
else
this._timer = setTimeout( this._self + "._checkload();", 5000 );
};
SurveyControl.prototype.preload = function( sImage )
{
if ( typeof this._preload == "undefined" )
this._preload = new Array();
var oImage      = document.createElement( "img" );
oImage._loaded  = false;
oImage.onload   = this.__onimageload;
oImage.src = sImage;
this._preload.push( oImage );
this._checkload();
};
SurveyControl.prototype.__onimageload = function()
{
this._loaded = true;
};
SurveyControl.prototype._init = function()
{
if ( typeof BlindControl == "function" )
this._blindcontrol = new BlindControl( this );
document.body.className = document.body.className.replace( /preload/, "" );
if ( this._form )
{
var aScreen = this._form.getElementsByTagName( "fieldset" );
for ( var i = 0; i < aScreen.length; ++i )
{
if ( aScreen[ i ].className.match( /screen/i ) )
{
var aControl = [];
for ( var a = 0; a < this._announce.length; ++a )
if ( this._announce[ a ].fieldset.id == aScreen[ i ].id )
aControl.push( this._announce[ a ].control );
this._initScreen( aScreen[ i ], aControl );
}
}
this._blindcontrol.tease( true );
this.show( 0, true );
return true;
}
return false;
};
SurveyControl.prototype._initScreen = function( oScreen, oControl )
{
var oScreenObject = new ScreenControl( oScreen, oControl );
oScreenObject.hide();
this._screen.push( oScreenObject );
};
SurveyControl.prototype.updateOffset = function( nOffset )
{
this._form.style.left = nOffset + "px";
};
SurveyControl.prototype.updateWidth = function( nColumn )
{
this._form.style.width = ( nColumn * 280 ) + "px";
document.body.className = document.body.className.replace( /singlecolumn|doublecolumn|triplecolumn/i, nColumn == 2 ? "doublecolumn" : "singlecolumn" );
};
SurveyControl.prototype.announce = function( oQuestionControl )
{
var oQuestionField = oQuestionControl.getScreenElement();
if ( !oQuestionField.id )
oQuestionField.id  = "surveyannounce" + this._announce.length;
var oTMP = {
fieldset:oQuestionField,
control:oQuestionControl
};
this._announce.push( oTMP );
};
SurveyControl.prototype.finish = function()
{
if ( this._screen[ this._current ].isValid() )
this._form.submit();
};
SurveyControl.prototype.next = function()
{
if ( this._screen[ this._current ].isValid() )
{
if ( this._current == 0 )
{
this._blindcontrol.tease( false );
this._fade();
}
else
{
this.show( this._current + 1 );
}
}
return false;  //  prevent default click action (on the A-element)
};
SurveyControl.prototype.previous = function()
{
this.show( this._current - 1 );
return false;  //  prevent default click action (on the A-element)
};
SurveyControl.prototype._fade = function()
{
clearTimeout( this._timer );
this._blindcontrol.fade();
this._timer = setTimeout( this._self + ".show( " + ( this._current + 1 ) + " );", 500 );
};
SurveyControl.prototype._googleAnalyticsCounter = function( nIndex )
{
var sMeasure = "onbekend";
if ( nIndex == 0 )
sMeasure = "agecheck";
else if ( nIndex == 1 )
sMeasure = "start";
else
sMeasure = "vraag" + ( nIndex - 1 );
GAClick( "survey", sMeasure );
};
SurveyControl.prototype.show = function( nIndex, bNow )
{
this._googleAnalyticsCounter( nIndex );
if ( typeof this._screen != "boolean" && this._screen.length == 0 ) //  no init yet
this._init();
this._blindcontrol.rise();
this._blindcontrol.close();
this._timer = setTimeout( this._self + "._close();", 500 );
if ( nIndex < 0 ) //  never below first screen object
nIndex = 0;
else if ( nIndex >= this._screen.length ) //  never past last screen object
nIndex = this._screen.length - 1;
this._current = nIndex;
};
SurveyControl.prototype._close = function()
{
clearTimeout( this._timer );
for ( var i = 0; i < this._screen.length; ++i )
this._screen[ i ].hide();
this._timer = setTimeout( this._self + "._change();", 500 );
};
SurveyControl.prototype._change = function()
{
clearTimeout( this._timer );
this._blindcontrol.change();
this._timer = setTimeout( this._self + "._open();", 500 );
};
SurveyControl.prototype._open = function()
{
clearTimeout( this._timer );
var nColumn = this._screen[ this._current ].getColumnAmount();
this._blindcontrol.open( nColumn );
this.updateWidth( nColumn );
this._timer = setTimeout( this._self + "._ready();", 300 );
};
SurveyControl.prototype._ready = function()
{
clearTimeout( this._timer );
this._timer = setTimeout( this._self + "._swapZ();", 500 );
for ( var i = 0; i < this._screen.length; ++i )
if ( i == this._current )
this._screen[ i ].show();
else
this._screen[ i ].hide();
};
SurveyControl.prototype._swapZ = function()
{
clearTimeout( this._timer );
this._blindcontrol.sink();
};
SurveyControl.prototype.findScreenElement = function( oElement )
{
if ( oElement.nodeName.match( /fieldset/i ) && oElement.className.match( /screen/i ) )
return oElement;
else if ( oElement.parentNode )
return this.findScreenElement( oElement.parentNode );
return false;
};
function ScreenControl( oScreen, aControl )
{
this._screen  = oScreen;
this._control = aControl;
};
ScreenControl.prototype.isValid = function()
{
this.error( '' );
var bValid   = true;
var sMessage = "";
if ( this._control )
for ( var i = 0; i < this._control.length; ++i )
{
var sValid = this._control[ i ].validate();
bValid     = bValid && ( ( typeof sValid == "boolean" && sValid == false ) || ( typeof sValid == "string" && sValid != "" ) ) ? false : bValid;
if ( typeof sValid == "string" )
sMessage  += ( sMessage == "" ? "" : ", " ) + sValid;
}
if ( bValid == true )
return true;
else if ( sMessage == "" )
sMessage = "Je hebt de vraag nog niet beantwoord";
this.error( sMessage );
};
ScreenControl.prototype.getColumnAmount = function()
{
return parseInt( this._screen.className.replace( /[^0-9]+/g, "" ) ) || 1;
};
ScreenControl.prototype._getErrorElement = function()
{
if ( !this._error )
{
var aSpan = this._screen.getElementsByTagName( "span" );
for ( var i = 0; i < aSpan.length; ++i )
if ( aSpan[ i ].className.match( /error/i ) )
{
this._error = aSpan[ i ];
break;
}
}
return this._error;
};
ScreenControl.prototype.error = function( sError )
{
var oError = this._getErrorElement();
if ( oError )
oError.innerHTML = sError;
};
ScreenControl.prototype.hide = function()
{
this._screen.style.display = "none";
};
ScreenControl.prototype.show = function()
{
this._screen.style.display = "block";
if ( this._control )
for ( var i = 0; i < this._control.length; ++i )
this._control[ i ].invoke();
};
function Intermezzo( sName )
{
this._wrapper = document.getElementById( sName );
};
Intermezzo.prototype.invoke = function()
{
};
Intermezzo.prototype.validate = function()
{
return true;
};
Intermezzo.prototype.getScreenElement = function()
{
return Survey.findScreenElement( this._wrapper );
};
var Survey = new SurveyControl();

function updateTafRow(oCurrentNode)
{
if (oCurrentNode.value == '')
return false;
//var oInput = oCurrentNode;
var oInputRow = oCurrentNode.parentNode;
var oTafRowContainer = document.getElementById('tafrowcontainer');
for (var i=0; i < oTafRowContainer.childNodes.length; ++i)
{
var aFields = oTafRowContainer.childNodes[i].childNodes;
for (var n=0; n < aFields.length; ++n)
{
if (aFields[n].value == '')
return false;
}
}
var oLastInputRow = oTafRowContainer.childNodes[oTafRowContainer.childNodes.length - 1];
var oNewRow = oLastInputRow.cloneNode(true);
oNewRow.childNodes[0].value = '';
oNewRow.childNodes[1].value = '';
oTafRowContainer.appendChild(oNewRow);
}
/*SWFObject v2.2 <http://code.google.com/p/swfobject/> 
is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
