pageLoad = false;
function showHeaderimg(){
var p = theImages.length;
var whichImage = Math.floor((Math.random()*(p)));
dis = document.getElementById("header");
var img = 'url('+pre+theImages[whichImage]+')';
dis.style.backgroundImage = img;
pageLoad = true;
}

function HotdealAlign(page) {
	xextra = -30;
	yextra = 120;
	switch(page){
	case 'base': yleft = 330; xtop = 655; break;
	case 'adm': yleft = 330; xtop = 671; break;
	case 'special': yleft = 330; xtop = 735; break;
	default: yleft = 330; xtop = 383; break;
	}
	$('#dedis img').css('opacity', '0');
	$('#dedis div').each(function (i){
	if($(this).hasClass('hotdeal')){
	offset = $(this).offset();
	xtop = offset.top;
	yleft = offset.left;
	$('#dedis img:eq('+i+')').offset({ top: xtop+xextra, left: yleft+yextra }).css('opacity', '1');
	}
	});
}

function changeimg(hover, dis, bg){
if(bg!==true){
var source = dis.src;
var img = "";
}else{
var img = "url(nix.png)";
var source = dis.style.backgroundImage;
}
split = source.split('.');
str = '';
for(i=0;i<(split.length-1);i++){
if(i!=split.length-2){
str += split[i]+'.';
}else{
str += split[i];
}}
if(hover===true){
if(str.indexOf('_h')==-1){
img = str+'_h.png';
}else{
img = source;
}
}else{
if(str.match('_h')=='_h'){
link = str.split('_');
img = link[0]+'.png';
}else{
img = source;
}
}
if(bg!==true){
dis.src = img;
}else{
a=img;
a=a.split("'").join("");
a=a.split('"').join("");
a=a.split(')').join("");
a=a.split('url(').join("");
dis.style.backgroundImage = 'url('+a+')';
}
}

		 document.onmousemove = balletjes;
		 hai = "hai";

		 function balletjes(){
		 if(hai=="hai"&&pageLoad==true){
		 ballen();
		 hai="doei";
		 }}

		 
		 function ballen() {
		 
			var header = $('#header').offset();
			ppp.load({
				canvas: "logo",
				pos: {
					x: header.left + 58, y: header.top + 30
				},
				circle: {
					size: 14,
					radius:16,
					friction: 0.5,
					spring: 0.3
				}
			});
		}
