//-----------------------------------------------------------
// Library with commonly used functions for the
// Homepage of William L.B.J. Dekker , PA o WLB
// Alphen aan den Rijn, The Netherlands
// http://home.planet.nl/~pa0wlb/
// Copyrights unless stated otherwise:
// (C) 2002, William L.B.J. Dekker
//-----------------------------------------------------------

// Global variables

var newEntry 	= true;

// Detect browser

var ns4= (navigator.appName=='Netscape' && parseInt(navigator.appVersion)==4);
var ns6= (document.getElementById)? true:false;
var ie4plus = (document.all)? true:false;
var ver4plus = (ns4 || ie4plus || ns6) ? true : false;

// script to escape from other frames 

if (top.frames.length != 0) {
	top.location = self.document.location;
}

// script to redirect to the new URL:
// http://www.pa0wlb.com/
// if accessed via the old URL's:
// http://home.planet.nl/~dekke486/ or
// http://home.kpn.nl/dekke486/

var thisPath=window.location.href;
thisPath=thisPath.split("/")[3]
var thisPage=window.location.href;
thisPage=thisPage.split("/")[4]

if (thisPath=='~dekke486' || thisPath=='dekke486') {

	newUrl='http://www.pa0wlb.com/';
	if (thisPage != '') {
		newUrl=newUrl+thisPage;
	}
	window.location=newUrl;

}

// script to set window size to a maximum size of 1152 x 864 pixels
//  or to the maximum available size if less than 1152 x 864 pixels

if (screen.width > 1152) {
	var windowW = 1152;
	var windowX = (screen.availWidth/2)-(windowW/2);
}
else {
	var windowW = screen.availWidth;
	var windowX = 0;
}

if (screen.height > 864) {
	var windowH = 864;
	var windowY = (screen.availHeight/2)-(windowH/2);
}
else {
	var windowH = screen.availHeight;
	var windowY = 0;
}

//Auto Maximize Window Script- By Nick Lowe (nicklowe@ukonline.co.uk)
//For full source code, 100's more free DHTML scripts, and Terms Of 
//Use Visit http://www.dynamicdrive.com

top.window.moveTo(windowX,windowY);
if (document.all) {
	top.window.resizeTo(windowW,windowH);
}
else if (document.layers||document.getElementById) {
	if (top.window.outerHeight < windowH||top.window.outerWidth < windowW){
	top.window.outerHeight = windowH;
	top.window.outerWidth = windowW;
	}
}

//--script to send email with email client-------------------

function sendEmail(name,prefix,subject) {

	var domain = 'pa0wlb.com'
	
	parent.location.href='mailto:'+name+'%20%3C'+prefix+'%40'+domain+'%3E?subject='+subject;
}

//--end of email script-------------------------------------------

//--scripts to display and clear messages in the Status Bar--

function clearStatus() {
	
	window.status= '';
  	return true
}

function setStatus(msg) {
	
	window.status= msg;
  	return true
}

//--End of status messages scripts---------------------------

// Script to open one of two pages with a Google map with the proper API key associated 
// with one ofthe following domains:
// http://home.planet.nl/~dekke486  OR
// http://home.planet.nl/~pa0wlb

function openMapPage () {

	var thisPath=window.location.href;
	thisPath=thisPath.split('/')[3]

	if (thisPath=='dekke486') {
		top.frames['main_window'].location = 'location_map2.html';
	} else {
		top.frames['main_window'].location = 'location_map1.html';
	}
}

// --End of library with commonly used functions-------------


