// -----------------------------------------------------------------------
// This file is part of aroundme
// 
// Copyright (C) 2003, 2005 Barnraiser
// http://www.barnraiser.org/
// info@barnraiser.org
// 
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option) any
// later version.
// 
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with program; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
// -----------------------------------------------------------------------

//puts browser window at top (out of frames) - stops bug with registering from inside hotmail frame.

if (self != top){
   if (document.images) top.location.replace(document.location.href);
   else top.location.href = document.location.href;
}




var myWindow;

function launchPopupWindow(page, name, customise, alignrightwidth) {
	if(myWindow && !myWindow.closed) {
			myWindow.close();
	}
	
	var winMargin = 10;
	
	if (alignrightwidth) {
		customise = customise + ',left='+((parseInt(screen.availWidth)-alignrightwidth)-winMargin);
		customise = customise + ',top='+winMargin;
	}

	myWindow = window.open(page,name,customise);
	myWindow.focus();
}

function openwin(theURL, sz) { 
	Dialog.alert({url: theURL, options: {method: 'get'}}, 
            {className: "alphacube", width:540, okLabel: "Close"});
}

function openwin2(theURL, sz) { 
	Dialog.alert({url: theURL, options: {method: 'get'}}, 
            {className: "alphacube", width:800, height:600, okLabel: "Close"});
}

WindowCloseKey.init();



function openwinver2(theURL, wid, hg) { 
	var st = "";
	if (wid > screen.availwidth || hg > screen.availheight) {
		lt = 0;
		tp = 0 ;
	} else {
		lt = ((screen.availwidth/4)-(hg/2));	
		tp = ((screen.availheight/4)-(wid/2));
				lt = 0;
		tp = 0 ;

	}
	if (wid > screen.availwidth) {
		wid = screen.availwidth -30;
	}
	if (hg > screen.availheight) {
		hg = screen.availheight - 35;
	}
	st = "left="+lt+",";
	st = st + "top="+tp+",";
	st = st + "status=no,";
	st = st + "menubar=no,";
	st = st + "width="+wid+",";
	st = st + "height="+hg+",";
	st = st + "resizable=yes,";
	
		st = st + "scrollbars=yes";
	
	window.open(theURL,'_blank',st);
}

function objShowHide(id, state) {
	if (document.getElementById) {
		document.getElementById(id).style.display = state;
	}
	else {
		if (document.layers) {
			document.id.visibility = state;
		}
		else { // IE 4
			document.all.id.style.display = state;
		}
	}
}