function change_bg_color()
{
	var allPageTags = new Array(); 
	var allPageTags = document.getElementsByTagName("*");  
	var color;
	var obj = document.getElementById(cur_section);
	var styleProp = "background-color";

	if (obj.currentStyle)
		color = obj.currentStyle[styleProp];
	else if (window.getComputedStyle)
		color = document.defaultView.getComputedStyle(obj,null).getPropertyValue(styleProp);

  for (i = 0; i < allPageTags.length; i++)
	{
	  if (allPageTags[i].className == "entry")
		{
		    allPageTags[i].style.background = color;
		    if (allPageTags[i].firstChild)
		    	allPageTags[i].firstChild.style.background = color;
		}
  	if (allPageTags[i].className == "footer")
  	{
	  	allPageTags[i].style.borderBottomColor = color;
	  }
  	if (allPageTags[i].tagName == "li")
  	{
	  	allPageTags[i].style.background = color;
	  }
	}
  document.getElementById('entry_1').style.background = color;
  document.getElementById('entry_2').style.background = color;
  document.getElementById('entry_3').style.background = color;
  document.getElementById('entry_4').style.background = color;
}

function change_menu_font_color()
{
 	document.getElementById("entry_home").firstChild.style.color = "";
  document.getElementById("entry_presta").firstChild.style.color = "";
  document.getElementById("entry_prod").firstChild.style.color = "";
  document.getElementById("entry_contact").firstChild.style.color = "";
	document.getElementById(cur_section).firstChild.style.color = "#871519";
	if (document.getElementById("entry_1").firstChild && document.getElementById("entry_1").firstChild.style)
		document.getElementById("entry_1").firstChild.style.color = "";
	if (document.getElementById("entry_2").firstChild && document.getElementById("entry_2").firstChild.style)
		document.getElementById("entry_2").firstChild.style.color = "";
	if (document.getElementById("entry_3").firstChild && document.getElementById("entry_3").firstChild.style)
		document.getElementById("entry_3").firstChild.style.color = "";
	if (document.getElementById("entry_4").firstChild && document.getElementById("entry_4").firstChild.style)
		document.getElementById("entry_4").firstChild.style.color = "";
	if (document.getElementById(cur_tab).firstChild && document.getElementById(cur_tab).firstChild.style)
		document.getElementById(cur_tab).firstChild.style.color = "#871519";
}

function div_fade_on(pic_url, alpha)
{
    var pic = document.getElementById("pic");
    var bg_pic = document.getElementById("bg_pic");

    if (alpha < 1)
	{
	    alpha += 0.03;
	    bg_pic.style.opacity = alpha;
	    setTimeout("div_fade_on('"+pic_url+"', "+alpha+")");
	}
    else
	{
	    pic.style.backgroundImage = "url(" + pic_url + ")";
	    bg_pic.style.opacity = alpha;
	}
}

function change_bg_pic()
{
    
    var pic = document.getElementById("pic");
    var bg_pic = document.getElementById("bg_pic");
    var pic_url = "./pics/" + cur_section + ".png";

    bg_pic.style.backgroundImage = "url(" + pic_url + ")";
    div_fade_on(pic_url, 0);

}

function hide_li(obj)
{
	var lis;
	var i;

	lis = obj.getElementsByTagName('li');
	for (i = 0; lis[i]; i++)
	{
		lis[i].style.display = "none";
	}
}

function show_li(obj)
{
	var lis;
	var i;

	lis = obj.getElementsByTagName('li');
	for (i = 0; lis[i]; i++)
	{
		lis[i].style.display = "block";
	}
}

function cool_slide(from,to)
{
    if (from > to)
	{
	    d=-1;
	    old_entry.style.top = from + "px";
	}
    else
	{
	    d=1;
	    activ_entry.style.top = from + "px";
	}
    from += d;
    if (from != to)
        setTimeout("cool_slide("+from+","+to+")",5);
}

function cool_move(cur_obj)
{
	if (last_section)
	{
			old_entry = document.getElementById(last_section).firstChild;
	    cool_slide(52,0);
	}
  activ_entry = cur_obj;
  cool_slide(0,52);
}

