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)
{
    createCookie(name, "", -1);
}


function PopupCounter(link, showCount, closePauzePeriod, closeButton)
{
    WriteCSS(closeButton);

    var i = MWM2POPUPReadCookie('MWM2POPUPCounter');
    
    if((i > - 1) || (i == null))
    {
        if(i >= showCount)
        {
			var title = 'Greenpeace website onderzoek';
			var body = '';
			
			body += 'Greenpeace wil graag van haar bezoekers weten hoe ze de site ervaren en heeft daarom een korte vragenlijst opgesteld. ' ;
			body += '<br><br> Je mening is heel belangrijk en kan worden gebruikt om de site verder te verbeteren.<br><br>';
			body += '<center>Klik hier als je wilt meedoen! <br><br>';
						
            document.write('<div class="MWM2POPUP" id="MWM2POPUP">');
            document.write('    <table border="0" cellpadding="3" cellspacing="2" width="300" align="center">');
            document.write('        <tr>');
            document.write('            <td class="MWM2POPUPTopbar"><div class="MWM2POPUPTopbar" style="float:left;">' + title + '</div><div style="float:right;" class="MWM2POPUPCloseButton" onclick="document.getElementById(\'MWM2POPUP\').style.display=\'none\';MWM2POPUPWriteCookie(\'MWM2POPUPCounter\',-1,' + closePauzePeriod + ');"></div></td>');
            document.write('        </tr>');
            document.write('        <tr>');
            document.write('            <td class="MWM2POPUPBody">');
            document.write('				<table><tr>');
            document.write('				<td>');
            document.write(body);
            document.write('                ');
            document.write('                    <input type=button name=Ja value="Ja" class="MWM2POPUPButtons MWM2POPUPButtonJA" onclick="MWM2PopupClickYes(\'' + link + '\')">');
            document.write('                    <input type=button name=Nee value="Nee" class="MWM2POPUPButtons MWM2POPUPButtonNEE" onclick="MWM2POPUPWriteCookie(\'MWM2POPUPCounter\',-2,\'2000\');window.location.reload();">');
            document.write('                </center><br>');
            document.write('                </td></tr></table>');
            document.write('            </td>');
            document.write('        </tr>');
            document.write('    </table>');
            document.write('</div>');
        }

        i++;
        MWM2POPUPWriteCookie('MWM2POPUPCounter',i);
    }
}

//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//
//                                          CHANGEBLE PARTS BELOW
//
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

function MWM2PopupClickYes(link)
{
    MWM2POPUPWriteCookie('MWM2POPUPCounter',-1,3);
    document.getElementById('MWM2POPUP').style.display='none';

    window.open(link,'MWM2Onderzoekapplicatie','resizable=1,width=800,height=600,scrollbars=1');
}

function GreenpeacePopup(closeButton)
{
    PopupCounter('http://net.mwm2.nl/go.aspx?vp=5EDBF7A1-08A6-4995-A890-FF9C107CD3A5&alin=ja', 2, 3, closeButton);
}

function WriteCSS(closeButton)
{
    document.write("<style>");

    document.write(".MWM2POPUPTopbar");
    document.write("{");
    document.write("    font-size:12px;");
    document.write("    font-family:verdana;");
    document.write("    color:black;");
    document.write("    font-weight:bold;");
    document.write("}");

    document.write(".MWM2POPUPButtons");
    document.write("{");
    document.write("    font-size:10px;");
    document.write("    width:45px;");
    document.write("    font-family:verdana;");
    document.write("    margin-right:15px;");
    document.write("}");

    document.write(".MWM2POPUPBody");
    document.write("{");
    document.write("     background-color:#F5FFF3; border:solid 1px #96DA83;");
    document.write("     font-size:10px;");
    document.write("    font-family:verdana;");
    document.write("}");

    document.write(".MWM2POPUP");
    document.write("{");
    document.write("    width:300px;");
    document.write("    background-color:#66CC00; border:solid 1px #96DA83;");
    document.write("    padding-top:2px;");
    document.write("    padding-bottom:2px;");
    document.write("    font-family:arial;");
    document.write("    padding-left:2px;");
    document.write("    padding-right:2px;");
    document.write("    position: absolute;");
    document.write("    top: 200px;");
    document.write("    left: 450px;");
    document.write("    z-index:9999;");
    document.write("}");

    document.write(".MWM2POPUPCloseButton");
    document.write("{");
    document.write("    margin-top:2px;");
    document.write("    width:14px;");
    document.write("    background-image:url(" +  closeButton +");");
    document.write("    height:14px;");
    document.write("    cursor:pointer;");
    document.write("    font-family:verdana;");
    document.write("}");

    document.write("</style>");
}// JScript File


