// google adsense 
function google_ad_request_done(google_ads) {
    var s = '';
    var i;
    if (google_ads.length == 0) {
      return;
    }
	
	var serviceUrl = 'http://services.google.com/feedback/abg?url=' + location.href + '&hl=nl&client=ca-' + google_ad_client;
	for(i=0; i < google_ads.length; ++i) {
		serviceUrl +=  '&adU=' + google_ads[i].visible_url;
		serviceUrl +=  '&adT=' + google_ads[i].line1.replace(/ /g,'+');
	}
	serviceUrl +=  '&done=1'

	s += '<h3 style="text-align:left">' + '<a href="' + serviceUrl +'" target="_blank">' + 'Google Advertenties' + '</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>';
    }
	    if (google_ads[0].bidtype == "CPC") { 
google_adnum = google_adnum + google_ads.length;
}
    document.write(s);
    return;
}

function collapseFlashTeaser() {}

function onLoadFunctions() {}

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 imu1Arrow(){
	if (document.getElementById('ad_imu')) {
		var imu1height = document.getElementById('ad_imu').offsetHeight;
		var imu1width = document.getElementById('ad_imu').offsetWidth;
		if (imu1height > 20) {
			document.getElementById('ad_imu').style.width=imu1width;
			document.getElementById('imu1Arrow').style.display='block';	
			setTimeout("document.getElementById('imu1Arrow').setAttribute('class','imu1Arr');",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('MWM2POPUPCounterParool');
	
	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"><div class="MWM2POPUPTopbar" style="float:left;"><img vspace="3" src="' + logo + '" alt="' + title + '" title="' + title + '"></div>');
            document.write('<div style="float:right;" class="MWM2POPUPCloseButton" onclick="document.getElementById(\'MWM2POPUP\').style.display=\'none\';MWM2POPUPWriteCookie(\'MWM2POPUPCounterParool\',-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(\'MWM2POPUPCounterParool\',-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('MWM2POPUPCounterParool', i);
    }
}


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

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

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

    title = 'Parool';

    body += '<b>Ben jij een vaste bezoeker van Parool.nl?<br /><br />Geef jouw mening en word lid van het Parool.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:#004996;");
    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("}");

    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
