sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function vergrootThumb (imgType, imgId, imgTitle) {
	var mPic=document.getElementById('mediumpic');
	var mAnchor=document.getElementById('mediumanchor');
	var mAnchor2=document.getElementById('mediumanchor2');
	
	mPic.src='images/upload/'+imgType+'/medium/'+imgId+'.jpg';
	mPic.setAttribute('alt', imgTitle);
	mPic.setAttribute('title', imgTitle);
	mAnchor.setAttribute('href', 'images/upload/'+imgType+'/large/'+imgId+'.jpg');
	mAnchor.onclick=function() { vergrootMedium(imgType, imgId, imgTitle); return false; };
	
	return false;
}

function vergrootMedium (imgType, imgId, imgTitle) {
	vergrootMedium (imgType, imgId, imgTitle, 'large')
}

function vergrootMedium (imgType, imgId, imgTitle, imgSize) {
	if (imgSize==undefined)
		imgSize='large';
	window.open('foto_popup.php?type='+imgType+'&fid='+imgId+'&title='+imgTitle+'&size='+imgSize, 'fotoVenster', 'width=800, height=600, status=false, resizable=1, scrollbars=1');
	
	return false;
}

function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    if (opacity>=100)
		opacity=100;
	var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function blendimage(divid, imageid, imagefile, millisec) {
    var speed = Math.round(millisec / 100);
    var timer = 0;
    
    //set the current image as background
//    document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
    
    
    //make image transparent
    changeOpac(0, imageid);
	
    //make new image
    document.getElementById(imageid).src = imagefile;
    //changeOpac(0, imageid);
	
    //fade in image
    for(i = 0; i <= 100; i++) {
        setTimeout("changeOpac(" + i + ",'" + imageid + "')",(1000+timer * speed));
        timer++;
    }
}