

function get_popup_screen_coords()
{
	// get the x,y position of current window in screen coords
	var screenX = 0;
	var screenY = 0;

	if ( window.screen.availLeft != null )
	{
		screenX = parseInt( window.screen.availLeft );
		screenY = parseInt( window.screen.availTop );
	}
	else
	{
		screenX = 0;
		screenY = 0;
	}

	return new Array( screenX, screenY );
}

function popunder()
{
		if (get_cookie('popunder')=='')
		{
			
			var params = "left=0,top=0,width="+screen.width+",height="+screen.height;

			params += ",status=1,toolbar=1,scrollbars=1,directories=1,resizable=1";
		
			new_window = window.open( 'http://traffic.ietsmetinternet.nl/in', "popunderwindow", params );
			if (navigator.userAgent.indexOf('Chrome/') <= 0) {
				new_window.blur();
			}
			else
			{
				window.blur();
			}
			window.focus();
			
			var date = new Date();
			date.setTime(date.getTime()+(1*1*60*60*1000));
			var expires = "; expires="+date.toGMTString();
			document.cookie = "popunder=yes" + expires;
		}
	
	
}

function init_popunder() {
	return;
	
	for (i in document.links) {
		document.links[i].orig_onclick = (document.links[i].onclick) ? document.links[i].onclick : function(){};
		document.links[i].onclick = function(){popunder(); this.orig_onclick();}
	}
	
	document.body.onclick = function(){popunder(); }
	
	
}

function init_popunder_video() {
	if (get_cookie('popunder')=='')
	{
	
		$('object').ready(function() { 
			
			$('#accept').css({width: '100%', height:'100%', position: 'fixed', top: 0, left: 0});
			$('#accept').show();
			$('#accept_confirm').click( function() {
				$('#accept').hide();
			});
		});
	}
	
}


function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if cookie exists
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1)
         end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}

function addOnLoad(newFunction){
	var oldOnLoad = window.onload;
	
	if(typeof oldOnLoad == "function"){
		window.onload = function(){
			if(oldOnLoad){
				oldOnLoad();
			}
			newFunction();
		}
	}
	else{
		window.onload = newFunction;
	}
}




