var $NBT={v:"1.0",target_group:{},target_description:{}};

function target(u){
	var d=document;
	u=u.replace(new RegExp('/s\\?'),'/b?');
	ns_pixelUrl=u + "&ns__t="+(new Date().getTime());
	u='http:' + ns_pixelUrl+"&ns_c="+((d.characterSet)?d.characterSet:d.defaultCharset)+"&ns_ti="+escape(d.title)+"&ns_jspageurl="+escape(d.URL)+"&ns_referrer="+escape(d.referrer);
        var script = document.createElement("SCRIPT");
        script.type = 'text/javascript';
        script.src = u.replace(/(http:|https:)/i,document.location.protocol) + "&ns_callback=updatehtml()";
        document.getElementsByTagName("HEAD")[0].appendChild(script);
};


$(document).ready(function() {
  target("//youritube.nl/bt/michielb/fotolog/s?bt.test");
});

function updatehtml(data) {
    name=escape(Get_Cookie("name"));
    if((name=="null") && $NBT.target_group['page_visits']>20) showpoll();
}

function refusepoll() {
  $("#pollform").html("onbekend en zal dat blijven.<br/>Even goede vrienden!");
  sitestat("http://nl.sitestat.com/michielb/fotolog/s?poll.refuse");
   var expires = 90;
   Set_Cookie_rel("name","anonymous",expires,"/","","");
  setTimeout('hidepoll()',2000);

}
function hidepoll() {
  $("#poll").hide();
}

function showpoll() {
   $("#poll").css({'visibility':'visible'});
   sitestat("http://nl.sitestat.com/michielb/fotolog/s?poll.show");
} 

function getresults() {
  var name=$("#naam").val();
  if(name =="") name="anonymous";
  sitestat("http://nl.sitestat.com/michielb/fotolog/s?poll.given."+name);
  $("#pollform").html(name+".<br/>Bedankt voor het invullen!");
  var expires = 90;
  Set_Cookie_rel("name",name,expires,"/","","");
  setTimeout('hidepoll()',2000);
}
