
setTimeout("scroll_in()", 2000);


var blogdata = new Array();
blog_effects();

function blog_effects()
{
  var sc=0;
  if (document.getElementById('cat')!=null)
    {
      var catbox= document.getElementById('cat');
      for (var a in catbox.childNodes)
					{
					if ((catbox.childNodes[a].tagName)&&(catbox.childNodes[a].tagName.toLowerCase()=="div"))
							 {
										blogdata[sc]=Array();
										blogdata[sc]['container']=catbox.childNodes[a];
										blogdata[sc]['topimg']=catbox.childNodes[a].getElementsByTagName('img')[0];
										blogdata[sc]['title']=catbox.childNodes[a].getElementsByTagName('a')[0];
										var cdiv = catbox.childNodes[a].getElementsByTagName('div');
										for (b in cdiv)
										{
												 if (cdiv[b].className=='latestlist') blogdata[sc]['latestlist']=cdiv[b];
										}
										blogdata[sc]['container']['backref']=blogdata[sc];
										sc=sc+1;
							 }
					}
    for (var a=0; a<sc; a++)
      {
//  	alert(blogdata[a]['title'] + '\n' + blogdata[a]['title'].innerHTML + '\n' + blogdata[a]['latestlist'].innerHTML);
	var s = blogdata[a];
	if (s['container'].className=='blog_current')
	  {
	  s['state']=1;
// 	  blog_addopenhandlers(s);
	  s['latestlist'].style.height=s['latestlist'].offsetHeight + 'px';
	  s['container'].setAttribute('id','blog_grow_cat');
	  }
	else
	  {
	  s['state']=0;
	  blog_addopenhandlers(s);
	  }
      }
    for (var n=1;n<50;n++)
      {
	setTimeout("setOpacity(document.getElementById('cat'),"+(n/50)+")",n*15);
      }
    }
}

function blog_addopenhandlers(s)
{
  s['container'].onclick = function (e) {blog_opento(this);return false;};
  s['container'].onClick = function (e) {blog_opento(this);return false;};
  s['container'].style.cursor='pointer';
//   alert(s['container'].innerHTML + '\n' + s['container'].onclick + '\n' + s['container'].onClick + '\n' + s['container']);
}

function blog_removeopenhandlers(s)
{
  s['container'].onclick = '';
  s['container'].onClick = '';
  s['container'].style.cursor='auto';
}

function blog_opento(s)
{
  s.backref.latestlist.style.height='auto';
  var fullheight = s.backref.latestlist.offsetHeight;
  s.backref.latestlist.style.height='0';
  if (document.getElementById('blog_grow_cat')) 
    {
      var o = document.getElementById('blog_grow_cat');
			if (document.getElementById('blog_shrink_cat')) 
					 document.getElementById('blog_shrink_cat').setAttribute('id','');
			o.setAttribute('id','blog_shrink_cat');
			blog_addopenhandlers(o.backref);
/*  var b= ' output:\n';
      for (m in o) { b = b + '\n '+ m + ' = ' + o[m]; }*/
// alert(b);
    }
  s.setAttribute('id','blog_grow_cat');
  blog_removeopenhandlers(s.backref);
  setTimeout("blog_growth(0,"+(fullheight)+");",10);
}

function blog_growth(now,final)
{
  var d = document.getElementById('blog_grow_cat');
  d.backref.latestlist.style.height = (now+1) + 'px';
  d.backref.title.style.bottom=(10-parseInt(40*(1-(now/final)))) + 'px';
  d.backref.topimg.style.marginBottom=(-parseInt(25*(1-(now/final)))) + 'px';

  if (document.getElementById('blog_shrink_cat'))
    {
    var o = document.getElementById('blog_shrink_cat');

    o.backref.title.style.bottom=(10-parseInt(40*((now/final)))) + 'px';
    o.backref.topimg.style.marginBottom=(-parseInt(25*((now/final)))) + 'px';

    var newh = (parseInt(o.backref.latestlist.style.height) - 4);
    if (newh<0) newh=0;
    o.backref.latestlist.style.height = newh + 'px'
    }
  now = now +2;
  if (now<=final)   setTimeout("blog_growth("+now+","+final+");",5);
}

// .gotjs .blog_inactive .section {
// bottom:-30px;
// }
// 
// .gotjs .blog_inactive .latestlist {
// height:0;
// }
// 
// .gotjs .blog_inactive .catsection img {
// margin-bottom:-25px;
// }


function scroll_in()
{
if (document.getElementById('smallblock')!==null)
  {
// 	alert("here");
	document.getElementById('smallblock').style.display = "block";
	var divs = document.getElementsByTagName('div');
	for (var a = 0; a < divs.length; a++) {if (divs[a].className=='block') divs[a].style.overflow='hidden';}
    var block = document.getElementById('smallblock');
    var h = block.offsetHeight;
//     block.style.bottom='-'+h+'px';
     scroll_in_step(0,h);
  }
// 	document.getElementById('smallblock').style.overflow = "hidden";
// 	document.getElementById('smallblock').style.height = "0";
}

function scroll_in_step(now,h)
{
// 	alert("here : "+now);
  var now = now + parseInt((h-now)*0.09) + 1;
  if (now > h) 
	{
		now =h;
		
	}
//   document.getElementById('smallblock').style.bottom = '-'+(h-now)+'px';
	document.getElementById('smallblock').style.height = (now)+'px';
		if (now < h) setTimeout('scroll_in_step('+now+','+h+')',50);
}

function setOpacity( element, alpha ) {
// 	if (alpha==1) alpha=0.999999;
	if( element.style.opacity !== undefined) { 
		element.style.opacity = alpha;
	}
	else if( element.style.filter !== undefined ) { 
		element.style.filter = 'alpha(opacity='+(alpha*100)+')';
	}
	else if( element.filters.alpha !== undefined ) { 
		element.filters.alpha.opacity = ( alpha * 100 );
	}
	else  if ( element.style.MozOpacity !== undefined ) {
		element.style.MozOpacity = alpha;
	}
} 

