function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

function showFullsize() {
	showdiv('portfolio_fullsize');
	hidediv('portfolio_main');
	hidediv('portfolio_navigation');
}

function hideFullsize() {
	showdiv('portfolio_main');
	showdiv('portfolio_navigation');
	hidediv('portfolio_fullsize');
}

function fadeOnLoad(id, millisec) {
	hidediv(id);
	changeOpac(0, id);
	showdiv(id);
	opacity(id,0,100,millisec);
}

function switchNav(id1, id2, millisec) {

	opacity(id1, 100, 0, millisec);
	setTimeout("hidediv('" + id1 + "')",millisec);
	setTimeout("showdiv('" + id2 + "')",(millisec + 1));
	setTimeout("changeOpac(0, '" + id2 + "')",(millisec + 1));
	setTimeout("opacity('" + id2 + "',0,100," + millisec +")",(millisec+1));
}

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) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
}

//roll over for thumbnails
function roll_over(img_name, img_src) {
	document[img_name].src = img_src;
}