<!--
function getCookie(name)
{
	var ret = null;
	var dc = document.cookie;
	var prefix = name + "=";

	var begin = dc.indexOf("; " + prefix);
	if (begin == -1)
	    begin = dc.indexOf(prefix);
	else
	    begin += 2;

	if (begin >= 0)
	{
	    begin += prefix.length;
            var end = document.cookie.indexOf(";", begin);
            if (end == -1)
            	end = dc.length;
	    if(end>begin)
     		ret = unescape(dc.substring(begin, end));
	}
	return ret;
}

function setTimeoutLocation(file,time)
{
	window.setTimeout('location="'+file+'"',time*1000);
}

function setTimeoutReplace(file,time)
{
	window.setTimeout('location.replace("'+file+'")',time*1000);
}

function printWindow(print_dir,request_file)
{
	pwin=window.open(print_dir+request_file,"_blank","height=100,width=100");
	pwin.moveTo(-200,-200);
}

function getOpacity(id)
{
    var obj=document.getElementById(id);
    var op=1;
    if(obj.filters!=null)
    {
	if(obj.filters.alpha!=null)
	    op=obj.filters.alpha.opacity/100;
    }
    else if(obj.style.MozOpacity!=null)
    {
	op=parseFloat(obj.style.MozOpacity);
	if(isNaN(op))
	    op=1;
    }
    return op;
}

function setOpacity(id,op)
{
    var obj;

//    if(typeof(id)=="string")
	obj=document.getElementById(id);
//    else if(typeof(id)=="object")
//	obj=id;

    if(obj.filters!=null)
    {
	if(obj.filters.alpha!=null)
	    obj.filters.alpha.opacity=op*100;
    }
    else if(obj.style.MozOpacity!=null)
	obj.style.MozOpacity=op;
}


function fade(id,inc,cmd) 
{
    if(inc!=0)
    {
	var op=getOpacity(id);

	op+=inc;
	
	if(op<0)
	    op=0;
	if(op>1)
	    op=1;
	
	setOpacity(id,op);

	if((inc>0&&op<1)||(inc<0&&op>0))
	    window.setTimeout("fade(\""+id+"\","+inc+",\""+cmd+"\")",100);
	else if(cmd)
	    window.setTimeout(cmd,0);
    }
}

function fillHeight(id)
{
    var e=document.getElementById(id);
    if(e)
        e.style.height=document.body.clientHeight-e.offsetTop;
}

function fillWidth(id)
{
    var e=document.getElementById(id);
    if(e)
        e.style.width=document.body.clientWidth-e.offsetLeft;
}

function fillPage(id)
{
    var e=document.getElementById(id);
    if(e)
    {
        e.style.width=document.body.clientWidth-e.offsetLeft;
        e.style.height=document.body.clientHeight-e.offsetTop;
    }
}

function adjMenu(e)
{
    var agent=window.navigator.userAgent;
    var msie=agent.indexOf( "MSIE " );
    var firefox=agent.indexOf( "Firefox/" );
	
    if(msie>=0)
	msie=parseInt( agent.substring( msie+5, agent.indexOf (".", msie )));
    else
	msie=0;
    
    if(firefox>=0)
	firefox=parseInt( agent.substring( firefox+8, agent.indexOf (".", firefox )));
    else
	firefox=0;
    
    if(msie>0)
    {
	var n=e.nextSibling;
	
	while(n&&n.tagName!="TABLE")
	    n=n.nextSibling;
	
	if(n)
	{
	    n.style.left=-1;
	    n.style.borderWidth="0px 1px 1px 1px";
	    var w=e.clientWidth+2;
	    
	    if(n.clientWidth<w)
		n.width=w;
	}
    }
    else if(firefox>0)
    {
	var n=e.nextSibling;
	
	while(n&&n.tagName!="TABLE")
	    n=n.nextSibling;
	
	if(n)
	{
	    n.style.borderWidth="0px 1px 1px 0px";
	    var w=e.clientWidth;
	    if(n.clientWidth<w)
	    {
		var r=n.firstChild.firstChild;
		while(r)
		{
		    var c;
		    c=r.firstChild;
		    if(c.tagName!="TD")
			c=c.nextSibling;
		    if(c.tagName=="TD")
			c.firstChild.style.width=w;
		    
		    r=r.nextSibling;
		}
	    }
	}
    }

}

function changeBG(id,url_tmpl,i,max,interval)
{
    var elem=document.getElementById(id);
    if(elem)
    {
	if(i>max)
	    i=0;

	url=url_tmpl.replace("#",i);
	
	elem.background=url;


	if(interval>0)
	    window.setTimeout("changeBG('"+id+"','"+url_tmpl+"',"+(i+1)+","+max+","+interval+");",interval);
    }
}

//-->
