// google adsense 
var prev_ads = 0;
var pe_adsense = null;

function showGoogleAdsense() {
	if(pe_adsense != null) {
		if (document.getElementById(pe_google_div)) {
			document.getElementById(pe_google_div).innerHTML = pe_adsense;
			}
		prev_ads += google_ads.length; 
	}
	else {
		document.getElementById(pe_google_div).style.display="none";	
	}
}

function google_ad_request_done(google_ads) {

	var titleArray = document.getElementsByTagName("title");	
	var metaContent = titleArray[0].innerHTML.toLowerCase();
	var showGoogleAdsense = true;
	var s = '';
    var i;

    if (google_ads.length == 0) {
      showGoogleAdsense=false;
    }

	if ((metaContent.search(/wag /)) >= 0 || (metaContent.search(/babe/)) >= 0 || (metaContent.search(/sex/)) >= 0) {
      showGoogleAdsense=false;
	}
	
	if(showGoogleAdsense) {
		if(pe_google_layout == 4) {
			s += '<h3>'  + '<a href="http://services.google.com/feedback/online_hws_feedback" style="padding-left:10px;">' + 'Ads door Google' + '</a>' + '</h3>';
				for(i=0; i < google_ads.length; i++) {
					url = '<a style="cursor:pointer;cursor:hand;" target="_blank" onclick="javascript:window.open(\'' + google_ads[i].url  + '\');" onmouseover="window.status=\'' + google_ads[i].visible_url + '\'" onmouseout="window.status=\'\'">';
					
					s += '<div style="margin:0 10px 0 10px; padding:0; float:left; width:320px;height:80px;">';
					s += '<dl>';
					s += '<dt>' + url + google_ads[i].line1 + '</a></dt>';
					s += '<dd>' + google_ads[i].line2 + '&nbsp;' + google_ads[i].line3 + '</dd>';
					s += '</dl>';
					s +=  url + google_ads[i].visible_url + '</a>';
					s += '</div>';
						/*if (i==1) {
							s += '<div style="clear:right"></div>';
						}*/
				}
	
		} else if(pe_google_2col) 
		{
			s += '<h3>'  + '<a href="http://services.google.com/feedback/online_hws_feedback">' + 'Ads door Google' + '</a>' + '</h3>';
			for(i=0; i < google_ads.length; ++i) 
			{
				url = '<a style="cursor:pointer;cursor:hand;" target="_blank" onclick="javascript:window.open(\'' + google_ads[i].url  +
					 '\');" onmouseover="window.status=\'ga naar ' + google_ads[i].visible_url + '\'" onmouseout="window.status=\'\'">';
				s += '<div style="width:228px;float:left;"><dl>';
				s += '<dt>' + url + google_ads[i].line1 + '</a></dt>';
				s += '<dd>' + google_ads[i].line2 + '&nbsp;' + google_ads[i].line3 + '</dd>';
				s += '</dl>';
				s +=  url + google_ads[i].visible_url + '</a></div>';
			}
			s+= '<div class="gen_clear"></div>';
		}
		else 
		{
			s += '<h3>'  + '<a href="http://services.google.com/feedback/online_hws_feedback">' + 'Ads door Google' + '</a>' + '</h3>';
			for(i=0; i < google_ads.length; ++i) 
			{
				url = '<a style="cursor:pointer;cursor:hand;" target="_blank" onclick="javascript:window.open(\'' + google_ads[i].url  +
					 '\');" onmouseover="window.status=\'ga naar ' + google_ads[i].visible_url + '\'" onmouseout="window.status=\'\'">';
				s += '<dl>';
				s += '<dt>' + url + google_ads[i].line1 + '</a></dt>';
				s += '<dd>' + google_ads[i].line2 + '&nbsp;' + google_ads[i].line3 + '</dd>';
				s += '</dl>';
				s +=  url + google_ads[i].visible_url + '</a>';
			}
		}
		pe_adsense = s;
	}
}

function changeAdsenseClass(id) {
	document.getElementById(id).className='adsense_box adsense_home';
	} 

// adsense for search
function google_afs_request_done(google_ads){
	var google_num_ads = google_ads.length;
	if (google_num_ads <= 0){
	  return;
	}
	
	var wideAds = "";   // wide ad unit html text
	var wideAds2 = "";   // wide ad unit html text
	
	for(i = 0; i < google_num_ads; i++) {
		if (google_ads[i].type=="text/wide") {
			var layout = '<div style="float:left;padding:0 0 5px 0;width:' + google_afs_width + '">' +
				  '<dl>' + '<dt>' + '<a target="_blank" onmouseover="javascript:window.status=\'' +
				  google_ads[i].url + '\';return true;" ' +
				  'onmouseout="javascript:window.status=\'\';return true;" ' +
				  'href="' + google_ads[i].url + '">' +
				  google_ads[i].line1 + '</a></dt>' +
				  '<dd>' + '<a style="text-decoration:none" target="_blank" onmouseover="javascript:window.status=\'' +
				  google_ads[i].url + '\';return true;" ' +
				  'onmouseout="javascript:window.status=\'\';return true;" ' +
				  'href="' + google_ads[i].url + '">' +
				  google_ads[i].line2 + '</a></dd>' + '</dl>' +
				  '<a style="text-decoration:none" target="_blank" onmouseover="javascript:window.status=\'' +
				  google_ads[i].url + '\';return true;" ' +
				  'onmouseout="javascript:window.status=\'\';return true;" ' +
				  'href="' + google_ads[i].url + '">' + google_ads[i].visible_url + '</a>'+ '</div>';
		if (i<3) {
			document.getElementById('wide_ad_unit').style.display = 'block';
			wideAds+=layout;
		} else {
			document.getElementById('wide_ad_unit2').style.display = 'block';
			wideAds2+=layout;
		}         
	}
	}
	
	var google_link = '<a ' +
				'href="http://services.google.com/feedback/online_hws_feedback">' +
				'<h3>Ads door Google</h3></a>';
	if (wideAds != "") {
	  wideAds = google_link + wideAds;
	}
	if (wideAds2 != "") {
	  wideAds2 = google_link + wideAds2;
	}
	if(document.getElementById("wide_ad_unit")) {
	document.getElementById("wide_ad_unit").innerHTML = wideAds;
	}
	if(document.getElementById("wide_ad_unit2")) {
	document.getElementById("wide_ad_unit2").innerHTML = wideAds2;
	}
}

	google_afs_adpage = '1';
	google_afs_client = 'pub-9203011274435390'; // substitute your client ID
	google_afs_channel = '5799459559'; // enter your custom channel ID
	//google_afs_gl = 'be';
	google_afs_hl = 'nl'; // enter your interface language if not English
	//google_afs_oe = 'utf8'; // select output encoding scheme
	google_afs_adtest = 'on'; // for testing


// DROPDOWN ZONDER GO-BUTTON
function jumpMenu(obj) {
     for (i = 1; i < obj.length; i++)
        if (obj[i].selected == true)
           eval(obj[i].value);
}

// Kanaal FUN
function loadVideo(type,target)
{	
	document.getElementById('gameContainer').innerHTML = document.getElementById(target).innerHTML;
	wtExtLink('HLN','wt.extVideo',type);
}

function LoadGame(target)
{
	
	document.getElementById('gameContainer').innerHTML = document.getElementById(target).innerHTML;
}

function LoadHighScores(target)
{

	document.getElementById('gameContainer').innerHTML = document.getElementById(target+'HighScore').innerHTML;
}

var random = Math.random() ;
var picnumActie = Math.round(random*8)+1; //(random*aantal foto's -1)!!! Als er 12 foto's zijn, 11 invullen
var picnumAvontuur = Math.round(random*9)+1; 
var picnumDans = Math.round(random*7)+1; 
var picnumPuzzel = Math.round(random*17)+1; 
var picnumRacing = Math.round(random*2)+1;
var picnumRetro = Math.round(random*9)+1; 
var picnumShoot = Math.round(random*12)+1; 
var picnumSimulatie = Math.round(random*2)+1; 
var picnumSport = Math.round(random*8)+1; 
var picnumClassics = Math.round(random*12)+1;

// DROPDOWN NAVIGATIES VOOR SPORT
var prog = 100;

function montre(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
prog = 100;
}

function decr(){
  if (prog > 0){
    prog = prog - 20;
    setTimeout("decr()",1000)
  }  else { 
    montre();  
   }
}

function mnuSetTimer(interval){
prog = interval;
}

function onLoadFunctions() {
	montre();
}





function loadTheUrl(a,b){
	try{ document.getElementById("scoreboadLoading").style.display = "block"; }
	catch(err){ }
	
	getUrl(a,b);
}


		/* Javascript bij xml/xsl concertagenda Mojo */
		function toggleDisp() {
			for (var i=0;i<arguments.length;i++){
				var d = $(arguments[i]);
				if (d.style.display == 'none'){
					d.style.display = 'block';
				} else {
					d.style.display = 'none';
				}
			}
		}
	
		function toggleTab(num,numelems,opennum,animate) {
			if ($('tabContent'+num).style.display == 'none'){
		
				for (var i=1;i<=numelems;i++){
					if ((opennum == null) || (opennum != i)){
						var temph = 'tabHeader'+i;
						var h = $(temph);
						if (!h){
							var h = $('tabHeaderActive');
							h.id = temph;
						}
						var tempc = 'tabContent'+i;
						var c = $(tempc);
						if(c.style.display != 'none'){
							if (animate || typeof animate == 'undefined'){
								Effect.toggle(tempc,'blind',{duration:0.5, queue:{scope:'menus', limit: 3}});
							} else {
								toggleDisp(tempc);
							}
						}
					}
				}
				var h = $('tabHeader'+num);
				if (h) {
					h.id = 'tabHeaderActive';
				}
				h.blur();
				var c = $('tabContent'+num);
				c.style.marginTop = '2px';
				if (animate || typeof animate == 'undefined'){
					Effect.toggle('tabContent'+num,'blind',{duration:0.5, queue:{scope:'menus', position:'end', limit: 3}});
					/*c.style.display = 'block';*/
				}else{
					toggleDisp('tabContent'+num);
				}
					
			}
		}


/* Javascript bij xml/xsl JobTrack */
function goJobTrack(page){
	
			if(!page){
				var searchRadius = 30;
				var date = new Date();
				var mtime = date.getTime();
				var JT_Keyword = document.getElementById("JT_Keyword").value;
				var JT_PCPlaats = document.getElementById("JT_PCPlaats").value;
				
				var JT_City = "";
				var JT_ZipCode = "";
				if(isNaN(JT_PCPlaats.substr(0, 4)))	JT_City = JT_PCPlaats;
				else JT_ZipCode = JT_PCPlaats.substr(0, 4);	
				
				page = "";
				
				if((JT_City != "") && (JT_Keyword != "")) {
					page = "AD/SearchJobOpeningResultPage.aspx?kword=" + JT_Keyword + "&city=" + JT_City + "|" + searchRadius + "&so=4";
				} else if((JT_ZipCode != "") && (JT_Keyword != "")) {
					page = "AD/SearchJobOpeningResultPage.aspx?kword=" + JT_Keyword + "&zipcode=" + JT_ZipCode + "|" + searchRadius + "&so=4";
				} else if(JT_City != "") {
					page = "AD/SearchJobOpeningResultPage.aspx?city=" + JT_City + "|" + searchRadius + "&so=4";
				} else if(JT_ZipCode != "") {
					page = "AD/SearchJobOpeningResultPage.aspx?zipcode=" + JT_ZipCode + "|" + searchRadius + "&so=4";
				} else if(JT_Keyword != "") {
					page = "AD/SearchJobOpeningResultPage.aspx?kword=" + JT_Keyword + "&so=4";
				}		
			} else {
				page = page;	
			}
			
			var url = "/static/nmc/nmc/frameset/varia/jobtrack.html?url=http://www.jobtrack.nl/jobtrack/" + page;
			window.location = url;
			
		}
		
function nmc_positionSky(){
	
	var tboosterheight = document.getElementById('ad_tbooster').offsetHeight;
	var skyheight = document.getElementById('ad_skyscraper').offsetHeight;
	
	if (tboosterheight < 20){
		if (skyheight < 20){
			document.getElementById('nmcSky').style.top = "44px";
       	}
	}	
}

function leaderArrow(){
	if (document.getElementById('ad_leaderboard')) {
		var leaderheight = document.getElementById('ad_leaderboard').offsetHeight;
		var leaderwidth = document.getElementById('ad_leaderboard').offsetWidth;
		if (leaderheight > 20) {
			document.getElementById('ad_leaderboard').style.width=leaderwidth;
			document.getElementById('leaderArrow').style.display='block';
			setTimeout("document.getElementById('leaderArrow').setAttribute('class', 'leaderArr');",2000);
		}
	}
}

function imu0Arrow(){
	if (document.getElementById('ad_imu0')) {
		var imu1height = document.getElementById('ad_imu0').offsetHeight;
		if (imu1height > 20) {
			document.getElementById('imu0Arrow').style.display='block';	
			setTimeout("document.getElementById('imu0Arrow').setAttribute('class','imu0Arr');",2000);
		}
	}
}

function imu1Arrow(){
	if (document.getElementById('ad_imu1')) {
		var imu1height = document.getElementById('ad_imu1').offsetHeight;
		if (imu1height > 20) {
			document.getElementById('imu1Arrow').style.display='block';	
			setTimeout("document.getElementById('imu1Arrow').setAttribute('class','imu1Arr');",2000);
		}
	}
}

function imu2Arrow(){
	if (document.getElementById('ad_imu2')) {
		var imu2height = document.getElementById('ad_imu2').offsetHeight;
		if (imu2height > 20) {
			document.getElementById('imu2Arrow').style.display='block';	
			setTimeout("document.getElementById('imu2Arrow').setAttribute('class','imu2Arr');",2000);
		}
	}
}

function imu3Arrow(){
	if (document.getElementById('ad_imu3')) {
		var imu3height = document.getElementById('ad_imu3').offsetHeight;
		if (imu3height > 20) {
			document.getElementById('imu3Arrow').style.display='block';	
			setTimeout("document.getElementById('imu3Arrow').setAttribute('class','imu3Arr');",2000);
		}
	}
}

function skyArrow(){
	if (document.getElementById('ad_skyscraper')) {
		var skyheight = document.getElementById('ad_skyscraper').offsetHeight;
		var skywidth = document.getElementById('ad_skyscraper').offsetWidth;
		if (skyheight > 20) {
			document.getElementById('ad_skyscraper').style.width=skywidth;
			document.getElementById('skyArrow').style.display='block';
			setTimeout("document.getElementById('skyArrow').setAttribute('class','skyArr');",2000);
		}
	}
}

function boostArrow(){
	//Check version IE
	var browser;
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent))
		{ //test for MSIE x.x;
			  browser=new Number(RegExp.$1) // capture x.x portion and store as a number
		}
	//IF IE version < 8
	if (browser < "8")
	{
		//Remove arrow boost
	}
	else
	{
		if (document.getElementById('ad_tbooster')) {
			var boostheight = document.getElementById('ad_tbooster').offsetHeight;
			if (boostheight > 20) {
				document.getElementById('boostArrow').style.display='block';
				setTimeout("document.getElementById('boostArrow').setAttribute('class','boostArr');",2000);
		}
	}
	}
	
	
}

//begin insites

// Number of pageviews required before showing the popup.
// 0 means 0 pageviews.
// 1 means 1 pageviews.
var showPopupAfter = 2

function MWM2POPUPWriteCookie(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=/;";
}

function MWM2POPUPReadCookie(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;
}

function MWM2POPUPEraseCookie(name) {
    MWM2POPUPWriteCookie(name, "", -1);
}


function PopupCounter(link, title, body, bodybottom, closePauzePeriod, logo, closeButton) {
    WriteCSS(closeButton);

    var i = MWM2POPUPReadCookie('MWM2POPUPCounterAD');
	
	if(i == null) {
		i = 0;
	}
	
    if ((i > -1) || (i == null)) {
        if (i >= showPopupAfter) {
            document.write('<div class="MWM2POPUP" id="MWM2POPUP">');
            document.write('<table border=0 cellpadding=0 cellspacing=0 width=255 align=center>');
            document.write('<tr>');
            document.write('<td class="MWM2POPUPTopbar" style="background-color:white;"><div class="MWM2POPUPTopbar" style="float:left; "><img vspace="3" hspace="2" src="' + logo + '" alt="' + title + '" title="' + title + '"></div>');
            document.write('<div style="float:right;" class="MWM2POPUPCloseButton" onclick="document.getElementById(\'MWM2POPUP\').style.display=\'none\';MWM2POPUPWriteCookie(\'MWM2POPUPCounterAD\',-1,7);">&nbsp;</div></td>');
            document.write('</tr>');
            document.write('<tr>');
            document.write('<td class="MWM2POPUPBody">');
            document.write('<table>');
            document.write('<tr><td>');

            document.write(body);

            document.write('<table border=0><tr><td>E-mail:</td><td><input type=text class="MWM2POPUPText" name="mwm2email" id="mwm2email"></td></tr>');
            document.write('<tr><td colspan="2" align=right><input type="button" class="MWM2POPUPButtons" onclick="MWM2PopupClickYes(\'' + link + '\')" value="Lid worden" /></td></tr>');
            document.write('<tr><td align=center colspan=2><a class="MWM2POPUPLINK" href="#" onclick="MWM2POPUPWriteCookie(\'MWM2POPUPCounterAD\',-1,\'2000\');window.location.reload();" alt="Nee, ik wens niet deel te nemen">Nee, ik wens niet deel te nemen.<br />Sluit dit venster.</a></td></tr></table>');
            document.write('</td></tr>');
            document.write('</table>');

            if (bodybottom != null) {
                document.write(bodybottom);
            }

            document.write('</td>');
            document.write('</tr>');
            document.write('</table>');
            document.write('</div>');
        }


        i++;
        MWM2POPUPWriteCookie('MWM2POPUPCounterAD', i);
    }
}


//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//
//                                          CHANGEBLE PARTS BELOW
//
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

function MWM2PopupClickYes(link) {
    document.getElementById('MWM2POPUP').style.display = 'none';
    var email = document.getElementById('mwm2email').value;
    MWM2POPUPWriteCookie('MWM2POPUPCounterAD', -1, '2000');
    window.open('http://net.mwm2.nl/third/persgroep/verwerken.aspx?email=' + email + '&paper=AD', 'survey', '', true);
}

function MWM2ShowPopup(logo, closeButton) {
    var title = '';
    var body = '';
    var bodybottom = '';

    title = 'AD';

    body += '<b>Ben jij een vaste bezoeker van AD.nl?<br /><br />Geef jouw mening en word lid van het AD.nl panel<br/><br/>';

    PopupCounter('', title, body, '', 1, logo, closeButton);
}

function WriteCSS(closeButton) {
    document.write("<style>");

    document.write(".MWM2POPUPTopbar");
    document.write("{");
    document.write("height: 67px;");
    document.write("}");

    document.write(".MWM2POPUPLINK");
    document.write("{");
    document.write("text-decoration: underline;");
    document.write("}");

    document.write(".MWM2POPUPLINK a");
    document.write("{");
    document.write("color:black;");
    document.write("font-size:11px;");
    document.write("}");

    document.write(".MWM2POPUPBody");
    document.write("{");
    document.write("background-color:white;");
    document.write("font-size:11px;");
    document.write("font-family:arial;");
    document.write("color:black;");
    document.write("padding:5px;");
    document.write("text-align:left;");
    document.write("}");

    document.write(".MWM2POPUPButtons");
    document.write("{");
    document.write("font-size:12px;");
    document.write("width:75px;");
    document.write("font-family:arial;");
    document.write("margin-right:2px;");
    document.write("}");

    document.write(".MWM2POPUP");
    document.write("{");
    document.write("width:257px;");
    document.write("background-color:white;");
    document.write("padding-top:0px;");
    document.write("padding-bottom:2px;");
    document.write("font-family:arial;");
    document.write("padding:7px;");
    document.write("position: absolute;");
    document.write("top: 250px;");
    document.write("left: 350px;");
    document.write("z-index:9999;");
    document.write("border: 1px solid #CB302A;");
    document.write("}");

    document.write(".MWM2POPUPCloseButton");
    document.write("{");
    document.write("margin-top:2px;");
    document.write("margin-right:2px;");
    document.write("background-image:url(" + closeButton + ");");
    document.write("font-family:arial;");
    document.write("width:14px;");
    document.write("height:14px;");
    document.write("cursor:pointer;");
    document.write("}");

    document.write(".MWM2POPUPText");
    document.write("{");
    document.write("width: 184px;");
    document.write("border: 1px solid black;");
    document.write("}");

    document.write(".MWM2POPUPButton");
    document.write("{");
    document.write("cursor:pointer;");
//    document.write("    background-image:url(" + sendButton + ");");
    document.write("width:102px;");
    document.write("height:22px;");
    document.write("margin:5px;");
    document.write("}");

    document.write("</style>");
}

//end insites
