//chart2.js for channel 25548 / widget 164369 / WxH: 560x375 / skin: webwereld / vid: 0 / autoplay: N / shareicon: Y 
// pgstats - poor mans page statistics.. 
// NOT based on prototype or jquery - cause it must be lightweight

// // get our script src, to know our baseurl so we can call home
// var pgstatsScriptSource = (function(scripts) {
//     var scripts = document.getElementsByTagName('script'),
//         script = scripts[scripts.length - 1];	// at ths very moment, we are the last script guaranteed
// 
//     if (script.getAttribute.length !== undefined) {
//         return script.src
//     }
// 
//     return script.getAttribute('src', -1)
// }());

var pgstats= {
	browser: navigator.userAgent,
	uid: '',
	scr: screen.width.toString()+'x'+screen.height.toString(),
	url: document.URL,
	referrer: document.referrer,
	ecollect: {},
	baseurl: 'http://www.dik.nl/',	// pgstatsScriptSource.substr(0,pgstatsScriptSource.lastIndexOf('/pgstats/')),
	init: function() {
		if (!(this.uid=this.readCookie('pgstats'))) {
			this.uid= Math.round(Math.random() * 2147483647).toString();
			this.uid+= Math.round(Math.random() * 2147483647).toString();
			this.createCookie('pgstats',this.uid,365*2);
		}
	}, 
	xPageHit: function () {
		var xhReq=this.createXMLHttpRequest();
		if (!xhReq)
			return 'ERR:xhReq';	// forget it..
		if (!this.baseurl)
			return 'ERR:baseurl';	// forget it..
		xhReq.open('get',this.baseurl+'pgstats/tick?'+this.collectInfo(),true);
		// xhReq.onreadystatechange = function() {
		//     if (xhReq.readyState != 4)  { return; }
		//     var serverResponse = xhReq.responseText;
		//     alert(serverResponse);
		// };
		xhReq.send();
		return 'OK';
	},
	collectInfo: function() {
		var rv;
		rv='ts=' + new Date().getTime();
		//rv+='&br='+this.encURI(this.browser);
		rv+='&uid='+this.uid;
		rv+='&url='+this.encURI(this.url);
		rv+='&refer='+this.encURI(this.referrer);
		//rv+='&ssrc='+this.encURI(this.baseurl);
		rv+='&scr='+this.scr;
		for (i in this.ecollect) {
			rv+='&'+i+'='+this.encURI(this.ecollect[i]);
		}

		return rv;
	},
	addcollect: function(key,val) {
		this.ecollect[key]=val;
	},
	//------- helper functions ----------
	createCookie: function (name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	},
	readCookie: function(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	},
	eraseCookie: function(name) {
		createCookie(name,"",-1);
	},
	encURI: function(url) {
		//return encodeURIComponent(url);	// forgets to encode a lot of chars. Useless
		var s = escape(url);	// this is the most complete one, however forgets to encode star, slash, @ and +
		s = s.replace(/\*/g,"%2A");
		s = s.replace(/\//g,"%2F");
		s = s.replace(/\@/g,"%40");
		s = s.replace(/\+/g,"%2B");
		return s;
	},
	createXMLHttpRequest: function() {
  		try { return new XMLHttpRequest(); } catch(e) {}
		try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
		try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch (e) {}
		return null;
	}
}
pgstats.init();
//pgstats.addcollect('vid','234234');
//pgstats.xPageHit();
// Widget standard js for yubby
// NOT based on prototype or jquery - cause it must be lightweight and cant interfere with host

/**
 *	htmlspecialchars - like its php counterpart
 *	@author rvw
 *	@since 08-03-2010 12:19
 */
function htmlspecialchars(string) {
	string = string.toString();
	string = string.replace(/&/g, '&amp;');    
	string = string.replace(/</g, '&lt;').replace(/>/g, '&gt;');
	string = string.replace(/"/g, '&quot;');
	// single quote.. string = string.replace(/'/g, '&#039;');
	return string;
}

//------------ tween.js ----------------------
function Delegate() {}
Delegate.create = function (o, f) {
	var a = new Array() ;
	var l = arguments.length ;
	for(var i = 2 ; i < l ; i++) a[i - 2] = arguments[i] ;
	return function() {
		var aP = [].concat(arguments, a) ;
		f.apply(o, aP);
	}
}

Tween = function(obj, prop, func, begin, finish, duration, suffixe){
	this.init(obj, prop, func, begin, finish, duration, suffixe)
}
var t = Tween.prototype;

t.obj = new Object();
t.prop='';
t.func = function (t, b, c, d) { return c*t/d + b; };
t.begin = 0;
t.change = 0;
t.prevTime = 0;
t.prevPos = 0;
t.looping = false;
t._duration = 0;
t._time = 0;
t._pos = 0;
t._position = 0;
t._startTime = 0;
t._finish = 0;
t.name = '';
t.suffixe = '';
t._listeners = new Array();	
t.setTime = function(t){
	this.prevTime = this._time;
	if (t > this.getDuration()) {
		if (this.looping) {
			this.rewind (t - this._duration);
			this.update();
			this.broadcastMessage('onMotionLooped',{target:this,type:'onMotionLooped'});
		} else {
			this._time = this._duration;
			this.update();
			this.stop();
			this.broadcastMessage('onMotionFinished',{target:this,type:'onMotionFinished'});
		}
	} else if (t < 0) {
		this.rewind();
		this.update();
	} else {
		this._time = t;
		this.update();
	}
}
t.getTime = function(){
	return this._time;
}
t.setDuration = function(d){
	this._duration = (d == null || d <= 0) ? 100000 : d;
}
t.getDuration = function(){
	return this._duration;
}
t.setPosition = function(p){
	this.prevPos = this._pos;
	var a = this.suffixe != '' ? this.suffixe : '';
	this.obj[this.prop] = Math.round(p) + a;
	this._pos = p;
	this.broadcastMessage('onMotionChanged',{target:this,type:'onMotionChanged'});
}
t.getPosition = function(t){
	if (t == undefined) t = this._time;
	return this.func(t, this.begin, this.change, this._duration);
};
t.setFinish = function(f){
	this.change = f - this.begin;
};
t.geFinish = function(){
	return this.begin + this.change;
};
t.init = function(obj, prop, func, begin, finish, duration, suffixe){
	if (!arguments.length) return;
	this._listeners = new Array();
	this.addListener(this);
	if(suffixe) this.suffixe = suffixe;
	this.obj = obj;
	this.prop = prop;
	this.begin = begin;
	this._pos = begin;
	this.setDuration(duration);
	if (func!=null && func!='') {
		this.func = func;
	}
	this.setFinish(finish);
}
t.start = function(){
	this.rewind();
	this.startEnterFrame();
	this.broadcastMessage('onMotionStarted',{target:this,type:'onMotionStarted'});
	//alert('in');
}
t.rewind = function(t){
	this.stop();
	this._time = (t == undefined) ? 0 : t;
	this.fixTime();
	this.update();
}
t.fforward = function(){
	this._time = this._duration;
	this.fixTime();
	this.update();
}
t.update = function(){
	this.setPosition(this.getPosition(this._time));
	}
t.startEnterFrame = function(){
	this.stopEnterFrame();
	this.isPlaying = true;
	this.onEnterFrame();
}
t.onEnterFrame = function(){
	if(this.isPlaying) {
		this.nextFrame();
		setTimeout(Delegate.create(this, this.onEnterFrame), 0);
	}
}
t.nextFrame = function(){
	this.setTime((this.getTimer() - this._startTime) / 1000);
	}
t.stop = function(){
	this.stopEnterFrame();
	this.broadcastMessage('onMotionStopped',{target:this,type:'onMotionStopped'});
}
t.stopEnterFrame = function(){
	this.isPlaying = false;
}

t.continueTo = function(finish, duration){
	this.begin = this._pos;
	this.setFinish(finish);
	if (this._duration != undefined)
		this.setDuration(duration);
	this.start();
}
t.resume = function(){
	this.fixTime();
	this.startEnterFrame();
	this.broadcastMessage('onMotionResumed',{target:this,type:'onMotionResumed'});
}
t.yoyo = function (){
	this.continueTo(this.begin,this._time);
}

t.addListener = function(o){
	this.removeListener (o);
	return this._listeners.push(o);
}
t.removeListener = function(o){
	var a = this._listeners;	
	var i = a.length;
	while (i--) {
		if (a[i] == o) {
			a.splice (i, 1);
			return true;
		}
	}
	return false;
}
t.broadcastMessage = function(){
	var arr = new Array();
	for(var i = 0; i < arguments.length; i++){
		arr.push(arguments[i])
	}
	var e = arr.shift();
	var a = this._listeners;
	var l = a.length;
	for (var i=0; i<l; i++){
		if(a[i][e])
		a[i][e].apply(a[i], arr);
	}
}
t.fixTime = function(){
	this._startTime = this.getTimer() - this._time * 1000;
}
t.getTimer = function(){
	return new Date().getTime() - this._time;
}
Tween.backEaseIn = function(t,b,c,d,a,p){
	if (s == undefined) var s = 1.70158;
	return c*(t/=d)*t*((s+1)*t - s) + b;
}
Tween.backEaseOut = function(t,b,c,d,a,p){
	if (s == undefined) var s = 1.70158;
	return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
}
Tween.backEaseInOut = function(t,b,c,d,a,p){
	if (s == undefined) var s = 1.70158; 
	if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
	return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
}
Tween.elasticEaseIn = function(t,b,c,d,a,p){
		if (t==0) return b;  
		if ((t/=d)==1) return b+c;  
		if (!p) p=d*.3;
		if (!a || a < Math.abs(c)) {
			a=c; var s=p/4;
		}
		else 
			var s = p/(2*Math.PI) * Math.asin (c/a);
		
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	
}
Tween.elasticEaseOut = function (t,b,c,d,a,p){
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return (a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b);
	}
Tween.elasticEaseInOut = function (t,b,c,d,a,p){
	if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) var p=d*(.3*1.5);
	if (!a || a < Math.abs(c)) {var a=c; var s=p/4; }
	else var s = p/(2*Math.PI) * Math.asin (c/a);
	if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
}

Tween.bounceEaseOut = function(t,b,c,d){
	if ((t/=d) < (1/2.75)) {
		return c*(7.5625*t*t) + b;
	} else if (t < (2/2.75)) {
		return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
	} else if (t < (2.5/2.75)) {
		return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
	} else {
		return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
	}
}
Tween.bounceEaseIn = function(t,b,c,d){
	return c - Tween.bounceEaseOut (d-t, 0, c, d) + b;
	}
Tween.bounceEaseInOut = function(t,b,c,d){
	if (t < d/2) return Tween.bounceEaseIn (t*2, 0, c, d) * .5 + b;
	else return Tween.bounceEaseOut (t*2-d, 0, c, d) * .5 + c*.5 + b;
	}

Tween.strongEaseInOut = function(t,b,c,d){
	return c*(t/=d)*t*t*t*t + b;
	}

Tween.regularEaseIn = function(t,b,c,d){
	return c*(t/=d)*t + b;
	}
Tween.regularEaseOut = function(t,b,c,d){
	return -c *(t/=d)*(t-2) + b;
	}

Tween.regularEaseInOut = function(t,b,c,d){
	if ((t/=d/2) < 1) return c/2*t*t + b;
	return -c/2 * ((--t)*(t-2) - 1) + b;
	}
Tween.strongEaseIn = function(t,b,c,d){
	return c*(t/=d)*t*t*t*t + b;
	}
Tween.strongEaseOut = function(t,b,c,d){
	return c*((t=t/d-1)*t*t*t*t + 1) + b;
	}

Tween.strongEaseInOut = function(t,b,c,d){
	if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
	return c/2*((t-=2)*t*t*t*t + 2) + b;
	}

//======= end tween.js
var isIE = /MSIE ((5\.5)|[6])/.test(navigator.userAgent) && navigator.platform == "Win32";

var cvids_164369= new Array();	// channelvideo's
var curvid_164369=0;			// first video
var cpvideo_164369=false;		// false=thumb, true=video

var matrix_curpg=1;
var matrix_npages=0;
var matrix_itemspp=2;	// 16
var tweenflip=0;
var tween1=null;
var tween2=null;

var butnext_mousein=false;
var butprev_mousein=false;
var img1_ov = new Image;
var img1_ou = new Image;
var img1_d  = new Image;
var img2_ov = new Image;
var img2_ou = new Image;
var img2_d  = new Image;
img1_ov.src="http://www.dik.nl//img/widget/chart2/skins/webwereld/iconprev24ov.png";
img1_ou.src="http://www.dik.nl//img/widget/chart2/skins/webwereld/iconprev24.png";
img1_d.src ="http://www.dik.nl//img/widget/chart2/skins/webwereld/iconprev24d.png";
img2_ov.src="http://www.dik.nl//img/widget/chart2/skins/webwereld/iconnext24ov.png";
img2_ou.src="http://www.dik.nl//img/widget/chart2/skins/webwereld/iconnext24.png";
img2_d.src ="http://www.dik.nl//img/widget/chart2/skins/webwereld/iconnext24d.png";

var wgElm_164369 = document.getElementById('viidoo_chart2_164369');
if (wgElm_164369) {
	vp_createwg();
}

pgstats.addcollect('chid','25548');
pgstats.addcollect('hit','embed');
pgstats.addcollect('widget','chart2');
pgstats.xPageHit();

function vp_createwg() {
	var html='<div id="widget_flash_164369" class="widget_flash" style="width: 560px;height:375px;overflow:hidden; margin:0;padding:0;border:0px solid #DDDDDD;background:#fff url(http://www.dik.nl//img/widget/chart2/skins/webwereld/bggrad.png) repeat-x;position:relative;font-family:Arial,helvetica,sans-serif">';
	html+='<div style="margin:20px;">';
	cvids_164369.push({vid:98557, thumb: 'http://i.ytimg.com/vi/I1gyxF75k8I/0.jpg', title: 'Sint Pietersberg mergelgrotten Maastricht - www.uitinlimburg.nl', desc: 'Sint Pietersberg mergelgrotten Maastricht - toerisme Limburg, www.uitinlimburg.nl uitinlimburgvideo014'});
	cvids_164369.push({vid:98565, thumb: 'http://i.ytimg.com/vi/6tU4psMFPJ8/0.jpg', title: 'st.pietersberreg', desc: 'st.pietersberreg sint pietersberg sint pieter koepetoekers mergel mergelblok enci sintpieter mosasaurus zonneberg grot grotten cave caves dekoepetoekers.ning.com'});
	cvids_164369.push({vid:98597, thumb: 'http://i.ytimg.com/vi/IyZ0JaHJaoo/0.jpg', title: 'Reclamespot Rederij Stiphout 2006 NL vrouwelijk sprek', desc: 'Welkom aan boord. Een onvergetelijke dag of avond met vrienden of collega\'s, beleef je aan boord van de luxe schepen van Rederij Stiphout. Alles is mogelijk, van een bezoek aan historisch Luik, tot een schitterende grenzentocht of grottenbezoek. En natuurlijk kunnen we een geheel verzorgd arrangement met diner en entertainment aanbieden. Bekijk Limburg eens van een andere kant, met Rederij Stiphout Maastricht.'});
	cvids_164369.push({vid:98594, thumb: 'http://i.ytimg.com/vi/cyFawDpz3SE/0.jpg', title: 'Kasteelru\u00efne \& Grotten Valkenburg - www.uitinlimburg.nl', desc: 'Kasteelru\u00efne \& Grotten Valkenburg - toerisme Limburg, www.uitinlimburg.nl uitinlimburgvideo021'});
	cvids_164369.push({vid:98593, thumb: 'http://i.ytimg.com/vi/-633AaMZIGg/0.jpg', title: 'Valkenburg - www.uitinlimburg.nl', desc: 'Valkenburg - Valkenberg, toerisme Limburg, www.uitinlimburg.nl uitinlimburgvideo057'});
	cvids_164369.push({vid:98567, thumb: 'http://i.ytimg.com/vi/TRXZs-w3AiI/0.jpg', title: 'Instorting mergelgroeve maastricht - Collapse underground quarry in Maastricht', desc: 'Instorting, renneeeeeeh'});
	cvids_164369.push({vid:98566, thumb: 'http://i.ytimg.com/vi/ecg9PXX6mIQ/0.jpg', title: 'Valkenburg gemeentegrot', desc: 'photograph, s of the caves which are very separate and what very certainly examining is worth dekoepetoekers.ning.com'});
	cvids_164369.push({vid:98564, thumb: 'http://i.ytimg.com/vi/jWgbJqDufcI/0.jpg', title: 'Grotten Zonneberg te Maastricht', desc: ''});
	cvids_164369.push({vid:98563, thumb: 'http://i.ytimg.com/vi/A6keKjdPf1U/0.jpg', title: 'dutch footage cave of maastricht zonneberg.mp4', desc: 'Mediazuid is an independent production company in Maastricht, The Netherlands. We produce stock footage, complete productions for customers like goverments, broadcasters, international companies and political party\'s. We shoot in HD, SD, PAL, NTSC USA and NTSC Middel-East. If you want to order stock video for youre own use only, please contact our office at +31 6 2006 8001 or send an e-mail to info@mediazuid.nl'});
	cvids_164369.push({vid:98562, thumb: 'http://i.ytimg.com/vi/losqWM_zyUI/0.jpg', title: 'Hang Zonneberg UK', desc: 'Gerbrand van Hout plays the Swiss \"HANG\" at the underground limestone-quarries nearby Maastricht, the Netherlands.'});
	cvids_164369.push({vid:98598, thumb: 'http://i.ytimg.com/vi/qT1GLm3wc9I/0.jpg', title: 'Opnamelocatie Vlaberg in Geulhem', desc: 'Een van de opnamelocaties van de Legende van de Bokkerijders. Hier opnames van de bokkerijdersdag 11 juli 2009. De uitgang van de grot waar de zwarte kapitein uitkwam, is hier gefilmd.'});
	cvids_164369.push({vid:98561, thumb: 'http://i.ytimg.com/vi/aVaclABStg8/0.jpg', title: 'Geulhemmergroeve Mergelgrot Limburg', desc: 'Ieder jaar op 26 december geopend.'});
	cvids_164369.push({vid:98560, thumb: 'http://i.ytimg.com/vi/43ilRmVlAU4/0.jpg', title: 'Grottes de Kanne - Magic Night', desc: 'Grottes de Kanne Mergelgrotten Grotten van Kanne Limburg Limbourg'});
	cvids_164369.push({vid:98559, thumb: 'http://i.ytimg.com/vi/FjgSNS5JcD0/0.jpg', title: 'Buitengoed Slavante Maastricht', desc: 'Op de Sint Pietersberg in Maastricht ligt het Buitengoed Slavante. Een uitstekende vertrekplaats om de mergelgrotten te bezoeken.'});
	cvids_164369.push({vid:98558, thumb: 'http://i.ytimg.com/vi/q1Z9cSKFXdA/0.jpg', title: 'De Limburgse Mergelgrotten', desc: 'ww.mergelgrotten.com'});
	cvids_164369.push({vid:98556, thumb: 'http://i.ytimg.com/vi/FfmRRTz1_pI/0.jpg', title: 'De mergelgrotten van Kanne', desc: 'De mergelgrotten van Kanne zijn een ideale lokatie om te genieten van de mooie houtskooltekeningen of gewoonweg om echte grottenchampignons te bewonderen of om gewoon te feesten in een uniek kader.'});
	cvids_164369.push({vid:98555, thumb: 'http://i.ytimg.com/vi/364TAZwofhc/0.jpg', title: 'Valkenburg en Mergelgrotten', desc: 'Valkenburg and the caves'});
	cvids_164369.push({vid:98568, thumb: 'http://i.ytimg.com/vi/RQo2FWiuHqA/0.jpg', title: 'Expedition Collapsed underground cave', desc: 'Caving expedition in a very old underground marlstone quarry in an unknown location in The Netherlands. This high quality video shows the crew exploring this quarry.'});
	cvids_164369.push({vid:98569, thumb: 'http://i.ytimg.com/vi/KFtZItq3LmU/0.jpg', title: 'Maastricht underground experience', desc: 'Spanning en avontuur in de pietersberg. Ook zelf te beleven!!!'});
	cvids_164369.push({vid:98570, thumb: 'http://i.ytimg.com/vi/nuVnOGO4qqI/0.jpg', title: 'Grotten Noord te Maastricht', desc: 'Rondleiding door de Grotten Noord in Maastricht. Excursion to the caves (Grotten Noord) in Maastricht, Netherlands. Maastrichtunderground.nl'});
	cvids_164369.push({vid:98595, thumb: 'http://i.ytimg.com/vi/SrQfviwcNMo/0.jpg', title: 'Maastricht en de Sint Pietersberg ( Zuid Limburg )', desc: '---'});
				html+='<div style="width:{$width}px;height:59px;margin:5px 0 0 0;color:#0075b2;position:relative;">';
				html+='<div style="color:#0075b2;font-size:16px;">Mergelgrotten</div>';
				html+='<div style="color:#333;font-size:12px;line-height:14px;height:28px;overflow:hidden;"></div>';
				html+='</div>';
			html+='<div id="thumb_164369" style="width:377px;overflow:hidden;height:237px;background-color:#FFFFFF;position:relative;float:left;">';
html+=vidthumbhtml_164369(curvid_164369);
html+='</div>';
	html +='<div style="height:26px;width:120px;position:absolute;right:25px;">';
		//html +='<img onclick="showmatrix_164369(0);" style="position:absolute;left:66px;top:1px;cursor:pointer;margin:0;padding:0;" src="http://www.dik.nl//img/widget/chart2/skins/webwereld/iconmatrix24.png" title="Klik hier voor gerelateerde videos"/>';
		html +='<img id="pgprev_164369" onclick="gotopageoffset_164369(-1);" style="position:absolute;left:18px;top:1px;cursor:pointer;margin:0;padding:0;" src="http://www.dik.nl//img/widget/chart2/skins/webwereld/iconprev24.png" onmouseover="oMouEv(this,true);" onmouseout="oMouEv(this,false);" title="blader terug"/>';
		//html +='<img onclick="playstop_164369();" style="position:absolute;left:5px;top:20px;cursor:pointer;margin:0;padding:0;" src="http://www.dik.nl//img/widget/chart2/skins/webwereld/iconstop24.png" title="stop"/>';
		//html +='<img onclick="playstart_164369();" style="position:absolute;left:5px;top:30px;cursor:pointer;margin:0;padding:0;" src="http://www.dik.nl//img/widget/chart2/skins/webwereld/iconplay24.png" title="afspelen"/>';
		html +='<img id="pgnext_164369" onclick="gotopageoffset_164369(1);" style="position:absolute;left:66px;top:1px;cursor:pointer;margin:0;padding:0;" src="http://www.dik.nl//img/widget/chart2/skins/webwereld/iconnext24.png" onmouseover="oMouEv(this,true);" onmouseout="oMouEv(this,false);"  title="blader verder"/>';
		html +='<div style="position:relative;top:44px; width:118px; margin:0px 0px 0px 0px;height:195px;overflow:hidden;border:1px solid #ddd;background-color:#fff" id="mxsoutline_164369">';
			html+='<div id="mxs_164369"  style="position:absolute;top:0px;background-color:#ffffff;"></div>';
			html+='<div id="mxs2_164369" style="position:absolute;top:0px;background-color:#ffffff;"></div>';	// videolist placeholder
		html +='</div>';
	html +='</div>';
	html+='<div style="height:26px;width:100px;position:absolute;bottom:28px;left:20px;">';
	html+='<a target=_blank href="http://www.dik.nl/"><img style="position:absolute;left:0px;top:3px;height:25px;z-index:5;cursor:pointer;margin:0;padding:0;" border=0 src="http://www.dik.nl/img/project/dik/logo.png"></a>';
			html +='<a style="text-decoration:none" target=_blank href="http://www.dik.nl/channel/player/25548/first"><div style="position:absolute;left:70px;top:9px;color:#0075b2;font-size:12px;line-height:10px;cursor:pointer;width:350px;height:20px;overflow:hidden;" >Deze videoplayer is ontwikkeld in samenwerking met dik.nl</div></a>';
					html +='<img onclick="toggleembed_164369();" src="http://www.dik.nl/img/icon_share30.png" style="cursor:pointer;position:absolute;left:354px;top:0px;" title="share or embed" alt="share or embed">';
				html+='</div>';
	
	html+='</div></div>';	// margin and innerflash
	wgElm_164369.innerHTML=html;
	wgElm_164369.style.display = 'block';

	gotopage_164369(matrix_curpg);	// 1
		
}

function playnext_164369() {
	if (curvid_164369 < cvids_164369.length -1 ) {
		curvid_164369++;
		if (cpvideo_164369)
			playstart_164369();	// we are playing video
		else {
			var thumbdiv=document.getElementById('thumb_164369');
			thumbdiv.innerHTML=vidthumbhtml_164369(curvid_164369);
		}
	}
}
function playprev_164369() {
	if (curvid_164369 >0 ) {
		curvid_164369--;
		if (cpvideo_164369)
			playstart_164369();	// we are playing video
		else {
			var thumbdiv=document.getElementById('thumb_164369');
			thumbdiv.innerHTML=vidthumbhtml_164369(curvid_164369);
		}
	}
}

// play video in video window
function playstart_164369(vnr) {
	closepopup_164369();	// close popup (if open)
	if (vnr==null)
		vnr=curvid_164369;
	else
		curvid_164369=vnr;	// set the current
	var thumbdiv=document.getElementById('thumb_164369');
	thumbdiv.innerHTML='<div></div>';
	thumbdiv.style.background='#FFF url(http://www.dik.nl/img/spinner32.gif) no-repeat 158.5px 88.5px';
	thumbdiv.innerHTML='<iframe name="playerframe" class="playerframe" src="http://www.dik.nl/widget/playvideo/'+cvids_164369[vnr].vid+'/377/237/L/W" width="377" height="237" frameborder="0" scrolling="no" allowtransparency="true"></iframe>';
	cpvideo_164369=true;
}

// show large thumb video still
function playstop_164369(vnr) {
	if (vnr==null)
		vnr=curvid_164369;
	else
		curvid_164369=vnr;	// set the current
	cpvideo_164369=false;
	var thumbdiv=document.getElementById('thumb_164369');
	thumbdiv.innerHTML=vidthumbhtml_164369(vnr);
}

// big thumbnail / player window
function vidthumbhtml_164369(vnr) {
	var html='';
	//th: 377 x 237  it: 377 x 175 t= -54 nrdesclines=2 
html+='<div style="width:377px;height:175px; overflow:hidden; position:absolute;left:0px;top:0px;">';
html+='<img src="'+cvids_164369[vnr].thumb+'" style="width:377px;height:282.75px;top:-54px;left:0px;position:relative;">';
html+='</div>';
html+='<div style="width:367px;height:62px;position:absolute;left:0px;bottom:0px;background-color:#bbb;padding:5px;"><div style="overflow:hidden;height:52px;"><div style="white-space:nowrap; margin: 2px 3px; font-size:16px;color:#555555;">'+htmlspecialchars(cvids_164369[vnr].title)+'</div><div style="margin: 2px 5px; font-size:13px;line-height:13px;color:#ffffff;overflow:hidden;height:27px;"  title="'+htmlspecialchars(cvids_164369[vnr].desc)+'">'+htmlspecialchars(cvids_164369[vnr].desc)+'</div><div style="padding: 3px 5px; letter-spacing:1px; background-color: #bbb; color: #333;font-size: 10px; position: absolute; right: 0px; top: -14px; ">'+(vnr+1)+'/'+(cvids_164369.length)+'</div></div></div>';
html+='<div style="position: absolute; width:100px;height:100px;top:68.5px;left:138.5px;z-index:200;cursor:pointer;cursor:hand;background:url(http://www.dik.nl//img/widget/chart2/skins/webwereld/videoplay100.png) no-repeat;" onClick="playstart_164369();"></div>';
	return html;
}

function visspb(vnr,show) {
	el = document.getElementById('spbid'+vnr);
	if (el) {
		el.style.display = show ? 'block':'none';  
	} 
	if (show && !cpvideo_164369)
		playstop_164369(vnr);
}

// thumbs rechts
function vidthumbhtmlSmall_164369(vnr) {
	var html='';
	html='';
			html+='<div style="margin: 0px; float: left; position: relative; width: 118px; height: 95px;">';
			html+='<div style="width:100px;max-height:58px;background:#f6f6f6;margin:13px auto 0px auto;overflow:hidden;position:relative;">';
			html+='<div style="width:100px;height:58px;background:#cccccc;border:0px solid #dedede;overflow:hidden;position:relative;"  onmouseover="visspb('+vnr+',true);" onmouseout="visspb('+vnr+',false);" >';
					html+='<img style="position:absolute;width:100px;height:75px;top:-8.5px;left:0;cursor: pointer;" onclick="playstart_164369('+vnr+')" title="'+htmlspecialchars(cvids_164369[vnr].desc)+'" src="'+cvids_164369[vnr].thumb+'" />';
					html+='<div id="spbid'+vnr+'" style="display:none; position: absolute; width:20px;height:20px;top:20px;left:40px;z-index:200;cursor:pointer;cursor:hand;background:url(http://www.dik.nl//img/widget/chart2/skins/webwereld/videoplay20.png) no-repeat;" onclick="playstart_164369('+vnr+')"></div>';
				html+='</div>';
			html+='</div>';
			html+='<div style="position: absolute; bottom: 0px; left: 8px;width:94px;height:15px;z-index:200;color:#555;font-size:11px;overflow:hidden;white-space: nowrap;padding:0 0 6px 0;cursor: pointer;" >'+htmlspecialchars(cvids_164369[vnr].title)+'</div>';
		html+='</div>';
		return html;
}

// cp 1..npages
function paginationhtml_164369(cp,npages) {
	if (npages<=1)
		return '';	// empty if no pagination..
	var html='';
	html+='<div class="pages">';
	if (cp>1) {
		// we CAN prev!
		html+= '<span class="pageblock" onclick="gotopage_164369('+(cp-1)+');">&#171; Previous</span>';
	}
	else {
		html+= '<span class="pageblock_disabled">&#171; Previous</span>';
	}
	// Available pages - Link
	var lpage = 1;
	var cpageSur = 2;
	var dotted = false;
	for (var lpage=1;lpage<=npages;lpage++) {
		// 1-2...8-9-[10]-11-12....58-59 
		if ( lpage<=2 || (lpage>=cp-4 && lpage<=cp+4) || lpage>=npages-1) {
			dotted = false;	// we need to dot afterwards
			if (lpage == cp )
				html+='<span class="pageblock_curpage"><b>'+lpage+'</b></span>';
			else
				html+='<span class="pageblock" onclick="gotopage_164369('+lpage+');">'+lpage+'</span>';
		}
		else {
			// no printing.. buttt maybe we need to dot
			if ( !dotted ) {
				html+='<span class="pageblock_dots">&nbsp;...&nbsp;</span>';
				dotted = true;
			}
		}
	}
		
	// Next page - Link
	if ( cp<npages )
		html+='<span class="pageblock" onclick="gotopage_164369('+(cp+1)+');">Next &#187;</span>';
	else
		html+='<span class="pageblock_disabled">Next &#187;</span>';
	html+='</div>';
	return html;
}

function vidplayurl_164369(vnr) {
	if (vnr==null)
		vnr=curvid_164369;
	return 'http://www.dik.nl/channel/player/25548/'+cvids_164369[vnr].vid;
}

// find absolute top loc of object
function vp_offsetTop(obj) {
    curtop = 0;
    if (obj.offsetParent) {
    curtop = obj.offsetTop
    while (obj = obj.offsetParent) {
      curtop += obj.offsetTop
    }
  }
  return curtop;
}

function vp_offsetLeft(obj) {
  curtop = 0;
  if (obj.offsetParent) {
    curtop = obj.offsetLeft;
    while (obj = obj.offsetParent) {
      curtop += obj.offsetLeft;
    }
  }
  return curtop;
}


function closepopup_164369() {
  el = document.getElementById('ipopup_164369');
  if (el) {
    el.parentNode.removeChild(el);
  } 
}

//
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.org
//
function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}



//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

//------------------------------------ button handlers --------------------------------------
function stButImg(oBut) {
	if (oBut.id == 'pgnext_164369') { 
		if (matrix_curpg>=matrix_npages)
			oBut.src = img2_d.src;
		else
			oBut.src= butnext_mousein ? img2_ov.src : img2_ou.src;
	}
	if (oBut.id == 'pgprev_164369') { 
		if (matrix_curpg<=1)
			oBut.src = img1_d.src;
		else
			oBut.src= butprev_mousein ? img1_ov.src : img1_ou.src;
	}
}

function oMouEv(oBut,mouseIn) {
	
	if (oBut.id == 'pgnext_164369') 
		butnext_mousein=mouseIn;
	if (oBut.id == 'pgprev_164369') 
		butprev_mousein=mouseIn;
	stButImg(oBut);
}

//----------------------------------------- pagination -------------------------------------

function initpage_164369() {
	matrix_npages= Math.ceil(cvids_164369.length / matrix_itemspp);
}

function gotopage_164369(pg) {
		
	if (!matrix_npages)
		initpage_164369();
	if (pg<1)
		pg=1;
	if (pg>matrix_npages)
		pg=matrix_npages;
		
	oldpg=matrix_curpg;
	matrix_curpg=pg;
	var mxs=document.getElementById('mxs_164369');
	var mxs2=document.getElementById('mxs2_164369');
	//if (!mxs)	
	//	alert('mxs_164369 niet gevonden');
	var html='';
	for (var i=(matrix_curpg-1)*matrix_itemspp,cv=0;i<cvids_164369.length && cv<matrix_itemspp;i++) {
		html+=  vidthumbhtmlSmall_164369(i);
		cv++;
	}
	//html+=  '<div style="clear:both;"></div>';
	//if (matrix_npages>1) {
	//	html+=  '<div style="margin:10px 0px">'+paginationhtml_164369(matrix_curpg, matrix_npages)+'</div>';
	//}
	if (oldpg<pg) {
		// stop old motions if busy
		if (tween1)	
			tween1.stop(); 
		if (tween2)
			tween2.stop();
		// tween UP
		(tweenflip?mxs2:mxs).innerHTML=html;	// put that in the NEW (to be shifted in) mxs
		// and start the tweens...
		// todo
		tween1 = new Tween((tweenflip?mxs2:mxs).style,'top',Tween.strongEaseOut,193,0      ,1,'px');
		tween1.start();
		tween2 = new Tween((tweenflip?mxs:mxs2).style,'top',Tween.strongEaseOut,0  ,-193 ,1,'px');
		tween2.start();
		tweenflip=!tweenflip;
		//mxs.innerHTML=html;
	}
	else if (oldpg>pg) {
		// tween down
		if (tween1)	
			tween1.stop(); 
		if (tween2)
			tween2.stop();
		(tweenflip?mxs2:mxs).innerHTML=html;	// put that in the NEW (to be shifted in) mxs
		// and start the tweens...
		// todo
		tween1 = new Tween((tweenflip?mxs2:mxs).style,'top',Tween.strongEaseOut,-193,0   ,1,'px');
		tween1.start();
		tween2 = new Tween((tweenflip?mxs:mxs2).style,'top',Tween.strongEaseOut,0   ,193   ,1,'px');
		tween2.start();
		tweenflip=!tweenflip;
	}
	else {
		(tweenflip?mxs:mxs2).innerHTML=html;
	}
	
	
	
	// disable/enable next/prev buttons
	el = document.getElementById('pgnext_164369');
	if (el) 
		stButImg(el); // update nextbutton state

	el = document.getElementById('pgprev_164369');
	if (el) 
		stButImg(el); // update prevbutton state
}

function gotopageoffset_164369(offset) {	// 1 or -1
	if (matrix_npages==0)
		initpage_164369();
	if (matrix_curpg+offset<0 || matrix_curpg+offset>matrix_npages) {
		gotopage_164369(matrix_curpg);
		return 0;
	}
	gotopage_164369(matrix_curpg+offset);
	return 1;
}

function showmatrix_164369() {
	// close old one
	closepopup_164369();

	matrix_npages= Math.ceil(cvids_164369.length / 16);
	
	// open new
	var popup_div = document.createElement('div');
	var title='matrix';
	popup_div.id = "ipopup_164369";
	popup_div.style.position = 'absolute';
	popup_div.style.border = 'none';
	var base_width=172*4+25;

	var base_height=100*4+30+10+4;
	if (matrix_npages>1) 
		base_height+=30;
	popup_div.style.width = base_width+'px';
	popup_div.style.height = base_height+'px';
	popup_div.style.fontFamily='Trebuchet MS,Lucida Sans Unicode,Lucida Grande,Lucida Sans,Tahoma,Geneva,Arial,helvetica,sans-serif';
	popup_div.style.zIndex = '10000';

	// CENTER SCREEN
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	var popup_top = arrayPageScroll[1] + ((arrayPageSize[3] -base_height) / 2);
	var popup_left = arrayPageScroll[0] +((arrayPageSize[0] - base_width) / 2);
	if (popup_top<0)
		popup_top=0;
	if (popup_left<0)
		popup_left=0;
	popup_div.style.position = 'absolute';
	popup_div.style.top = popup_top + 'px';
	popup_div.style.left = popup_left + 'px';


	
	var vid_html='';
	vid_html+='<div style="padding:0px;position:relative;border:2px #CCC solid;background-color:white;width:'+(base_width-4)+'px;height:'+(base_height-4)+'px;">';
	vid_html+='<br style="display:none;"/><style type="text/css">	\
		.pages {padding:2px 0 2px 8px; margin:0; clear:both;font-size:12px;} \
			.pages span.pageblock {border: 1px solid #888; color:#000; height: 12px; padding: 3px 6px;margin: 0px 4px 0px 0px;cursor: pointer;cursor:hand;}\
			.pages span.pageblock:hover {color:#D10101;text-decoration:underline;}	\
			.pages span.pageblock_disabled {border: 1px solid #888; color: #aaa; height: 12px; padding: 3px 6px;margin: 0px 4px 0px 0px;}\
			.pages span.pageblock_dots {border: 0px solid #888; color: #000; height: 12px; padding: 3px 6px;margin: 0px 4px 0px 0px;}\
			.pages span.pageblock_curpage {border: 1px solid #888; color: #aaa; height: 12px; padding: 3px 6px;margin: 0px 4px 0px 0px;}\
		</style>';
	vid_html+=	'<div onclick="closepopup_164369();" style="position:absolute;top:7px;right:8px;cursor:pointer;cursor:hand;background:url(http://www.dik.nl/img/icon_bw_close22.png) no-repeat;width:24px;height:24px;z-index:10000;"></div>';
	vid_html+=	'<div style="position:absolute;top:8px;left:15px;color:#888;font-size:15px;overflow:hidden;width:'+(base_width-50)+'px;">Mergelgrotten</div>';
	vid_html+=	'<div style="margin:30px 10px 10px 10px;" id="mxs_164369">';
	// for (var i=0,cv=0;i<cvids_164369.length && cv<16;i++) { 
	// 		vid_html+=  vidthumbhtmlSmall_164369(i);
	// 		cv++;
	// 	}
	// 	vid_html+=  '<div style="clear:both;"></div>';
	// 
	// 	if (matrix_npages>1) {
	// 		vid_html+=  '<div style="margin:10px 0px">'+paginationhtml_164369(matrix_curpg, matrix_npages)+'</div>';
	// 	}
	vid_html+=	'</div>';
	vid_html+=  '<div style="clear:both;"></div>';
	vid_html+='</div>';
					
	popup_div.innerHTML=vid_html;
	document.body.appendChild(popup_div);
	gotopage_164369(matrix_curpg);
}


function closeembed_164369() {
  el = document.getElementById('iembed_164369');
  if (el) {
    el.parentNode.removeChild(el);
  } 
}
function toggleembed_164369() {
	el = document.getElementById('iembed_164369');
	if (el) 
		closeembed_164369();
	else
		showembed_164369();
}

function showembed_164369() {
	// close old one
	closeembed_164369();
	// open new
	var popup_div = document.createElement('div');
	var title='embed';
	popup_div.id = "iembed_164369";
	popup_div.style.position = 'absolute';
	popup_div.style.border = 'none';
	var base_width=530;

	var base_height=90;
	popup_div.style.width = base_width+'px';
	popup_div.style.height = base_height+'px';
	popup_div.style.fontFamily='Trebuchet MS,Lucida Sans Unicode,Lucida Grande,Lucida Sans,Tahoma,Geneva,Arial,helvetica,sans-serif';
	popup_div.style.zIndex = '10000';
	popup_div.style.position = 'absolute';
	popup_div.style.bottom = '38px';
	popup_div.style.left = '10px';


	
	var vid_html='';
	vid_html+='<div style="width:520px; height:'+(base_height-10).toString()+'px; border:3px solid #BBB;padding:5px; background-color:#fff;color:#000;">';
	vid_html+='<div onclick="closeembed_164369();" style="position:absolute;top:7px;right:0px;cursor:pointer;cursor:hand;background:url(http://www.dik.nl/img/icon_bw_close22.png) no-repeat;width:24px;height:24px;z-index:10000;"></div>';
	vid_html+='<div style="font-face:Arial, Helvetica;font-size:10px; margin:10px 0 0 0;">';
	vid_html+='<div style="padding-bottom:3px;"><div style="float:left;width:40px;">URL:</div><input type="text" onclick="this.focus();this.select();" style="border: 0pt none ; background-color: #ccc; width: 450px; font-size: 9px; height: 15px;" value="http://www.dik.nl/channel/player/25548/first"></div>';
	vid_html+='<div style=""><div style="float:left;width:40px;">Embed:</div><textarea rows=2 cols=100 onclick="this.focus();this.select();" style="border: 0pt none ; background-color: #ccc; width: 450px; font-size: 9px; height: 40px;">&lt;div id=&quot;viidoo_solo_92&quot;&gt&lt;/div&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;http://www.dik.nl/widget/solojs/25548/92/width:560/height:375/skin:webwereld&quot;&gt;&lt;/script&gt;</textarea></div>';	
	vid_html+='</div>';

	vid_html+='</div>';	
	popup_div.innerHTML=vid_html;
	
	em = document.getElementById('widget_flash_164369');
	if (em) {
    	em.appendChild(popup_div);
	} 
}


// utf8 to string conversions
var escapable = /[\\\"\x00-\x1f\x7f-\uffff]/g,
    meta = {    // table of character substitutions
        '\b': '\\b',
        '\t': '\\t',
        '\n': '\\n',
        '\f': '\\f',
        '\r': '\\r',
        '"' : '\\"',
        '\\': '\\\\'
    };

function utf8quote(string) {
	// If the string contains no control characters, no quote characters, and no
	// backslash characters, then we can safely slap some quotes around it.
	// Otherwise we must also replace the offending characters with safe escape
	// sequences.

    escapable.lastIndex = 0;
    return escapable.test(string) ?
        '"' + string.replace(escapable, function (a) {
            var c = meta[a];
            return typeof c === 'string' ? c :
                '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
        }) + '"' :
        '"' + string + '"';
}



