

;

function open_venster( pad, naam, breed, hoog, scrollbars )
{
	if ( !scrollbars ) scrollbars = "no";
	venster = window.open(pad, naam, "width=" + breed + ",height=" + hoog +
	",toolbar=no,location=no,directories=no,status=0,resizable=no,scrollbars=" + scrollbars + ",menubar=no");
	venster.moveTo(50,50);
	
	return false;
}

;

/**
*
*  Base64 encode / decode
*  http://www.webtoolkit.info/
*
**/

var Base64 = {

	// private property
	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",

	// public method for encoding
	encode : function (input) {
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;

		input = Base64._utf8_encode(input);

		while (i < input.length) {

			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);

			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;

			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}

			output = output +
			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);

		}

		return output;
	},

	// public method for decoding
	decode : function (input) {
		var output = "";
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;

		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

		while (i < input.length) {

			enc1 = this._keyStr.indexOf(input.charAt(i++));
			enc2 = this._keyStr.indexOf(input.charAt(i++));
			enc3 = this._keyStr.indexOf(input.charAt(i++));
			enc4 = this._keyStr.indexOf(input.charAt(i++));

			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;

			output = output + String.fromCharCode(chr1);

			if (enc3 != 64) {
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64) {
				output = output + String.fromCharCode(chr3);
			}

		}

		output = Base64._utf8_decode(output);

		return output;

	},

	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";

		for (var n = 0; n < string.length; n++) {

			var c = string.charCodeAt(n);

			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}

		}

		return utftext;
	},

	// private method for UTF-8 decoding
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;

		while ( i < utftext.length ) {

			c = utftext.charCodeAt(i);

			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}

		}

		return string;
	}

};


;

/*     
    Plugin: iframe autoheight jQuery Plugin 
    Author: original code by NATHAN SMITH; converted to plugin by Jesse House
    File: jquery.iframe-auto-height.plugin.js
    Description: when the page loads set the height of an iframe based on the height of its contents
    Remarks: original code from http://sonspring.com/journal/jquery-iframe-sizing    
    Version: 1.0.0 - see README: http://github.com/house9/jquery-iframe-auto-height
*/
(function ($) {
    $.fn.iframeAutoHeight = function (options) {
        // set default option values
        var options = $.extend({
            heightOffset: 0
        }, options);

        // iterate over the matched elements passed to the plugin
        $(this).each(function () {
            // Check if browser is Opera or Safari(Webkit so Chrome as well)
            if ($.browser.safari || $.browser.opera) {
                // Start timer when loaded.
                $(this).load(function () {
                    var iframe = this;
                    var delayedResize = function () {
                        resizeHeight(iframe);
                    };
                    setTimeout(delayedResize, 0);
                });

                // Safari and Opera need a kick-start.
                var source = $(this).attr('src');
                $(this).attr('src', '');
                $(this).attr('src', source);
            }
            else {
                // For other browsers.
                $(this).load(function () {
                    resizeHeight(this);
                });
            }

            // resizeHeight
            function resizeHeight(iframe) {
                // Set inline style to equal the body height of the iframed content plus a little
                var newHeight = iframe.contentWindow.document.body.offsetHeight + options.heightOffset;
                iframe.style.height = newHeight + 'px';
            }

        }); // end
    }
})(jQuery);

function hijacklinks(iframe){
  var as = iframe.contentDocument.getElementsByTagName('a');
  for(i=0;i<as.length;i++){
    as[i].setAttribute('target','_parent');
  }
}

;

    
    /**
     * Object: ajax.js
     *
     * Ajax class for getting url data
     * LICENSE
     *
     * This source file is intellectual property of RTV Noord-Holland
     *
     * @category    RTVNH
     * @package        none
     * @author        Willem Daems
     * @version        1.0
     * @Description    Load url through xmlhttprequest object OR through the ajax.php file if the requested url is on another domain
     */
     


    function Rtvnh_Ajax(params)
    {
        this.requestType = 'GET';
        this.xmlhttp = null;
        this.params = params;
        this.success = false;
        this.timer = false;
        this.aborted = false;

        if (window.XMLHttpRequest)
        {
            // for not so crappy browser
            this.xmlhttp = new XMLHttpRequest();
        } else {
            // ie5, 6, crap browser support
            this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }

        if (typeof params.requestType != 'undefined')
        {
            // make them uppercase so we dont have to jiggle around with user input
            this.requestType = this.params.requestType.toUpperCase();
        }

        // bind the constructor of the class to the xmlhttp object
        this.xmlhttp.Constructor = this;
        
        if (typeof this.xmlhttp.onload == 'undefined')
        {
            this.xmlhttp.onreadystatechange = function()
            {
                switch (this.readyState)
                {
                    case 4:
                        this.Constructor.success = true;
                        if (this.status == 200)
                        {
                            if (typeof this.Constructor.params.success == 'function') this.Constructor.params.success(this.responseText);
                        } else {
                            // check aborted parameter, if aborted there is no need for an additional error
                            if (!this.Constructor.aborted)
                            {
                                if (typeof this.Constructor.params.error == 'function') this.Constructor.params.error('404');
                            }
                        }
                        break;
                }
            }
        }
        this.xmlhttp.onload = function()
        {
            switch (this.readyState)
            {
                case 4:
                    this.Constructor.success = true;
                    if (this.status == 200)
                    {
                        if (typeof this.Constructor.params.success == 'function') this.Constructor.params.success(this.responseText);
                    } else {
                        // check aborted parameter, if aborted there is no need for an additional error
                        if (!this.Constructor.aborted)
                        {
                            if (typeof this.Constructor.params.error == 'function') this.Constructor.params.error('404');
                        }
                    }
                    break;
            }
        }
         
        
        // send the package
        this.send = function()
        {
            this.params.url = unescape(String(this.params.url));

            if (this.params.crossdomain)
            {
                this.xmlhttp.open(this.requestType, '/ajax.php?method='+this.requestType+'&url=' + this.params.url, this.params.async);
            } else {
                this.xmlhttp.open(this.requestType, this.params.url, this.params.async);
            }

            if (typeof this.params.timeout != 'undefined')
            {
                this.timeout(this.params.timeout);    
            }
                    
            if (this.requestType == 'POST')
            {
                this.xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
                this.xmlhttp.send(this.requestParams);
            }
            
            if (this.requestType == 'GET')
            {
                this.xmlhttp.send(null);
            }
        }
           
        // set a timer if necessary
        this.timeout = function(timer)
        {
            var Constructor = this;
            if (!this.timer)
            {
                this.timer = true;
        
                setTimeout(function() {
                    Constructor.timeout()    
                }, timer);
                return;
            }

            // if request not succeeded in the given time
            if (!this.success)
            {
                this.aborted = true;
                this.cancel();

                if (typeof this.params.onTimeout == 'function')
                {
                    this.params.onTimeout();    
                }
            }
        }
        
        // the cancel function
        this.cancel = function()
        {
            alert('aborting');
            this.xmlhttp.abort();
        }
        
        // set the auto sender
        //if (params.autoSend) this.send();    
        this.send();
    
    }

;

function pushResult(frm)
    {
        var pollId = frm.pollId.value;
        var pollAnswer = '';
        
        for (var i = 0; i < frm.polloption.length; i++)
        {
            if (frm.polloption[i].checked)
            {
                pollAnswer = frm.polloption[i].value;
            }    
        }

    var d = new Date();
var t = d.getTime();
        $.ajax({
            url: '/pollanswer/' + pollId,
            type: 'POST',
            data: 'pollId=' + pollId + '&answerId=' + pollAnswer + '&ajaxpoll=true',
            success: function(data)
            {
                $('#poll-results').fadeOut('slow', function() {
                    document.getElementById('poll-results').innerHTML = data;
                    $('#poll-results').fadeIn('slow');
                });
                
            }
        });
        
        
        return false;
    }
