var tt_db = document.documentElement || document.body ||(document.getElementsByTagName ? document.getElementsByTagName("body")[0]: null);
var tt_body = (document.getElementsByTagName ? document.getElementsByTagName("body")[0]: (document.body || null));
var tt_u = "undefined";
var tt_scrlX = GetScrollX();
var	tt_scrlY = GetScrollY();
function GetScrollX()
{
	return(window.pageXOffset || (tt_db ? (tt_db.scrollLeft || 0) : 0));
}
function GetScrollY()
{
	return(window.pageYOffset || (tt_db ? (tt_db.scrollTop || 0) : 0));
}
function GetEvtX(e)
{
	return (e ? ((typeof(e.pageX) != tt_u) ? e.pageX : (e.clientX + tt_scrlX)) : 0);
}
function GetEvtY(e)
{
	return (e ? ((typeof(e.pageY) != tt_u) ? e.pageY : (e.clientY + tt_scrlY)) : 0);
}
function opacity(id, opacStart, opacEnd, millisec) 
{
    //speed for each frame 
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens 
    if (opacStart > opacEnd) {
        for (i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')", (timer * speed));
            timer++;
        }
    }
    else if (opacStart < opacEnd) {
        for (i = opacStart; i <= opacEnd; i++) {
            setTimeout("changeOpac(" + i + ",'" + id + "')", (timer * speed));
            timer++;
        }
    }
    //setTimeout("changeOpac(100,'digicam')", (timer * speed));
}
function showDiv(ID) 
{     
    var e=window.event;   
    var src=e.target || e.srcElement;            
    var x  = GetEvtX(e);
    var y =  GetEvtY(e);        
    //speed for each frame 
    var speed = Math.round(1000 / 100); 
    var timer = 0;            
    var div=document.getElementById(ID);           
    var css = div.style;	
    css.left = "200px";
    css.top = y + "px";
    css.display='block';        
     
    //COMMENT THIS CODE TO STOP THE TRANSITION EFFECT
    //Start          
    for (i = 0; i <= 100; i=i+1) {
        setTimeout("changeOpac(" + i + ",'" + ID + "')", (timer * speed));
        timer++;
    }
    //end
}
function hideDiv(ID) 
{
    var speed = Math.round(1000 / 100);
    var timer = 0;          
    var div=document.getElementById(ID);
    var css = div.style;		        
   
    //COMMENT THIS CODE TO STOP THE TRANSITION EFFECT
    //Start      
    for (i = 100; i >= 0; i=i-1) {
        setTimeout("changeOpac(" + i + ",'" + ID + "')", (timer * speed));
        timer++;
    }
     css.display='none';
     //end

}
function getTopPos(inputObj)
{	
  var returnValue = inputObj.offsetTop + inputObj.offsetHeight;
  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetTop;
  return returnValue ;
}

function AdjustDivHeight(divID)
{
  var div=document.getElementById(divID);
  var toppos=getTopPos(div);  
  var divHeight=350;

  if(toppos + divHeight > screen.height) 
  {
    toppos=screen.height-divHeight;
  }    
  div.style.top = toppos + 'px';

}       
var m_iInterval;
var m_Height;
var iScroll = 0;       
var arrDescriptions;
var arrCursor = 0;
var arrContent;
var arrMax;
var m_total;
function wl() 
{  
   //Set the Annoucement Content Here 
    arrContent = new Array();
    arrContent[0]='<b><u>February 3, 2012: </u></b>';  
    //arrContent[1]='<b>Updated: </b><a href="activities/festival.asp">Greek Food Festival</a> page!'; 
    //arrContent[1]='<b>Updated: </b><a href="orthodoxy/orthodox_local_news.asp">Orthodoxy in the Local News</a> has been updated with new articles.'; 
    //arrContent[1]='<b>New:</b> <a href="calendar.asp">Church Ministry Calendar</a>';
    //arrContent[1]='<b>Reminder: </b>Focus Pittsburgh to present <i><a href="movie_flyer.pdf">Mysteries of the Jesus Prayer</a></i>. <b>Reserve your seat now!</b>';
    arrContent[1]='<b>New! </b>January 2012 issue of <a href="newsletters/Jan-2012-issuePDF.pdf" target="_blank">Orthodox Observer</a> now Available.';  
    arrContent[2]='<b>Updated: </b><a href="activities/bulletin.asp">Weekly Bulletin</a>';
    arrContent[3]='<b>Updated: </b><a href="activities/parish_news.asp">Parish/Parishioner News</a>';
    arrContent[4]='<b>Missed an Orthodox Tidbit?</b>  Not a problem! Visit the <a href="orthodoxy/tidbit_archive.asp">Orthodox Tidbit Archives</a>.';
    arrContent[5]='Visit the <a href="orthodoxy/community.asp">Orthodox Community</a> for a calendar of local events.';
    //arrContent[5]='<b>Holy Land Trip Report/Photos: </b><a href="activities/tripreports/holyland.asp">Pilgrimage trip report</a> and photos available in the <a href="multimedia/events/2010_HolyLand_pilgrimage/2010_HolyLand_Pilgrimage.asp">Photo Gallery</a>.';
    //arrContent[6]='<b>Photos: </b><a href="multimedia/events/2011_GOYA_WorldVision/2011_GOYA_WorldVision.asp">GOYANs volunteering at WorldVision</a>.';
    //arrContent[7]='Visit the <a href="ministries/sunday_school.asp">Sunday School</a> page for updated information.';
    //arrContent[6]='Visit the <a href="multimedia/photos.asp">Photograph Gallery</a>.';
    arrContent[6]='Please provide the church office with <a href="mailto:dormitionweb@dormitionpgh.org">your name and email address</a>. Thank You!';
    arrContent[7]='Please specify on weekly offering envelopes if enclosed amount is to be applied to weekly offering or dues. Please write clearly.';
    arrContent[8]='Please use Baptismal Name when submitting names for the weekly bulletin for Memorials, Trisagions, Baptisms, Weddings or Commemorations.<br><br>';
    //arrContent[8]='St. Barbaras Philoptochos is re-establishing the custom of visiting parishioners that are homebound.  If you have a family member or friend that would like a friendly visit, please contact Penny Bouris @ 412-793-1612.';                
    //Make sure you keep this Variable updated when you add new content to the Array 
    //arrContent[6]='<b>Food Festival this weekend &#151; June 24, 25 & 26</b>';
    arrMax=8;    
    BuildContent();
    m_iInterval = setInterval(ontimer,150);
       
}        
function ontimer() 
{
    var base = document.getElementById("jump_base");  
    m_Height = base.offsetHeight; 
    m_total= base.scrollHeight;          
    iScroll += 2;
    if (m_Height + iScroll > (m_total) ) {
    //Append the Content to the Tail to ensure Continuity
        BuildContent();              
   }  
    base.scrollTop = iScroll;
}
function BuildContent()
{
 arrCursor++;
 var tbl = document.getElementById("news"); 
 var lastRow ; 
 var iteration ;
 var row;
 var cell;
 for(var i=0;i<=arrMax;i++)
 {
     lastRow=tbl.rows.length;	       
     iteration= lastRow;
	 row = tbl.insertRow(lastRow);
	 cell1 = row.insertCell(0);	 
     cell1.innerHTML=arrContent[i];
 }
 //Also Clear the Content if any previously present to free the Memory 
 if(arrCursor>2)
 {
  for(var i=arrMax;i>=0;i--)
  {
   tbl.deleteRow(i);
  }
  
   arrCursor=0;
   
   
 }

}
function pause() 
{
    clearInterval(m_iInterval);            
}
function resume() 
{
    m_iInterval = setInterval(ontimer, 150);
}   
//change the opacity for different browsers
function changeOpac(opacity, id) 
{           
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}




