
//for closing the popup and returning control to opener window
//from: http://www.htmlcodetutorial.com/
function targetopener(mylink, closeme, closeonly){
	if (! (window.focus && window.opener))return true;
	window.opener.focus();
	if (! closeonly)window.opener.location.href=mylink.href;
	if (closeme)window.close();
	return false;
}


function centerVertically(elementId){
	//center the content div
	
	//getWindowHeight
	var windowHeight = getWindowHeight();	
	var offset = 10;
	
	//if screen is higher then the height of the conntent
	if(windowHeight > 630){
		//determine offset so that the div is vertically - centered
		var offset = (windowHeight-630)/2; 
	}
	document.getElementById(elementId).style.top = offset + "px";
}


//returns window height
function getWindowHeight(){
  	var h = window.innerHeight;
    if(!h) h = document.documentElement.clientHeight;
    if(!h) h = document.body.clientHeight;
		return h;	
}
