
function preview(id, width, height)
{
  picwidth = width + 40;
  picheight = height + 50;    
  window.open('http://www.eigiljensen.com/preview.php?photoId='+id,'preview','width=' + picwidth + ',height=' + picheight +  ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
}


function getAbsoluteLeft(objectId) {
	// Get an object left position from the upper left viewport corner
	// Tested with relative and nested objects
	o = document.getElementById(objectId)
	oLeft = o.offsetLeft            // Get left position from the parent object
	while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent    // Get parent object reference
		oLeft += oParent.offsetLeft // Add parent left position
		o = oParent
	}
	// Return left postion
	return oLeft
}

function getAbsoluteTop(objectId) {
	// Get an object top position from the upper left viewport corner
	// Tested with relative and nested objects
	o = document.getElementById(objectId)
	oTop = o.offsetTop            // Get top position from the parent object
	while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent  // Get parent object reference
		oTop += oParent.offsetTop // Add parent top position
		o = oParent
	}
	// Return top position
	return oTop
}



var ie=document.all
var ns6=document.getElementById && !document.all
if (ie||ns6)
	var tipobj=document.all? document.all["morepictures2"] : document.getElementById? document.getElementById("morepictures2") : ""
var oldPic = -1;
function hide(num, textid)
{


	elem = document.getElementById('morepic' + num);
	kids = elem.childNodes;
	textElem = kids[0].childNodes[0];
	elem2 = document.getElementById('dhtmltooltip');

	// User clicked on Show	
	if(textElem.nodeValue == SHOWTEXT)
	{
		textElem.nodeValue = HIDETEXT;

		if (ns6||ie)
		{
			elem2.innerHTML=textid;
			elem2.style.left=getAbsoluteLeft('morepic' + num)-200+"px";
			elem2.style.top=getAbsoluteTop('morepic' + num)+20+"px";
			elem2.style.visibility="visible";
		}
		
		// Change text of prevous selected
		if(oldPic != -1 && oldPic!=num)
		{
			elem = document.getElementById('morepic' + oldPic);
			kids = elem.childNodes;
			textElem = kids[0].childNodes[0];
		
			textElem.nodeValue = SHOWTEXT;	
		}		
		oldPic = num;
	}
	// User clicked on Hide	
	else
	{
		textElem.nodeValue = SHOWTEXT;	
		if (ns6||ie)
		{
			elem2.style.visibility="hidden"
			elem2.style.left="-1000px"
			elem2.style.backgroundColor=''
			elem2.style.width=''
		}		
	}	
}
