////////////////////////////////////////////////////////////////////////

//break out of frames
onload = function() {if (top.location != document.location) top.location.href = document.location.href;}

////////////////////////////////////////////////////////////////////////

function open_window(url, name, width, height, params){
	//open window centred on screen
	var yCentre = (screen.availHeight / 2) - (height / 2);
	var xCentre = (screen.availWidth / 2) - (width / 2);
	if (!params) params = "resizable=yes, scrollbars=no";
  var options = "width=" + width + ",height=" + height + ", top=" + yCentre + ", left=" + xCentre + ", " + params;
	
	var win = window.open(url, name, options);
	win.focus();

	return win
}

////////////////////////////////////////////////////////////////////////

function toggle_visibility(id) {
  var ele = document.getElementById(id);
  ele.style.display = (ele.style.display == 'block') ? 'none' : 'block';
}

////////////////////////////////////////////////////////////////////////

function add_to_favourites(){
  if (document.all) window.external.AddFavorite("http://www.lostcousins.com","Lost Cousins")
}

////////////////////////////////////////////////////////////////////////

//combine two funcs - used to add to page onload func
function chain(func1, func2) {
  return function(){
    if (func1) func1();
    if (func2) func2();
  }
}

////////////////////////////////////////////////////////////////////////

function check_cookies() {
  var date = new Date();
  time = new String(date.getTime());
  document.cookie = "check_cookie=" + time + "; path=/";
  if (document.cookie.indexOf(time, 0) < 0) {
    alert('This site uses Cookies to manage user login details.\nYour browser does not have Cookies enabled.\nPlease enable Cookies in your browser settings if you wish to login.');
  }
}
