﻿var checkIt;

function show(obj, id)
{
    el = document.getElementById(id);
	
	if (el.style.visibility != 'visible')
	{
		coors = findPos(obj);		
		
		el.style.top = (coors[1]-6) + 'px';
		el.style.left = coors[0] + 'px';
		
		checkUserInput();
		
		el.style.visibility = 'visible';
	} else {
		el.style.visibility = 'hidden';
	}
}

function hide(id)
{
	el = document.getElementById(id);
	if (el.style.visibility != 'hidden')
	{
		el.style.visibility = 'hidden';
	}
}

function checkUserInput()
{
	if (checkIt) clearTimeout(checkIt);
	checkIt = setTimeout('hide("dropdown")',2500);
}

function findPos(obj) {
	var curleft = 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 pop_open(link, width, height)
{
     
    var winl = (screen.width-width)/2;   
    var wint = (screen.height-height)/2;   
    var settings ='height='+height+',';
    settings +='width='+width+',';
    settings +='top='+wint+',';
    settings +='left='+winl;
    var photoWindow = window.open(link,"photo",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,'+settings);
    //var photoWindow = window.open(link,"photo",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width='+width+',height='+height);
}