// // // Transpernt Strart// // //
function toggle(div_id) {
	var el = document.getElementById(div_id);
	if ( el.style.display == 'none' ) {	el.style.display = 'block';} 
	else {el.style.display = 'none';}

	}

function blanket_size(popUpDivVar) {
	if (typeof window.innerWidth != 'undefined') {
		viewportheight = window.innerHeight;
	} else {
		viewportheight = document.documentElement.clientHeight;
	}
	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {
		blanket_height = viewportheight;
	} else {
		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
			blanket_height = document.body.parentNode.clientHeight;
		} else {
			blanket_height = document.body.parentNode.scrollHeight;
		}
	}
	var blanket = document.getElementById('blanket');
	blanket.style.height = blanket_height + 'px';

	if (screen.width == 800)
	{
		    blanket.style.width = 985 + 'px';
	}
	else
	{
		    blanket.style.width = screen.width-22 + 'px';
	}

    var popUpDiv = document.getElementById(popUpDivVar);
	popUpDiv_height=blanket_height/2-150;//150 is half popup's height
	popUpDiv.style.top = 100 + 'px';
	

}

 
function popup(windowname) {

	blanket_size(windowname);
	toggle('blanket');
	toggle(windowname);		
	 
    var popUpDiv = document.getElementById(windowname);
	popUpDiv.style.left = 250+ 'px';
}

function SetTop(val,popUpDivVar)
{

	var popUpDiv = document.getElementById(popUpDivVar);
	popUpDiv_height=blanket_height/2-150;//150 is half popup's height
	popUpDiv.style.top = val + 'px';
}

// // // Transpernt end // // //

 
 
 

// J Functions Starts Here //

// // // Page - List of Events // // //


// // // Page - List of ToDo Starts // // //
function showpopup(val,type,topval)
    {
        var objDiv = document.getElementById(val);
        if (type == 'yes')
            {   
                 
                if (val =='showcalpopup')
                    {
                        var objPopup = document.getElementById("popup");
                        var objCal = document.getElementById("calendar");
                        objPopup.style.display='';
                        objCal.style.display='';
                        
                        if (topval > 0)
                            {
                                objPopup.style.top=''+topval+'px';
                            }
                    }
                
            }
        else if (type == 'no')
            {
                if (val =='both')
                    {
                        var objPopup = document.getElementById("popup");
                        var objCal = document.getElementById("calendar");
                        objPopup.style.display='none';
                        objCal.style.display='none';      
                    }
                else
                    {
                        var objPopup = document.getElementById("popup");
                        var objCal = document.getElementById("calendar");
                        objPopup.style.display='none';
                        objCal.style.display='none';
                    }
            }
    }
// // // Page - List of ToDo Ends // // //


//////// show dynaymic popup start/////////////////


	 var offsetfromcursorY=10 //Customize y offset of tooltip
     var ns6=document.getElementById && !document.all
    
    function ietruebody(){
		    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
		  }

			    function showdiv(val,type,topval,leftval)
            {
                
                
                var curY=topval;
                var x;
                var objDiv = document.getElementById(val);
                topval=curY//-objDiv.offsetHeight-offsetfromcursorY;
                
                
                if (type == 'yes')
                    {   
                        objDiv.style.display='';
                         
                        if (topval > 0)
                            {
                                 
                                objDiv.style.top=''+topval+'px';
                                
                              
                                
                                if (val=='Div1')
                                {
                                 objDiv.style.left=270+'px';
                                 
                                 
                                }
                                else if (leftval>0)
                                {
                                 objDiv.style.left=leftval;
                                  
                                }
                                
                                else if (val=='orange')
                                {
                                 
                                 objDiv.style.left=30;
                                }
                                else
                                {
                                 x=document.body.scrollLeft+event.clientX;
                                 objDiv.style.left=x-objDiv.offsetWidth+50;
                                 }
                                 
                                 
                                 
                                
                                
                            }
                    }
                else if (type == 'no')
                    {
                        objDiv.style.display='none';
                         
                    }
                
                if (val =='details2')
                    {
                        if (type =='yes')
                            {
                                document.getElementById("more2").style.display='none';
                                document.getElementById("downarrow2").style.display='none';
                                document.getElementById("uparrow2").style.display='';
                                
                                
                            }
                        else if(type == 'no')
                            {
                                document.getElementById("more2").style.display='';
                                document.getElementById("downarrow2").style.display='';
                                document.getElementById("uparrow2").style.display='none';
                               
                            }
                    }
            }




 function showpopup(val,type,topval)
            {
                var objDiv = document.getElementById(val);
                if (type == 'yes')
                    {   
                        if (val =='calendar')
                            {
                                objDiv.style.display='';
                                if (topval > 0)
                                    {
                                        objDiv.style.top=''+topval+'px';
                                    }
                            }
                        if (val =='ToDoList')
                            {
                                objDiv.style.display='';
                                if (topval > 0)
                                    {
                                        objDiv.style.top=''+topval+'px';
                                    }
                            }
                        if (val =='showcalpopup')
                            {
                                var objPopup = document.getElementById("ToDoList");
                                var objCal = document.getElementById("calendar");
                                objPopup.style.display='';
                                objCal.style.display='';
                                
                                if (topval > 0)
                                    {
                                       // objPopup.style.top=''+topval+'px';
                                    }
                            }
                        
                    }
                else if (type == 'no')
                    {
                        if (val =='both')
                            {
                                var objPopup = document.getElementById("ToDoList");
                                var objCal = document.getElementById("calendar");
                                objPopup.style.display='none';
                                objCal.style.display='none';      
                            }
                        else
                            {
                                var objPopup = document.getElementById("ToDoList");
                                var objCal = document.getElementById("calendar");
                                objPopup.style.display='none';
                                objCal.style.display='none';
                            }
                    }
            }


 

function move_box(an, box)   
{   
    var cleft = 0;   
    var ctop = 0;   
    var obj = an;   
  
    while (obj.offsetParent)   
    {   
        cleft += obj.offsetLeft;   
        ctop += obj.offsetTop;   
        obj = obj.offsetParent;   
    }   
    
        
       
   
  
    ctop += an.offsetHeight-10;   
  
    // Handle Internet Explorer body margins,   
    // which affect normal document, but not   
    // absolute-positioned stuff.   
    if (document.body.currentStyle &&   
        document.body.currentStyle['marginTop'])   
    {   
        ctop += parseInt(   
            document.body.currentStyle['marginTop']);   
    }   
  
    box.style.top = ctop + 'px';   
}   
  
// Shows a box if it wasn't shown yet or is hidden   
// or hides it if it is currently shown   
function show_hide_box(an, width, height, borderStyle,id)   
{   
    var href = an.href;   
    
    var boxdiv = document.getElementById(id);   
  
    if (boxdiv != null)   
    {   
        
            move_box(an, boxdiv);   
            boxdiv.style.display='block';   
  
            bringToFront(boxdiv);   
  
              
        return false;   
    }   
  
      
    return false;   
}   
  
function getAbsoluteDivs()   
{   
    var arr = new Array();   
    var all_divs = document.body.getElementsByTagName("DIV");   
    var j = 0;   
  
    for (i = 0; i < all_divs.length; i++)   
        if (all_divs.item(i).style.position=='absolute')   
        {   
            arr[j] = all_divs.item(i);   
            j++;   
        }   
  
    return arr;   
}   
  
function bringToFront(obj)   
{   
    if (!document.getElementsByTagName)   
        return;   
  
    var divs = getAbsoluteDivs();   
    var max_index = 0;   
    var cur_index;   
  
    // Compute the maximal z-index of   
    // other absolute-positioned divs   
    for (i = 0; i < divs.length; i++)   
    {   
        var item = divs[i];   
        if (item == obj ||   
            item.style.zIndex == '')   
            continue;   
  
        cur_index = parseInt(item.style.zIndex);   
        if (max_index < cur_index)   
        {   
            max_index = cur_index;   
        }   
    }   
  
    obj.style.zIndex = max_index + 1;   
}   
  
//////// show dynaymic popup end /////////////////


