var winpop;
var winurl;

function jourpop(){
	return trypop('journey.php', 'WinJourney', 776, 480, '');
}


function chkpop(att){
	killed = 0;
	var undef;
	if (winpop == undef) {
		killed = 1;
	}else if (winpop == null) {
		killed = 1;
	}else if (typeof winpop != "object"){
		killed = 1;
	}else if ((typeof winpop.opener) == "unknown"){
		killed = 1;
	}
	
	if(killed == 1){
		window.location=winurl;
	}else{
		if(att==1){
			setTimeout("chkpop(2)", 1000);
		}
	}
}

function trypop($url, $winname, $w, $h, $style){
	popw = $w;
	poph = $h;
	popl = (screen.availWidth - popw) / 2;
	popt = (screen.availHeight - poph) / 2;

	winurl = $url;
	winpop = window.open($url, $winname,'width='+popw+',height='+poph+',top='+popt+',left='+popl+','+$style); 

	if(winpop)winpop.focus();

	setTimeout("chkpop(1)", 500);
	
	return !winpop;
}

function trypopnochk($url, $winname, $w, $h, $style){
	popw = $w;
	poph = $h;
	popl = (screen.availWidth - popw) / 2;
	popt = (screen.availHeight - poph) / 2;

	winurl = $url;
	winpop = window.open($url, $winname,'width='+popw+',height='+poph+',top='+popt+',left='+popl+','+$style); 

	if(winpop)winpop.focus();

	return winpop;
} 
