/*
Copyright		:	http://www.chessguru.net/
*/
function getOb(id)
	{
	var o=false	
	o=document.getElementById?document.getElementById(id):document.all?document.all[id]:document.layers?eval('document.'+id):0
	return o;
	}
function openW(loc,target,w,h)
	{
	target=target||null
	w=w||430
	h=h||200
	var w=window.open(loc,target,"height="+h+",left=0,top=0,width="+w+",status=no,toolbar=no,menubar=no,location=no,resizable=yes")
	if(w.focus)w.focus()
	return false
	}
function setHome(id,sit)
	{
	var hp=getOb(id)
	if(!hp) return
	hp.onclick=function()
		{
		try
			{
			hp.style.behavior="url(#default#homepage)"
			hp.setHomePage(sit)
			}
		catch(e)
			{
			openW(hp.href)
			}
		return false
		}	
	}
function addFav(id,sit,title)
	{
	var fav=getOb(id)
	if(!fav) return
	fav.onclick=function()
		{
		if(window.external)
			window.external.AddFavorite(sit,title)
		else
			{
			openW(fav.href)
			}
		return false
		}
	}

function makeTitle(id,rep,desc)
	{
	var m=getOb(id)
	if(!m) return
	var title=document.title
	if(typeof (rep)!='undefined')
		{
		re = / /g;
		title=title.replace(re,rep)
		}
	if(!desc)
		m.href+='[ ' + title + ' ]'
	else
		m.href+='&amp;'+desc+'='+title
	}

function activeaza(id)
	{
	var o = document.getElementById?document.getElementById(id):document.all?document.all[id]:0
	if(!o)return
	if(o.children)
		{
		for(i=0;i<o.children.length;i++)
			{
			o.children[i].onmouseover=function()
				{
				this.className='over'
				}
			o.children[i].onmouseout=function()
				{
				if(window.event.toElement.parentElement.parentElement!=this && 
				   window.event.toElement!=this &&
				   window.event.toElement.parentElement!=this)
					this.className=''
				}
			}
		}
	}

function dim(id,sens,mx)
	{
	o=getOb(id)
	mx=mx||145
	if(!o.style.height) o.style.height='14px'
	var h=parseInt(o.style.height)
	if(window.rul && window.rul!=sens)return false
	if(sens!=-1)
		{
		if(h>=mx)
			{
			window.rul=''
			return
			}
		o.style.height=h+Math.ceil((mx-h)/2)+'px'
		}
	else
		{
		if(h<=0)
			{
			window.rul=''
			return
			}
		o.style.height=Math.floor(h/1.2)+'px'
		}
	window.rul=sens
	window.setTimeout(function(){dim(id,sens)},60)
	}

function inp(id,txt)
	{
	o=getOb(id)
	if(!o.value) o.value=txt
	o.onfocus=function(){if(this.value==txt) this.value=''}
	o.onblur=function(){if(!this.value) this.value=txt}
	}