function toggle(id)
{
   if (document.getElementById(id).style.display == 'none')
   {
      appear(id, 1, 40);
   }
   else
   {
      fade(id, 1, 40);
   }
   return false;
}

function hideContent()
{
   fade('content-box', 3, 40);
   fade('navig', 3, 40);
   document.getElementById('show_btn').style.display = 'block';
}

function showContent()
{
   appear('content-box', 3, 40);
   appear('navig', 10, 100);
   document.getElementById('show_btn').style.display = 'none';
}

function setOpacity(domId, val) {
obj = document.getElementById(domId);
obj.style.MozOpacity = val;
obj.style.opacity = val/10;
/*obj.style.filter = 'alpha(opacity=' + val*10 + ')';*/

};


function fade(domId, levels, milis){
obj = document.getElementById(domId); //Get the Element
  
 if (obj.style.display == "none" || obj.style.visibility == "hidden") return false; //Return false if the element is already hidden

 var alpha = 10; //Set the initial value of alpha to 10 (Opaque)
 function f(){ //Internal function

  alpha-=levels; //Decrement the alpha value
  setOpacity(domId, alpha); //Set the opacity of our element to the specified alpha

  if(alpha > -1){ //If alpha is still bigger than -1 then..
   setTimeout(f, milis); //..then call the function again after 100 milliseconds

  }else{ //otherwise..
   obj.style.display = 'none';//display = 'none'; //..otherwise now that we cant see the element anyways, hide it

  }
}
setTimeout(f, milis); //This is where we call the f() function for the first time
};

function appear(domId, levels, milis){
obj = document.getElementById(domId); //Get the element

 if(obj.style.display != "none" && obj.style.visibility != "hidden") return false; //Return if it is already being displayed

 var alpha = 0; //Set the initial value of alpha to 0 (invisible)

 function a(){ //Internal function
  alpha+=levels; //Increment alpha

  setOpacity(domId, alpha); //Set the opacity of our element to the specified alpha
  //obj.style.display = ''; //Un-hide the object before its animation
  obj.style.display = '';

  if(alpha < 11)setTimeout(a, milis);
  else
  {
  //alert("transparent");
  //   obj.className = "transparent_065";
  }

/*Till alpha is 10, keep calling the
a() function after 100 milliseconds */

}
setTimeout(a, milis); //This is where we call the a() function for the first time*/
};
