
function na_restore_img_src(name, nsdoc) {
	var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
	if (name === '') {
	    return;}
	if (img && img.altsrc) {
		img.src    = img.altsrc;
		img.altsrc = null;
	}
}

function na_preload_img() { 
	var img_list = na_preload_img.arguments;
  
	if (document.preloadlist == null) 
		document.preloadlist = new Array();
	var top = document.preloadlist.length;
  
	for (var i=0; i < img_list.length; i++) {
		document.preloadlist[top+i]     = new Image;
		document.preloadlist[top+i].src = img_list[i+1];
	} 
}

function na_change_img_src(name, nsdoc, rpath, preload) { 
	var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
	if (name === '')
    return;

	if (img) {
		img.altsrc = img.src;
		img.src    = rpath;
	} 
}

function dateCheck(date) {
	var filter = /^[0-9][0-9]\/[0-9][0-9]\/[0-9][0-9][0-9][0-9]/;
	return filter.test(date);
}

function checkMail(email) {
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return filter.test(email);
}

function emailCheck (emailStr) {

	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray=emailStr.match(emailPat)

	if (matchArray==null) {
	  /* Too many/few @'s or something; basically, this address doesn't
		 even fit the general mould of a valid e-mail address. */
		alert("Email address seems incorrect (check @ and .'s)")
		return false
	}
	var user=matchArray[1]
	var domain=matchArray[2]

	// See if "user" is valid 
	if (user.match(userPat)==null) {
		// user is not valid
		alert("The username doesn't seem to be valid.")
		return false
	}

	/* if the e-mail address is at an IP address (as opposed to a symbolic
	   host name) make sure the IP address is valid. */
	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
		// this is an IP address
		  for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				alert("Destination IP address is invalid!")
			return false
			}
		}
		return true
	}

	// Domain is symbolic name
	var domainArray=domain.match(domainPat)
	if (domainArray==null) {
		alert("Please enter a valid domain name.")
		return false
	}

	/* domain name seems valid, but now make sure that it ends in a
	   three-letter word (like com, edu, gov) or a two-letter word,
	   representing country (uk, nl), and that there's a hostname preceding 
	   the domain or country. */

	/* Now we need to break up the domain to get a count of how many atoms
	   it consists of. */
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 || 
		domArr[domArr.length-1].length>3) {
	   // the address must end in a two letter or three letter word.
	   alert("The address must end in a three-letter domain, or two letter country.")
	   return false
	}

	// Make sure there's a host name preceding the domain.
	if (len < 2) {
	   var errStr="This address is missing a hostname!"
	   alert(errStr)
	   return false
	}

	// If we've gotten this far, everything's valid!
	return true;
}


function SWindow(URL,WD,HT) { 
	var specs = 'width='+WD+', height='+HT+', scrollbars=no,resizable=0,status=no,menubar=0';
	window.open(URL,'counter',specs); 
} 
function SSWindow(URL,WD,HT) { 
	var specs = 'width='+WD+', height='+HT+', scrollbars=yes,resizable=no,status=no,menubar=0';
	window.open(URL,'counter',specs); 
}

///////////////////////////////////////////////////////////////////////
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/

window.onerror = null;
var bName = navigator.appName;
var bVer = parseInt(navigator.appVersion);
var NS4 = (bName == "Netscape" && bVer >= 4);
var IE4 = (bName == "Microsoft Internet Explorer" && bVer >= 4);
var NS3 = (bName == "Netscape" && bVer < 4);
var IE3 = (bName == "Microsoft Internet Explorer" && bVer < 4);
var menuActive = 0
var menuOn = 0
var onLayer
var timeOn = null// LAYER SWITCHING CODE
if (NS4 || IE4) {
	if (navigator.appName == "Netscape") {
		layerStyleRef="layer.";
		layerRef="document.layers";
		styleSwitch="";
	} else{
		layerStyleRef="layer.style.";
		layerRef="document.all";
		styleSwitch=".style";
	}
}
 
// SHOW MENU
function showLayer(layerName) {
	if (NS4 || IE4) {
		if (timeOn != null) {
			clearTimeout(timeOn)
			hideLayer(onLayer)
		}
		if (NS4 || IE4) {
			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
		} 
		onLayer = layerName
	}
}
// HIDE MENU
function hideLayer(layerName){
	if (menuActive == 0) {
		if (NS4 || IE4) {
			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
		}
	}
}
// TIMER FOR BUTTON MOUSE OUT
function btnTimer() {
	timeOn = setTimeout("btnOut()",100)
}
// BUTTON MOUSE OUT
function btnOut(layerName) {
	if (menuActive == 0) {
		hideLayer(onLayer)
	}
}
// MENU MOUSE OVER 
function menuOver(itemName) {
	clearTimeout(timeOn)
	menuActive = 1
}
// MENU MOUSE OUT 
function menuOut(itemName) {
	menuActive = 0 
	timeOn = setTimeout("hideLayer(onLayer)", 200)
}