sfHover = function() {
        if(document.getElementById("nav")) {
 	 var sfEls = document.getElementById("nav").getElementsByTagName("LI");
 	 for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhoverb"), "");
		}
	 }
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

var sTipTitle = null;
var sTipBody = null;


function startLoad() 
{
  var iterator; 
  iterator = document.getElementById("startLoop").value; 
  if( iterator == 1 )
  {
    var response = document.getElementById("startLoop");
    response.value = "2"; 
    panel.showNextPanel();
  }
  else if( iterator == 2 )
  {
    var response = document.getElementById("startLoop");
    response.value = "1"; 
    panel.showNextPanel();
  }
  else if( iterator == 3 )
  {
    var response = document.getElementById("startLoop");
    response.value = "1"; 
    panel.showFirstPanel();
  }
}

function startTimer()
{ 
  window.timer = setInterval("startLoad()", 5000); 
} 



function getBackground()
{
  var aPics = new Array();
  
  aPics[0] = new Array();
  aPics[0][0] = 'imagescl/catholicloyalty_pic0.jpg';  
  aPics[0][1] = 'Notre Dame is still standing today despite its near destruction during the French Revolution. It took 23 years to bring back its grandeur.';  
  aPics[0][2] = 'Notre Dame';  
  
  aPics[1] = new Array();
  aPics[1][0] = 'imagescl/catholicloyalty_pic1.jpg';  
  aPics[1][1] = 'St. Patrick`s Cathedral is the largest decorated Neo-Gothic-style Catholic cathedral in North America. It is the seat of the archbishop of the Roman Catholic Archdiocese of New York, and a parish church.';  
  aPics[1][2] = 'St. Patrick`s Cathedral';    
  
 
  aPics[2] = new Array();
  aPics[2][0] = 'imagescl/catholicloyalty_pic3.jpg';  
  aPics[2][1] = 'The great dome is made of brick and is 42.3 meters in interior diameter comparable to the size of the Pantheon, and rising to 120 meters above the floor.';  
  aPics[2][2] = 'Saint Peter`s Basilica Dome';  

  aPics[3] = new Array();
  aPics[3][0] = 'imagescl/catholicloyalty_pic4.jpg';  
  aPics[3][1] = 'St. Peter`s Basilica is the largest church ever built with an area of 23,000m<sup>2</sup> and has a capacity of over 60,000 people';  
  aPics[3][2] = 'St. Peter`s Basilica';  

  
  aPics[4] = new Array();
  aPics[4][0] = 'imagescl/catholicloyalty_pic2.jpg';  
  aPics[4][1] = 'Michelangelo painted more than 300 stories from the Bible on the Sistine Chapel ceiling. He finished this majestic masterpiece after four years';  
  aPics[4][2] = 'Michelangelo di Lodovico Buonarroti Simoni`s Painting';  
  

  aPics[5] = new Array();
  aPics[5][0] = 'imagescl/catholicloyalty_pic6.jpg';  
  aPics[5][1] = 'Cuernavaca Church somewhere in Mexico';  
  aPics[5][2] = 'Cuernavaca Church';  


 aPics[6] = new Array();
  aPics[6][0] = 'imagescl/catholicloyalty_pic7.jpg';  
  aPics[6][1] = 'St. Augustine Church, most popularly known as Paoay Church, is one of the four Philippine churches that was declared by UNESCO as a World Heritage Site. Paoay Church as commissioned by the Augustinian fiars started its construction in 1694 and was finally built in 1710 which due to its outstanding earthquake baroque architecture earns itself the coveted title from UNESCO.';  
  aPics[6][2] = 'St. Augustine Church';  
  
  
aPics[7] = new Array();
  aPics[7][0] = 'imagescl/catholicloyalty_pic8.jpg';  
  aPics[7][1] = 'A new mom holding a baby';  
  aPics[7][2] = 'New born Baby';  
  
  var o = shuffle( aPics );
 
  document.getElementById('tdBackground').setAttribute( 'background', o[0][0] );
  //document.getElementById('tooltip').innerHTML = o[0][1];
  //alert( o[0][0] +  o[0][2] + o[0][1]);
  sTipTitle = o[0][2];
  sTipBody  = o[0][1];  
}


function showCard ( nCardID )
{
  var aCards = new Array();
  aCards[1] = 'images/card_1.jpg';
  aCards[2] = 'images/card_2.jpg';
  aCards[3] = 'images/card_3.jpg';
  aCards[4] = 'images/card_4.jpg';
  
  document.getElementById('imgCard').setAttribute( 'src', aCards[nCardID] );
}

function init() 
{
  getBackground();
  new Tip( 'tip', sTipBody, {title : sTipTitle, offset: {x:-150, y:10}});
  

}

function shuffle( o )
{
  for( var j, x, i=o.length; i; j=parseInt(Math.random()*i), x=o[--i], o[i]=o[j], o[j]=x );
  return o;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

///////////////////////////////////////////////////////
// Contents for menu 1, 2, 3
// Menu's 1, 2 and 3 are for the home page and MAIN
///////////////////////////////////////////////////////
var menu1=new Array()
menu1[0]='<a href="http://www.catholicloyalty.com/main_custom.php?headfield=header_main&mainfield=cust015&footfield=footer_main">Member Program</a>'
menu1[1]='<a href=\"#\" onClick=\"MM_openBrWindow(\'fla/demo/Splash.html\',\'\',\'width=510,height=500\')\">Demo</a>'
menu1[2]='<a href="http://www.catholicloyalty.com/activate">Join / Activate</a>'
menu1[3]='<a href="http://www.catholicloyalty.com/main_rebate.php">Member Login / Home</a>'

//Contents for menu 2
var menu2=new Array()
menu2[0]='<a href="http://www.catholicloyalty.com/main_custom.php?headfield=header_main&mainfield=cust026&footfield=footer_main">The Story of CatholicLoyalty&trade;</a>'
menu2[1]='<a href="http://www.catholicloyalty.com/main_custom.php?headfield=header_main&mainfield=cust036&footfield=footer_main">What is Catholic Loyalty</a>'
menu2[2]='<a href="http://www.catholicloyalty.com/main_custom.php?headfield=header_main&mainfield=cust012&footfield=footer_main">How it started</a>'
menu2[3]='<a href="http://www.catholicloyalty.com/main_custom.php?headfield=header_main&mainfield=cust06&footfield=footer_main">Who we are</a>'
menu2[4]='<a href="http://www.catholicloyalty.com/main_custom.php?headfield=header_main&mainfield=cust013&footfield=footer_main">Share your Blessings</a>'
menu2[5]='<a href="http://www.catholicloyalty.com/main_custom.php?headfield=header_main&mainfield=cust024&footfield=footer_main">Papal Intentions</a>'
menu2[6]='<a href="http://www.catholicloyalty.com/main_custom.php?headfield=header_main&mainfield=cust025&footfield=footer_main">Appeal of the Week</a>'

//Contents for menu 3
var menu3=new Array()
menu3[0]='<a href="http://www.catholicloyalty.com/main_custom.php?headfield=header_main&mainfield=cust017&footfield=footer_main">Merchant Program</a>'
menu3[1]='<a href="http://www.catholicloyalty.com/main_custom.php?headfield=header_main&mainfield=cust040&footfield=footer_main">Demo</a>'
menu3[2]='<a href="http://www.catholicloyalty.com/main_rnetsignup.php">Join Now</a>'
menu3[3]='<a href="http://www.rnetwork.tv" target="_blank">Merchant Login</a>'
		
//Contents for menu shop
var menushop = [];

///////////////////////////////////////////////////////
// Contents for menu 4, 5, and 6
// Menu's 4, 5 and 6 are for the VISITOR SECTION
///////////////////////////////////////////////////////

var menu4=new Array()
menu4[0]='<a href="http://www.catholicloyalty.com/vis_custom.php?headfield=header_visitor&mainfield=cust015&footfield=footer_visitor">Member Program</a>'
menu4[1]='<a href=\"#\" onClick=\"MM_openBrWindow(\'fla/demo/Splash.html\',\'\',\'width=510,height=500\')\">Demo</a>'
menu4[2]='<a href="http://www.catholicloyalty.com/vis_rebatesignup.php">Join / Activate</a>'
menu4[3]='<a href="http://www.catholicloyalty.com/vis_rebate.php">Member Login / Home</a>'

//Contents for menu 5
var menu5=new Array()
menu5[0]='<a href="http://www.catholicloyalty.com/vis_custom.php?headfield=header_visitor&mainfield=cust026&footfield=footer_visitor">The Story of CatholicLoyalty&trade;</a>'
menu5[1]='<a href="http://www.catholicloyalty.com/vis_custom.php?headfield=header_visitor&mainfield=cust036&footfield=footer_visitor">What is Catholic Loyalty</a>'
menu5[2]='<a href="http://www.catholicloyalty.com/vis_custom.php?headfield=header_visitor&mainfield=cust012&footfield=footer_visitor">How it started</a>'
menu5[3]='<a href="http://www.catholicloyalty.com/vis_custom.php?headfield=header_visitor&mainfield=cust06&footfield=footer_visitor">Who we are</a>'
menu5[4]='<a href="http://www.catholicloyalty.com/vis_custom.php?headfield=header_visitor&mainfield=cust013&footfield=footer_visitor">Share your Blessings</a>'
menu5[5]='<a href="http://www.catholicloyalty.com/vis_custom.php?headfield=header_visitor&mainfield=cust024&footfield=footer_visitor">Papal Intentions</a>'
menu5[6]='<a href="http://www.catholicloyalty.com/vis_custom.php?headfield=header_visitor&mainfield=cust025&footfield=footer_visitor">Appeal of the Week</a>'

//Contents for menu 6
var menu6=new Array()
menu6[0]='<a href="http://www.catholicloyalty.com/vis_custom.php?headfield=header_visitor&mainfield=cust017&footfield=footer_visitor">Merchant Program</a>'
menu6[1]='<a href="http://www.catholicloyalty.com/vis_custom.php?headfield=header_visitor&mainfield=cust040&footfield=footer_visitor">Demo</a>'
menu6[2]='<a href="http://www.catholicloyalty.com/vis_rnetsignup.php">Join Now</a>'
menu6[3]='<a href="http://www.rnetwork.tv" target="_blank">Merchant Login</a>'
		
///////////////////////////////////////////////////////
// Contents for menu 7, 8, and 9
// Menu's 7, 8 and 9 are for the ACCOUNT SECTION
///////////////////////////////////////////////////////

var menu7=new Array()
menu7[0]='<a href="http://www.catholicloyalty.com/acct_custom.php?headfield=header_acct&mainfield=cust015&footfield=footer_acct">Member Program</a>'
menu7[1]='<a href=\"#\" onClick=\"MM_openBrWindow(\'fla/demo/Splash.html\',\'\',\'width=510,height=500\')\">Demo</a>'
menu7[2]='<a href="http://www.catholicloyalty.com/acct_rebatesignup.php">Join Now</a>'
menu7[3]='<a href="http://www.catholicloyalty.com/main_rebate.php">Member Login / Home</a>'

//Contents for menu 8
var menu8=new Array()
menu8[0]='<a href="http://www.catholicloyalty.com/acct_custom.php?headfield=header_acct&mainfield=cust026&footfield=footer_acct">The Story of CatholicLoyalty&trade;</a>'
menu8[1]='<a href="http://www.catholicloyalty.com/acct_custom.php?headfield=header_acct&mainfield=cust036&footfield=footer_acct">What is Catholic Loyalty</a>'
menu8[2]='<a href="http://www.catholicloyalty.com/acct_custom.php?headfield=header_acct&mainfield=cust012&footfield=footer_acct">How it started</a>'
menu8[3]='<a href="http://www.catholicloyalty.com/acct_custom.php?headfield=header_acct&mainfield=cust06&footfield=footer_acct">Who we are</a>'
menu8[4]='<a href="http://www.catholicloyalty.com/acct_custom.php?headfield=header_acct&mainfield=cust013&footfield=footer_acct">Share your Blessings</a>'
menu8[5]='<a href="http://www.catholicloyalty.com/acct_custom.php?headfield=header_acct&mainfield=cust024&footfield=footer_acct">Papal Intentions</a>'
menu8[6]='<a href="http://www.catholicloyalty.com/acct_custom.php?headfield=header_acct&mainfield=cust025&footfield=footer_acct">Appeal of the Week</a>'

//Contents for menu 9
var menu9=new Array()
menu9[0]='<a href="http://www.catholicloyalty.com/acct_custom.php?headfield=header_acct&mainfield=cust017&footfield=footer_acct">Merchant Program</a>'
menu9[1]='<a href="http://www.catholicloyalty.com/acct_custom.php?headfield=header_acct&mainfield=cust040&footfield=footer_acct">Demo</a>'
menu9[2]='<a href="http://www.catholicloyalty.com/acct_rnetsignup.php">Join Now</a>'
menu9[3]='<a href="http://www.rnetwork.tv" target="_blank">Merchant Login</a>'


var menuwidth='132px' //default menu width
var menubgcolor='#25264C'  //menu bgcolor
var textcolor='#FFFFFF'
var disappeardelay=0  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?


/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6) {
document.write('<div id="dropmenudiv" style="color:'+textcolor+';visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

document.write('<div id="dropmenudiv2" style="color:'+textcolor+';visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')
}

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function showhide(obj, e, visible, hidden, menuwidth, menubgcolor){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
if(menubgcolor) {
dropmenuobj.style.backgroundColor=menubgcolor
}
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}

function dropdownmenu(obj, e, menucontents, menuwidth, menubgcolor, currentDiv){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()

//clear the timing event
clearhidemenu()

//check to see if IE or NS
if (currentDiv == 'dropmenudiv2') {
  dropmenuobj=document.getElementById? document.getElementById("dropmenudiv2") : dropmenudiv2 
  hidemenu(e)
} else {
  dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv 
  hidemenu(e)
}

//Populate the dropdown with contents
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth, menubgcolor)

//set the position of the menu dropdown
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

if (document.images) {
	img1on = new Image();           // The onmouseover image
	img1on.src = "images/logo4roll.jpg";  
	
	img1off = new Image();          // The normally seen image
	img1off.src = "images/logo4.jpg"; 
	
  }				  //This function changes the image when over.
    function imgOn(imgName) {
            if (document.images) {
            document[imgName].src = eval(imgName + "on.src");
            }
    }				   //This function changes the image back when off.
    function imgOff(imgName) {
            if (document.images) {
            document[imgName].src = eval(imgName + "off.src");        
            }
    }

