
function GBI(obj)
{
  return document.getElementById(obj); 
}

//var scroll = GBI('tasrroll');
function show_minisections()
{

var minisections = GBI('minisekcie');

  if(minisections.style.display == 'none' || minisections.style.display =='')
    {
      minisections.style.display = 'block';
      setCookie('mini_sec','on',1); 
    }
    else
    {
      minisections.style.display = 'none';
      setCookie('mini_sec','off',1);  
    }


var li_minisections = GBI('li_minisections');

if(li_minisections.className == 'more')
  {
    li_minisections.className = 'more_sel';
  }
  else
  {
    li_minisections.className = 'more';
  }



return false;
}

function check_minisections()
{
  var minisections = GBI('minisekcie');
  var li_minisections = GBI('li_minisections');
  
  var cookie = getCookie('mini_sec');
      
  if(cookie == 'on')
    {
      minisections.style.display = 'block';
      li_minisections.className = 'more_sel';
    }
    else
    {
       minisections.style.display = 'none';
       li_minisections.className = 'more';
    }
 // alert(getCookie('mini_sec'));
//alert('bla');
}


function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

// refresh factsheet 
                             
function refresh_factsheet(num) {
  
  id_string = "factsheet_";
                                       
  var rand = Math.floor(Math.random()*num);
  
  for(i = 0; i < num ; i++) {
    var div = GBI(id_string+i)
    div.style.display = 'none';                                
  }
  
  var view = GBI(id_string+rand);
  view.style.display = 'block'; 
  
}

var InputSelector = Class.create({
	inputId: '',
	intput: null,
	initialize: function(inputId) {
		this.inputId = inputId;
		this.input = $(this.inputId);
		if (this.input != null) {
			this.input.observe('click', this.onActivate.bindAsEventListener(this))
		}
	},
	onActivate: function(event) {
		this.input.focus();
		this.input.select();
	}
});

