var speed = 30;
var show = true;
var backgroundurl = 'http://www.ero-int.nl/ads/mijnsexdate/msd.gif';
var clickurl = 'http://www.mijnseksdate.nl';
var thumburl = '';
var delay = 1000;
var target = 0;
var boxwidth = 300; 
var boxheight = 250;
var floattimer = null;
var runonce = false;

function getscreenwidth() {
    var windowwidth = 0;
    if (typeof window.innerWidth == 'number') {
    	var windowwidth = window.innerWidth;
    	if (window.scrollMaxY > 0) {
    		windowwidth -= 17;
    	}
    } else if (document.documentElement.clientWidth) {
    	windowwidth = document.documentElement.clientWidth;
    } else if (document.body && document.body.clientWidth) {
    	windowwidth = document.body.clientWidth;
    }
    
    var windowleft = 0;
    if (navigator.appName.indexOf('Netscape') != -1) {
    	windowleft = window.pageXOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {
    	windowleft = document.documentElement.scrollLeft;
    } else if (document.body ? document.body : false) {
    	windowleft = document.body.scrollLeft;
    }
    windowleft = typeof windowleft == 'number' ? windowleft : 0;
    return windowleft + windowwidth;
}

function getscreenheight() {
    var windowheight = 0;
    if (typeof window.innerHeight == 'number') {
    	windowheight = window.innerHeight;
    	if (window.scrollMaxX > 0) {
			windowheight -= 17;
    	}
    } else if (document.documentElement.clientHeight) {
    	windowheight = document.documentElement.clientHeight;
    } else if (typeof document.body.clientHeight == 'number') {
    	windowheight=document.body.clientHeight;
    }
    
    var windowtop = 0;
    if (window.innerHeight) {
    	windowtop = window.pageYOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {
    	windowtop = document.documentElement.scrollTop;
    } else if (document.body ? document.body : false) {
    	windowtop = document.body.scrollTop;
    }
    windowtop = typeof windowtop == 'number' ? windowtop : 0;
    return windowtop + windowheight;
}

function floatit() {
  document.getElementById('div1_b275a4').style.top = ((getscreenheight()) - boxheight) + 'px';
  document.getElementById('div1_b275a4').style.left = ((getscreenwidth()) - (boxwidth + 15)) + 'px';
  floattimer = setTimeout('floatit()',30);
}

function moveit(){
    var tmp = parseInt(document.getElementById('div2_b275a4').style.top);
    if (tmp > 0) {
    	tmp = tmp - speed;
    	if (tmp < 0) {
    		tmp = 0;
    	}
    	document.getElementById('div2_b275a4').style.top = tmp + 'px';
    	setTimeout('moveit()',30);
    }
}

function gotourl(target,url) {
	var temp = new Date();
	temp.setHours(temp.getHours() + 1);
	document.cookie = 'kc_alertbox=1; expires=' + temp.toGMTString() + '; path=/';
	if (show == true) {
		if (url != '') {
			if (target == '0') {
				var temp = window.open();
				if (!temp) {
					temp = top;
				}
				temp.location.href = url;
			} else {
				top.location.href = url;
			}
		}
	}
	show = false;
    document.getElementById('div1_b275a4').style.display = 'none';
	clearTimeout(floattimer);
}

function loadme(func) {
    if (typeof window.onload != 'function') {
    	window.onload = func;
    } else {
    	var temp = window.onload;
    	window.onload = function() {
    		temp();
    		func();
    	}
    }
}

function run() {
    var cv = false;
    if (runonce == true) {
    	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('kc_alertbox=') == 0){
    			cv = c.substring('kc_alertbox='.length,c.length);
    		}
    	}
    }
    if (!cv) {
    	floatit();
    	moveit();
    }
}

document.write('<style type="text/css">');
document.write('#div1_b275a4,#div2_b275a4 {');
document.write('margin: 0px;');
document.write('padding: 0px;');
document.write('width: ' + boxwidth + 'px;');
document.write('height: ' + boxheight + 'px;');
document.write('}');
document.write('#div1_b275a4 {');
document.write('position: absolute;');
document.write('right: 15px;');
document.write('bottom: 0px;');
document.write('overflow: hidden;');
document.write('z-index: 0;');
document.write('}');
document.write('#div2_b275a4 {');
document.write('cursor: pointer;');
document.write('position: relative;');
document.write('}');
document.write('#div3_b275a4 {');
document.write('background: #c3c3c3 url(\'' + backgroundurl + '\') no-repeat;');
document.write('width: ' + boxwidth + 'px;');
document.write('height: ' + boxheight + 'px;');
document.write('}');
document.write('#div4_b275a4 {');
document.write('padding: 0px;');
document.write('margin: 0px;');
document.write('width: 201px;');
document.write('height: 28px;');
document.write('float: left;');
document.write('overflow: hidden;');
document.write('}');
document.write('#h1_b275a4 {');
document.write('padding: 0px 20px 0px 30px;');
document.write('margin: 0px;');
document.write('font-family: verdana;');
document.write('color: #666666;');
document.write('font-size: 8pt;');
document.write('font-weight: bold;');
document.write('line-height: 23px;');
document.write('}');
document.write('#div5_b275a4 {');
document.write('padding: 0px;');
document.write('margin: 0px;');
document.write('width: 76px;');
document.write('height: 88px;');
document.write('float: left;');
document.write('overflow: hidden;');
document.write('}');
document.write('#img1_b275a4 {');
document.write('width: 47px;');
document.write('height: 40px;');
document.write('border: 0px solid #ffffff;');
document.write('margin: 5px 0px 0px 9px;');
document.write('padding: 0px;');
document.write('}');
document.write('#div6_b275a4 {');
document.write('width: 125px;');
document.write('height: 88px;');
document.write('padding: 0px;');
document.write('margin: 0px;');
document.write('float: left;');
document.write('overflow: hidden;');
document.write('}');
document.write('#txt1_b275a4 {');
document.write('padding: 0px 25px 10px 0px;');
document.write('margin: 0px;');
document.write('font-family: verdana;');
document.write('color: #000000;');
document.write('font-size: 8pt;');
document.write('font-weight: normal;');
document.write('}');
document.write('</style>');
document.write('<div id="div1_b275a4">');
document.write('<div id="div2_b275a4" onclick="gotourl(\'' + target + '\',\'' + clickurl + '\')" style="top:' + boxheight + 'px;">');
document.write('<div id="div3_b275a4">');
document.write('</div>');
document.write('</div></div>');
loadme(function(){setTimeout('run()',delay);});
