
var tld_ = new Array()
tld_[0] = "com";
tld_[1] = "org";
tld_[2] = "net";
tld_[3] = "ws";
tld_[4] = "info";
tld_[5] = "ca";
tld_[10] = "co.uk";
tld_[11] = "org.uk";
tld_[12] = "gov.uk";
tld_[13] = "ac.uk";
var topDom_ = 13;
var m_ = "mailto:";
var a_ = "@";
var d_ = ".";


var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function formatphonenumber(raw_num)
{
	if (raw_num.value.length==3) {raw_num.value=raw_num.value+'-';}
}

function mail(name,dom,tl,params)
{
	var s = e(name,dom,tl);
	document.write('<a href="'+m_+s+params+'">'+s+'</a>');
}
function mail2(name,dom,tl,params,display)
{
	document.write('<a href="'+m_+e(name,dom,tl)+params+'">'+display+'</a>');
}
function e(name, dom, tl)
{
	var s = name+a_;
	if (tl!=-2)
	{
		s+= dom;
		if (tl>=0)
			s+= d_+tld_[tl];
	}
	else
		s+= swapper(dom);
	return s;
}
function swapper(d)
{
	var s = "";
	for (var i=0; i<d.length; i+=2)
		if (i+1==d.length)
			s+= d.charAt(i)
		else
			s+= d.charAt(i+1)+d.charAt(i);
	return s.replace(/\?/g,'.');
}

function create_box(boxid,inside, color,width,height, background){		
	titlecolor = "black"; 						
	opacitytitle = 45;   						
	if(!width){
	width = 500;            					
	height = 325;}								
	if(inside.indexOf(".htm") > inside.length -6)
	inside = "<iframe frameborder=0 name=\"box\" width="+(width-10)+" height="+(height-30)+" src=\""+inside+"\" scrolling=\"no\" ></iframe>"; 
	if(!color)
	color = "silver";				
	var thisspan1 = eval(boxid); 
	var thisspan = eval(boxid + ".style"); 	
	thisspan.visibility="visible";
	output = "<table cellpadding=0 cellspacing=0 width=" + width + " height=" + height + " border=1>";
	output += "<tr><td width=100% colspan=2><table cellpadding=1 cellspacing=1";   
	if(background)output += "style='background-color:\" " + background + "\"'";
	output += " width=100% height=100% bgcolor='"+color+"'><tr><td height=100% width=100% valign=top>"+ inside+"</td></tr></table></td></tr>";
	thisspan1.innerHTML = output;
}

function bookmarksite(title,url){
	if (window.sidebar) // firefox
		window.sidebar.addPanel(title, url, "");
	else if(window.opera && window.print){ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} 
	else if(document.all)// ie
		window.external.AddFavorite(url, title);
}

function filterNum(str) {
re = /^\$|,/g;
// remove "$" and ","
return str.replace(re, "");
}


function closebox(boxid)
{
	var thisspan = eval(boxid); 
	thisspan.style.visibility="hidden";
}

function show_box(boxid,msg,clr,ht,wt,bk)
{	
	create_box(boxid,msg,clr,ht,wt,bk);
}


imgout=new Image(9,9);
imgin=new Image(9,9);

/////////////////BEGIN USER EDITABLE///////////////////////////////
	imgout.src="/gfx/u.gif";
	imgin.src="/gfx/d.gif";
///////////////END USER EDITABLE///////////////////////////////////

//this switches expand collapse icons
function filter(imagename,objectsrc){
	if (document.images){
		document.images[imagename].src=eval(objectsrc+".src");
	}
}


function show_calendar()
{
	document.getElementById("calendar").style.display = 'block';
}

function hide_calendar()
{
	document.getElementById("calendar").style.display = 'none';
}

function filterNum(str) {
          re = /\$|,|@|#|~|`|\%|\*|\^|\&|\(|\)|\+|\=|\[|\-|\_|\]|\[|\}|\{|\;|\:|\'|\"|\<|\>|\?|\||\\|\!|\$|\./g;
          // remove special characters like "$" and "," etc...
          return str.replace(re, "");
     }


function removeSpaces(string) {
		var tstring = "";
		string = '' + string;
		splitstring = string.split(" ");
		for(i = 0; i < splitstring.length; i++)
		tstring += splitstring[i];
		return tstring;
	}	
