﻿var interval=150;
var step=150;

function togglePannelStatus(content)
{
    var expand = (content.style.display=="none");
    content.style.display = (expand ? "block" : "none");
}

var currentContent = null;

function toggleChannels(id)
{
    content=document.getElementById(id);
    
    currentContent=null; 
    if (currentContent==null && content!=null)
    {
        currentContent = content;
        var expand = (content.style.display=="none");
       
        if (expand)
        {
            content.style.display = "block";
        }
        else
        {
            content.style.display = "none";
        }
        var max_height = content.offsetHeight;

        var step_height = step + (expand ? 0 : -max_height);
                
        
        content.style.height = Math.abs(step_height) + "px";
        setTimeout("togglePannelAnimatingStatus("+ interval + "," + step+ "," + max_height + "," + step_height + ")", interval);
    }
    resizeIframeCalender();
    return false;
}

var newContent;

function toggleChannelsAll(id,flag)
{
    content=document.getElementById(id);
    
    currentContent = null;
    if (currentContent==null && content!=null)
    {
  
        currentContent = content;
        var expand = (content.style.display=="none");
               
//            if (expand )
//            {
//                content.style.display = "block";
//            }
//            else
//            {
//                content.style.display = "none";
//            }
       
      
       if ( (flag=="1") && (expand==true))
       {
       content.style.display = "block";
      
       }
              
       else if ( (flag=="0") && (expand==false))
       {
       content.style.display = "none";
     
       }
       
        var max_height = content.offsetHeight;

        var step_height = step + (expand ? 0 : -max_height);
                
         
        content.style.height = Math.abs(step_height) + "px";
        newContent=content;
          
        //setTimeout("togglePannelAnimatingStatusAll("+ interval + "," + step+ "," + max_height + "," + step_height + "," + id + ")", 0);
        togglePannelAnimatingStatusAll(interval , step, max_height , step_height , id);
      
        
    }
   
    resizeIframeCalender();
   
    return false;
    
}
function togglePannelAnimatingStatus(interval,step, max_height, step_height)
{
    var step_height_abs = Math.abs(step_height);

    
    if (step_height_abs>=step && step_height_abs<=(max_height-step))
    { 
        step_height += step;
        if (currentContent !=null)
        {
            currentContent.style.height = Math.abs(step_height) + "px";
           
            setTimeout("togglePannelAnimatingStatus("+ interval + "," + step+ "," + max_height + "," + step_height + ")", interval);
        }
    }
    
    else
    {
        if (step_height_abs<step)
            currentContent.style.display = "none";
        currentContent.style.height = "";
        currentContent = null;
    }
}

function togglePannelAnimatingStatusAll(interval,step, max_height, step_height,newDivID)
{
 
    var step_height_abs = Math.abs(step_height);

  newContent=document.getElementById(newDivID);
 
    if (step_height_abs>=step && step_height_abs<=(max_height-step))
    {

        step_height += step;
        newContent.style.height = Math.abs(step_height) + "px";
        //setTimeout("togglePannelAnimatingStatusAll("+ interval + "," + step+ "," + max_height + "," + step_height + "," + newDivID + ")", 0);
        togglePannelAnimatingStatusAll(interval , step, max_height , step_height , newDivID);
    }
    
    else
    {
       if (  newContent !=null)
       {
           newContent.style.height = "";
       
       }
    }
}



