//(C)Alex Barnard 2007
var _oLink,_oBlock

function _getObject(oID,hW){
	hW=(!hW)?document:hW.document
	if(hW.getElementById)
		return hW.getElementById(oID)
	else if(hW.all)
		return hW.all[oID]
	else if(hW.layers)
		return hW.layers[oID]		
	return false
}
//-------
function _T_all(pS){
	var c=window.location.hash.match(/\d+/)
	for (var i=0;i<_oLink.length;i++)
		_T_status(_oLink[i],pS||((c&&c==_oLink[i].getAttribute("item"))?1:0))
} 
function _T_status(me,pS){
	if(pS!=undefined)me._status=(/current/i.test(me.className))?1:pS	
	me.className=me._class+" btn"+me._status+me._roll
	_oBlock[me._index].style.display=(me._status!=1)?'none':''
}
function _T_define(){
	_oLink = document.getElementsByName('clickon');
	_oBlock = document.getElementsByName('showhide');
	for (var i=0;i<_oLink.length;i++){
		var o=_oLink[i]
		o._index=i
		o._status=1
		o._roll=0
		o._class=o.className
		o.onclick=function(){_T_status(this,(this._status==1)?0:1)}
		o.onmouseover=function(){this._roll=1;_T_status(this)}
		o.onmouseout=function(){this._roll=0;_T_status(this)}
	}
	_T_all(0)
}
//--search
var val
function _highlightText(){
	var w=location.search.match(/(?:&srh=)[^&]*/gi)
	if(w)w=unescape(w[0].substr(5))
	if(!w)return
	val=eval("/\\b("+w+")/gi")
	document.body.innerHTML=document.body.innerHTML.replace(/(>)([^<]+)(<)/gi,_parse1)
}	
function _parse1(a){
	return a.replace(val,_parse2)
}
function _parse2(a){
	return '<span class="search-highlight">'+a+'</span>'
}	

function _B_define(){
	var o=document.getElementsByTagName("IMG")
	if(!o)return
	for(var i=0;i<o.length;i++)
		if(/btnshowhide/i.test(o[i].className)){
			o[i].onclick=function(){
				var a=['hide','show']
				var cls=this.parentNode.childNodes[0]
				var flg=(cls.style.display=="none")?1:0
				cls.style.display=(flg)?"block":"none"
				this.src=this.src.replace(a[flg],a[(flg+1)%2])
			}
			o[i].onclick()
		}
			
}
//-------
function _initPage(){
	_highlightText()
	_initPM(0,14,1,-20,15)
	_PF_init()
	_T_define()
	_B_define()
	setTimeout("document.forms.frmSearch.txtInput.focus()",100)
}
window.onload=_initPage
