function findPos(obj) {
	var curleft = 0;
	var curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function splitScreen(section) {
	new Effect.DropUp('splash_top_wrapper');
	new Effect.DropOut('splash_bottom_wrapper', {afterFinish:
		function() { Element.hide('splash') }});
	new Effect.Appear(section, {queue: 'end'});
}

function popUp(section) {
	Element.show('black_screen');
	Element.show(section);
}

function closePopUp(section) {
	Element.hide('black_screen');
	Effect.Collapse(section);
}

function showThumbnail(thumbnail, anchor) {
	var dims = $(anchor).getDimensions();
	var pos = findPos($(anchor));
	x_pos = pos[0] + dims.width + 1;
	y_pos = pos[1] + dims.height + 1;
    $(thumbnail).setStyle({
	  left: x_pos + 'px',
      top:  y_pos  + 'px'
    });
	Element.show(thumbnail);
}

function hideThumbnail(thumbnail) {
	Element.hide(thumbnail);
}

function swapImage(image, newSrc) {
	$(image).src = newSrc;
}

function rightClickWarning(e) {
	if (document.all) {
		if (event.button==2||event.button==3) {
			if (event.srcElement.tagName=="IMG"){
				alert(clickmessage);
				return false;
			}
		}
	} else if (document.layers) {
		if (e.which == 3) {
			alert(clickmessage);
			return false;
		}
	} else if (document.getElementById){
		if (e.which==3&&e.target.tagName=="IMG"){
			alert(clickmessage)
			return false
		}
	}
}

function associateimages(){
	for(i=0;i<document.images.length;i++)
		document.images[i].onmousedown=rightClickWarning;
	}

