function integer(n){
	//	avoid octal parsing
	//	(strings beginning with "0" are always parsed as octal numbers)
	return parseInt(n,10)
}

function centreMe(oL){
	//	vertical and horizontal align a div: centreMe('myDiv')
	//	#myDiv	{position:absolute;top:-1000px;left:-1000px}
	if(document.getElementById){
		oWin=new clientwindow()
		newX=(integer(integer(oWin.w)-document.getElementById(oL).offsetWidth)/2)
		newY=(integer(integer(oWin.h)-document.getElementById(oL).offsetHeight)/2)
		document.getElementById(oL).style.left=newX>0?newX+"px":"0px"
		document.getElementById(oL).style.top=newY>0?newY+"px":"0px"
		document.getElementById(oL).style.position="absolute";
		if(document.getElementById(oL).style.visibility!="visible"){document.getElementById(oL).style.visibility="visible";}
		setTimeout("centreMe('"+oL+"')",5)
	}
	return
}

function clientwindow(){
	//--- browser window size ---
	if(self.innerHeight){	// all except Explorer
		this.w = self.innerWidth;
		this.h = self.innerHeight;
		return this
	}else if(document.documentElement&&document.documentElement.clientHeight){	// Explorer 6 Strict Mode
		this.w = document.documentElement.clientWidth;
		this.h = document.documentElement.clientHeight;
		return this
	}else if (document.body){	// other Explorers
		this.w = document.body.clientWidth;
		this.h = document.body.clientHeight;
		return this
	}
	return false
}

printLink=function(sText,pre,post){
	if(window.print){if(!pre){pre=""};if(!post){post=""};document.write(pre+"<a href\"#\" onclick=\"window.print();return false\" style=\"cursor:pointer;cursor:hand\">"+sText+"<\/a>"+post)}
}

//	email cloaking
//	cr 2005 ob
codeIn="!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@";
scrambler=function(tIn){
	for(n=0;n<tIn.length;n++){
		document.write((c=codeIn.indexOf(tIn.charAt(n)))>=0?codeIn.charAt(codeIn.length-c-1):tIn.charAt(n));
	}
}


function p(ohref,fname,w,h,params){
	if(!self.window.opener){
		self.window.name=""
	}
	if(params==""){
		params='toolbar=1,scrollbars=1,resizable=1'
	}
	h=h>(screen.availHeight*0.9)?screen.availHeight*0.9:h
	w=w>(screen.availWidth)?screen.availWidth:w
	aWinPos=centre_window(w,h)
	newWin=window.open(ohref,fname,params+',width='+Math.round(w)+',height='+Math.round(h)+",top="+aWinPos[1]+",left="+aWinPos[0])
	//myPopups++
	return false
}

function popPic(o){
	popwide=640
	pophigh=480
	p(o.href,'popup',popwide,pophigh,'resizable=1,scrollbars=1')
	return false
}

function zoom(o){
	popwide=400
	pophigh=400
	p(o.href,'zoom',popwide,pophigh,'resizable=1,scrollbars=1')
	return false
}

function centre_window(w,h){
	// calculate x,y positions for popup window to appear in the centre of the screen
	windims=new Array(
		Math.round((screen.availWidth-w)/2),
		Math.round(((screen.availHeight*0.9)-h)/2)
	)
	return windims
}
